smtk::format_string Class Reference

a string class that uses a printf(3) style format More...

List of all members.

Public Member Functions

format_string format_stringappend (char c)
 append a character to the string
format_stringappend (const char *format,...) __attribute__((format(printf
 append to the string
void append_va (const char *format, va_list ap)
 append to the string using a format
char * c_str (void) const
 get the string as a char pointer
 format_string (int dummy, const char *format, va_list ap)
 non-empty string constructor
 format_string (const char *format,...) __attribute__((format(printf
 non-empty string constructor
 format_string (char **buffer, size_t *len)
 shared buffer constructor
 format_string (void)
 empty string constructor
int get_length (void) const
 get the length of the string
format_string format_stringset (void)
 set the string
format_stringset (const char *format,...) __attribute__((format(printf
 set the string
void set_va (const char *format, va_list ap)
 set to the string using a format
 ~format_string (void)
 destructor


Detailed Description

a string class that uses a printf(3) style format

Used interally in SmTk, but is available for SmTk API users. format_string is used manage message printf(3) format generated strings in spew.


Constructor & Destructor Documentation

format_string::format_string ( void   ) 

empty string constructor

Sets the string to an empty string ("").

format_string::format_string ( char **  buffer,
size_t *  len 
)

shared buffer constructor

Sets the string to an empty string ("").

Parameters:
buffer is used to realloc(3) memory. This buffer will not be freed, as it would in the case when a user does not provide a buffer.
len The value pointed to by len must be the current length of *buffer. *len will get set to the value of the allocated length of the string in *buffer.

format_string::format_string ( const char *  format,
  ... 
)

non-empty string constructor

Parameters:
format a printf(3) like format string.

format_string::format_string ( int  dummy,
const char *  format,
va_list  ap 
)

non-empty string constructor

Parameters:
dummy is a dummy variable so that this is not seen as being the same as the format_string(const char *format, ...) constructor when using the GNU C++ compiler, g++.
format a printf(3) like format string.
ap a standard va_list.
See `man stdarg' and `man snprintf'.


Member Function Documentation

format_string & format_string::append ( char  c  ) 

append a character to the string

Parameters:
c is a character to append to the string
Returns:
a reference to the format_string object.

format_string & format_string::append ( const char *  format,
  ... 
)

append to the string

Parameters:
format a printf(3) like format string.
Returns:
a reference to the format_string object.

void format_string::append_va ( const char *  format,
va_list  ap 
)

append to the string using a format

The name append_va() is used since append(const char *format, ...) is seen as being the same as append(const char *format, va_list ap) when using the GNU C++ compiler, g++.

Parameters:
format a printf(3) like format string.
ap a standard va_list.
See `man stdarg' and `man snprintf'.

char* smtk::format_string::c_str ( void   )  const [inline]

get the string as a char pointer

Returns:
a pointer to a character string.

int smtk::format_string::get_length ( void   )  const [inline]

get the length of the string

Returns:
the length of the string not including the null terminator.

format_string format_string& smtk::format_string::set ( void   )  [inline]

set the string

Parameters:
format a printf(3) like format string.
Returns:
a reference to the format_string object.

format_string & format_string::set ( const char *  format,
  ... 
)

set the string

Parameters:
format a printf(3) like format string.
Returns:
a reference to the format_string object.

void smtk::format_string::set_va ( const char *  format,
va_list  ap 
) [inline]

set to the string using a format

Parameters:
format a printf(3) like format string.
ap a standard va_list.
See `man stdarg' and `man snprintf'.


The documentation for this class was generated from the following files:
Generated on Sat Aug 11 22:25:57 2007 for Simulation Toolkit (SmTk) by  doxygen 1.5.2