NAME

ACE_CString - This class provides a wrapper facade for C strings.

SYNOPSIS

#include <ace/SString.h>

class ACE_CString { public: static const int npos; ACE_CString (ACE_Allocator *alloc = 0); ACE_CString ( const char *s, ACE_Allocator *alloc = 0, int release = 1 ); ACE_CString ( const char *s, size_t len, ACE_Allocator *alloc = 0, int release = 1 ); ACE_CString (const ACE_CString &); ACE_CString (const ACE_USHORT16 *s, ACE_Allocator *alloc = 0); ACE_CString (char c, ACE_Allocator *alloc = 0); ~ACE_CString (void); const char &operator [] (size_t slot) const; char &operator [] (size_t slot); ACE_CString &operator = (const ACE_CString &); void set (const char *s, int release = 1); void set (const char *s, size_t len, int release); ACE_CString substring (size_t offset, ssize_t length = -1) const; ACE_CString substr (size_t offset, ssize_t length = -1) const; ACE_CString &operator += (const ACE_CString &); u_long hash (void) const; size_t length (void) const; char *rep (void) const; const char *fast_rep (void) const; const char *c_str (void) const; int strstr (const ACE_CString &s) const; int find (const ACE_CString &str, int pos = 0) const; int find (const char *s, int pos = 0) const; int find (char c, int pos = 0) const; int rfind (char c, int pos = npos) const; int operator == (const ACE_CString &s) const; int operator < (const ACE_CString &s) const; int operator > (const ACE_CString &s) const; int operator != (const ACE_CString &s) const; int compare (const ACE_CString &s) const; void dump (void) const; ACE_ALLOC_HOOK_DECLARE; private: ACE_Allocator *allocator_; size_t len_; size_t buf_len_; char *rep_; int release_; static char NULL_CString_; };

DESCRIPTION

This class uses an ACE_Allocator to allocate memory. The user can make this a persistant class by providing an ACE_Allocator with a persistable memory pool. NOTE: if an instance of this class is constructed from or assigned an empty string (with first element of '\ '), then it is _not_ allocated new space. Instead, its internal representation is set equal to a global empty string. CAUTION: in cases when ACE_CString is constructed from provided buffer with release parameter set to 0, ACE_CString is not guaranteed to be '\ ' terminated. This is a place holder until all compilers implement the ANSI/ISO C++ standard String class.

PUBLIC MEMBERS

static const int npos;

ACE_CString (ACE_Allocator *alloc = 0);

ACE_CString (
    const char *s,
    ACE_Allocator *alloc = 0,
    int release = 1
    );

ACE_CString (
    const char *s,
    size_t len,
    ACE_Allocator *alloc = 0,
    int release = 1
    );

ACE_CString (const ACE_CString &);

ACE_CString (const ACE_USHORT16 *s, ACE_Allocator *alloc = 0);

ACE_CString (char c, ACE_Allocator *alloc = 0);

~ACE_CString (void);

const char &operator [] (size_t slot) const;

char &operator [] (size_t slot);

ACE_CString &operator = (const ACE_CString &);

void set (const char *s, int release = 1);

void set (const char *s, size_t len, int release);

ACE_CString substring (size_t offset, ssize_t length = -1) const;

ACE_CString substr (size_t offset, ssize_t length = -1) const;

ACE_CString &operator += (const ACE_CString &);

u_long hash (void) const;

size_t length (void) const;

char *rep (void) const;

const char *fast_rep (void) const;

const char *c_str (void) const;

int strstr (const ACE_CString &s) const;

int find (const ACE_CString &str, int pos = 0) const;

int find (const char *s, int pos = 0) const;

int find (char c, int pos = 0) const;

int rfind (char c, int pos = npos) const;

int operator == (const ACE_CString &s) const;

int operator < (const ACE_CString &s) const;

int operator > (const ACE_CString &s) const;

int operator != (const ACE_CString &s) const;

int compare (const ACE_CString &s) const;

void dump (void) const;

ACE_ALLOC_HOOK_DECLARE;

PRIVATE MEMBERS

ACE_Allocator *allocator_;

size_t len_;

size_t buf_len_;

char *rep_;

int release_;

static char NULL_CString_;

AUTHOR

Douglas C. Schmidt (schmidt@cs.wustl.edu)

LIBRARY

ace