StringBuffer Class Reference
[Callback and Event Handling Interfaces]

Dynamic-sized formatted string buffer. More...

#include <events.h>

List of all members.

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.


Detailed Description

Dynamic-sized formatted 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.


Member Function Documentation

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 
)

Append a formatted string to the buffer, using varargs.

See also:
AppendFmt()

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.

Return values:
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.


The documentation for this class was generated from the following file:
Generated on Fri Jan 9 05:58:39 2009 for libhfp by  doxygen 1.5.4