#include <events.h>
Public Member Functions | |
StringBuffer (const char *init) | |
Initialize to a permanent string constant. | |
void | Clear (void) |
Clear the contents of the string buffer. | |
char * | Contents (void) const |
Query the contents of the string buffer. | |
bool | AppendFmtVa (const char *fmt, va_list ap) |
Append a formatted string to the buffer, using varargs. | |
bool | AppendFmt (const char *fmt,...) __attribute__((format(printf |
Append a formatted string to the string buffer. |
The string buffer is a dynamic printf container for collecting formatted string values. It is much more primitive than std::string, and does not support any of the expected syntactic sugar, such as the operator overloads. However, it does support printf() style formatting.
void Clear | ( | void | ) |
Clear the contents of the string buffer.
This method has the effect of setting the length of the string buffer contents to zero, and freeing any buffer memory allocated to the string buffer.
char* Contents | ( | void | ) | const [inline] |
Query the contents of the string buffer.
This method returns the current contents of the string buffer. The pointer will remain valid until the contents are appended to by AppendFmt(), or cleared by Clear().
The buffer returned should not be directly modified.
bool AppendFmtVa | ( | const char * | fmt, | |
va_list | ap | |||
) |
bool AppendFmt | ( | const char * | fmt, | |
... | ||||
) |
Append a formatted string to the string buffer.
This function appends the result of a printf() style formatting operation to the end of the string buffer.
true | String formatted and appended | |
false | String could not be formatted, either due to an invalid format string, or because there was not enough memory to enlarge the buffer to contain the result of the formatting procedure. |