#include <tb_formatter.hpp>
Public Member Functions | |
Formatter (const char *formattedMessage,...) | |
Formatter (const Formatter &other) | |
Formatter (Formatter &&other) | |
~Formatter (void) | |
Formatter & | operator= (const Formatter &other) |
Formatter & | operator= (Formatter &&other) |
const char * | c_str (void) const |
Static Public Member Functions | |
static Formatter | FromArgumentList (const char *formattedMessage, va_list argumentsList) |
The Formatter is a very small helper function that will take a printf style formatted string and the additional parameters to build and hold the string in memory until the Formatter object dies.
|
explicit |
TurtleBrains::Core::Formatter::Formatter | ( | const Formatter & | other | ) |
Constructs a Formatter object by copying another. This will invoke memory allocations to create a buffer for the message.
other | The formatter object to copy from. The contents will be duplicated. |
TurtleBrains::Core::Formatter::Formatter | ( | Formatter && | other | ) |
Moves one Formatter into another without invoking additional memory allocations.
other | The formatter object to move the buffer from without allocation memory. |
TurtleBrains::Core::Formatter::~Formatter | ( | void | ) |
Cleans up all the resources used from the Formatter object, which will include freeing memory.
const char* TurtleBrains::Core::Formatter::c_str | ( | void | ) | const |
Returns a null-terminated string of the buffer contents, or an empty string if buffer is empty.
|
static |
Build a Formatter object from the printf style formatted string and the additional parameters supplied by a va_list.
formattedMessage | A string using printf formatter options to specify how to use the additional parameters sent in. |
argumentList | A list of the arguments to use to format a message like vasprintf(). |
Assigns one Formatter object to that of another one by assignment. This may invoke memory allocations to if required to create the buffer for the message.
other | The formatter object to copy from. The contents will be duplicated. |