UCommon
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
ucommon::memstring Class Reference

A string class that uses a cstring buffer that is fixed in memory. More...

#include <string.h>

Inheritance diagram for ucommon::memstring:
Inheritance graph
[legend]
Collaboration diagram for ucommon::memstring:
Collaboration graph
[legend]

Public Member Functions

 memstring (void *memory, strsize_t size, char fill=0)
 Create an instance of a memory string.
void operator= (string &object)
 Assign the text of a string to our object.
void operator= (const char *text)
 Assign null terminated text to our object.
 ~memstring ()
 Destroy memory string.

Static Public Member Functions

static memstringcreate (strsize_t size, char fill=0)
 Create a memory string with memory allocated from the heap.
static memstringcreate (MemoryProtocol *pager, strsize_t size, char fill=0)
 Create a memory string with memory allocated from a pager.

Static Public Attributes

static const size_t header

Protected Member Functions

cstringc_copy (void) const
 Return cstring to use in copy constructors.

Detailed Description

A string class that uses a cstring buffer that is fixed in memory.

This allows one to manipulate a fixed buffer of text in memory through the string class. The size of the memory used must include space for the overhead() size needed for the cstring object control data.

Author:
David Sugar <dyfet@gnutelephony.org>

Constructor & Destructor Documentation

ucommon::memstring::memstring ( void *  memory,
strsize_t  size,
char  fill = 0 
)

Create an instance of a memory string.

Parameters:
memoryto use for cstring object.
sizeof string. Total size must include space for overhead.
fillcharacter for fixed character fields.

Member Function Documentation

cstring* ucommon::memstring::c_copy ( void  ) const [protected, virtual]

Return cstring to use in copy constructors.

Is virtual for memstring.

Returns:
cstring for copy constructor.

Reimplemented from ucommon::string.

static memstring* ucommon::memstring::create ( strsize_t  size,
char  fill = 0 
) [static]

Create a memory string with memory allocated from the heap.

Parameters:
sizeof string to allocate. Automatically adds control size.
fillcharacter for fixed field strings.
static memstring* ucommon::memstring::create ( MemoryProtocol *  pager,
strsize_t  size,
char  fill = 0 
) [static]

Create a memory string with memory allocated from a pager.

Parameters:
pagerto allocate memory from.
sizeof string to allocate. Automatically adds control size.
fillcharacter for fixed field strings.
void ucommon::memstring::operator= ( string object) [inline]

Assign the text of a string to our object.

Parameters:
objectto copy text from.

Reimplemented in ucommon::stringbuf.

Definition at line 1443 of file string.h.

void ucommon::memstring::operator= ( const char *  text) [inline]

Assign null terminated text to our object.

Parameters:
textto copy.

Reimplemented from ucommon::string.

Reimplemented in ucommon::stringbuf.

Definition at line 1450 of file string.h.


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