|
lipsum-cpp 0.5.4
A basic library written in C++ for generating placeholder Lorem Ipsum text.
|
This namespace contains functions only used internally by other functions. More...
Concepts | |
| concept | ToStringable |
| Can std::to_string() be called with T? | |
| concept | Streamable |
| Can std::ostream take T? | |
| concept | IsInt |
| Is T an int? | |
| concept | UniformDistributionType |
| Can std::uniform_int_distribution or std::uniform_real_distribution be constructed with T? | |
Enumerations | |
| enum class | LogType : int { Trace = 0 , Info , Warn , Error , Critical } |
| Log types for lipsum::internal::LogWarn(). More... | |
Functions | |
| LIPSUM_API std::string | HandleHTMLEntity (char letter, Format format=Format::HTML) |
| Handle HTML entities. | |
| template<typename... Args> | |
| void | LogWarn (LogType type, const Args &... args) |
| Log a warning. | |
| template<Streamable T> | |
| std::string | ToString (const T ¶m) |
| Convert an object to a string. | |
| template<ToStringable T> | |
| std::string | ToString (const T ¶m) |
| template<typename T> | |
| T | ToType (const std::string &input) |
| Convert a string to an object. | |
This namespace contains functions only used internally by other functions.
This namespace's functions are not intended for public use and are not exposed in the C wrapper.
|
strong |
Log types for lipsum::internal::LogWarn().
| std::string lipsum::internal::HandleHTMLEntity | ( | char | letter, |
| Format | format = Format::HTML ) |
Handle HTML entities.
Handle escaping HTML entities, escaping Markdown characters, etc.
| letter | The character to handle. |
| format | The format to escape in. |
| void lipsum::internal::LogWarn | ( | LogType | type, |
| const Args &... | args ) |
Log a warning.
Log to the console coloured using ANSI escape codes with a message, ending in a newline. If in Emscripten environment, use JavaScript console functions instead. If in Windows environment, use SetConsoleTextAttribute() instead. If doing a minimum build, skip colouring text or logging in JS console. If doing a quiet build, do not print.
| Args | The arguments' types. All must be printable with std::ostream, or else the code will fail to compile. |
| type | The log type of the message. |
| args | The arguments to print. |
| std::string lipsum::internal::ToString | ( | const T & | param | ) |
Convert an object to a string.
This function converts the parameter passed into a string using std::stringstream or std::to_string().
| T | The type being converted. Must be printable using std::stringstream or convertable using std::to_string(). |
| param | The parameter being converted. |
| T lipsum::internal::ToType | ( | const std::string & | input | ) |
Convert a string to an object.
This function converts the string passed into the specified type. If T is std::string, return input. If T is bool, return based on if input is true/1 or false/0. If T is char, get first character of the string or a null character if the string is empty. If T is an integer type, convert using std::from_chars(). Else, convert using std::stringstream.
| T | The type being converted to. |
| input | The string being converted. |