ucc::charbuf< S > Class Template Reference

A template to create a character array that can be manipulated as a string. More...

#include <string.h>


Public Member Functions

 charbuf ()
 Create a new character buffer with an empty string.
 charbuf (char *text)
 Create a character buffer with assigned text.
void operator= (char *text)
 Assign null terminated text to the object.
void operator+= (char *text)
 Concatenate text into the object.
 operator bool ()
 Test if data is contained in the object.
bool operator! ()
 Test if the object is empty.
 operator char * ()
 Get text by casting reference.
char * operator* ()
 Get text by object pointer reference.
char operator[] (size_t offset)
 Array operator to get a character from the object.
char * operator() (size_t offset)
 Get a pointer to an offset in the object by expression operator.
size_t size (void)
 Get allocated size of the object.


Detailed Description

template<size_t S>
class ucc::charbuf< S >

A template to create a character array that can be manipulated as a string.

This is a mini string/stringbuf class that supports a subset of functionality but does not require a complex supporting object. Like stringbuf, this can be used to create local string variables.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1518 of file string.h.


Constructor & Destructor Documentation

template<size_t S>
ucc::charbuf< S >::charbuf ( char *  text  )  [inline]

Create a character buffer with assigned text.

If the text is larger than the size of the object, it is truncated.

Parameters:
text to assign.

Definition at line 1535 of file string.h.


Member Function Documentation

template<size_t S>
ucc::charbuf< S >::operator bool (  )  [inline]

Test if data is contained in the object.

Returns:
true if there is text.

Definition at line 1557 of file string.h.

template<size_t S>
ucc::charbuf< S >::operator char * (  )  [inline]

Get text by casting reference.

Returns:
pointer to text in object.

Definition at line 1571 of file string.h.

template<size_t S>
bool ucc::charbuf< S >::operator! (  )  [inline]

Test if the object is empty.

Returns:
true if the object is empty.

Definition at line 1564 of file string.h.

template<size_t S>
char* ucc::charbuf< S >::operator() ( size_t  offset  )  [inline]

Get a pointer to an offset in the object by expression operator.

Parameters:
offset of character in string buffer.
Returns:
pointer to offset in object.

Definition at line 1594 of file string.h.

template<size_t S>
char* ucc::charbuf< S >::operator* (  )  [inline]

Get text by object pointer reference.

Returns:
pointer to text in object.

Definition at line 1578 of file string.h.

template<size_t S>
void ucc::charbuf< S >::operator+= ( char *  text  )  [inline]

Concatenate text into the object.

If the text is larger than the size of the object, then it is truncated.

Parameters:
text to append.

Definition at line 1550 of file string.h.

template<size_t S>
void ucc::charbuf< S >::operator= ( char *  text  )  [inline]

Assign null terminated text to the object.

Parameters:
text to assign.

Definition at line 1542 of file string.h.

template<size_t S>
char ucc::charbuf< S >::operator[] ( size_t  offset  )  [inline]

Array operator to get a character from the object.

Parameters:
offset of character in string buffer.
Returns:
character at offset.

Definition at line 1586 of file string.h.

template<size_t S>
size_t ucc::charbuf< S >::size ( void   )  [inline]

Get allocated size of the object.

Returns:
allocated size.

Definition at line 1601 of file string.h.


The documentation for this class was generated from the following file:

Generated on Tue Jul 28 21:46:14 2009 for UCommon by  doxygen 1.5.9