ACE  6.4.2
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
ACE_SString Class Reference

A very Simple String ACE_SString class. This is not a general-purpose string class, and you should probably consider using ACE_CString is you don't understand why this class exists... More...

#include <SString.h>

Collaboration diagram for ACE_SString:
Collaboration graph
[legend]

Public Types

typedef ACE_Allocator::size_type size_type
 

Public Member Functions

 ACE_SString (ACE_Allocator *alloc=0)
 Default constructor. More...
 
 ACE_SString (const char *s, ACE_Allocator *alloc=0)
 Constructor that copies s into dynamically allocated memory. More...
 
 ACE_SString (const char *s, size_type len, ACE_Allocator *alloc=0)
 
 ACE_SString (const ACE_SString &)
 Copy constructor. More...
 
 ACE_SString (char c, ACE_Allocator *alloc=0)
 Constructor that copies c into dynamically allocated memory. More...
 
 ~ACE_SString (void)
 Default destructor. More...
 
char operator[] (size_type slot) const
 
char & operator[] (size_type slot)
 
ACE_SStringoperator= (const ACE_SString &)
 Assignment operator (does copy memory). More...
 
ACE_SString substring (size_type offset, size_type length=npos) const
 
ACE_SString substr (size_type offset, size_type length=npos) const
 Same as substring. More...
 
u_long hash (void) const
 Returns a hash value for this string. More...
 
size_type length (void) const
 Return the length of the string. More...
 
void rep (char *s)
 
const char * rep (void) const
 Get the underlying pointer. More...
 
const char * fast_rep (void) const
 Get the underlying pointer. More...
 
const char * c_str (void) const
 Same as STL String's c_str() and fast_rep(). More...
 
size_type strstr (const ACE_SString &s) const
 
size_type find (const ACE_SString &str, size_type pos=0) const
 
size_type find (const char *s, size_type pos=0) const
 
size_type find (char c, size_type pos=0) const
 
size_type rfind (char c, size_type pos=npos) const
 
bool operator== (const ACE_SString &s) const
 Equality comparison operator (must match entire string). More...
 
bool operator< (const ACE_SString &s) const
 Less than comparison operator. More...
 
bool operator> (const ACE_SString &s) const
 Greater than comparison operator. More...
 
bool operator!= (const ACE_SString &s) const
 Inequality comparison operator. More...
 
int compare (const ACE_SString &s) const
 Performs a strcmp()-style comparison. More...
 
void dump (void) const
 Dump the state of an object. More...
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 

Static Public Attributes

static const size_type npos
 No position constant. More...
 

Private Attributes

ACE_Allocatorallocator_
 Pointer to a memory allocator. More...
 
size_type len_
 Length of the ACE_SString (not counting the trailing '\0'). More...
 
char * rep_
 Pointer to data. More...
 

Detailed Description

A very Simple String ACE_SString class. This is not a general-purpose string class, and you should probably consider using ACE_CString is you don't understand why this class exists...

This class is optimized for efficiency, so it doesn't provide any internal locking. CAUTION: This class is only intended for use with applications that understand how it works. In particular, its destructor does not deallocate its memory when it is destroyed... We need this class since the ACE_Map_Manager requires an object that supports the operator == and operator !=. 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.

Member Typedef Documentation

Constructor & Destructor Documentation

ACE_SString::ACE_SString ( ACE_Allocator alloc = 0)

Default constructor.

ACE_SString::ACE_SString ( const char *  s,
ACE_Allocator alloc = 0 
)

Constructor that copies s into dynamically allocated memory.

ACE_SString::ACE_SString ( const char *  s,
size_type  len,
ACE_Allocator alloc = 0 
)

Constructor that copies len chars of s into dynamically allocated memory (will NUL terminate the result).

ACE_SString::ACE_SString ( const ACE_SString s)

Copy constructor.

ACE_SString::ACE_SString ( char  c,
ACE_Allocator alloc = 0 
)

Constructor that copies c into dynamically allocated memory.

ACE_SString::~ACE_SString ( void  )
inline

Default destructor.

Member Function Documentation

const char * ACE_SString::c_str ( void  ) const
inline

Same as STL String's c_str() and fast_rep().

int ACE_SString::compare ( const ACE_SString s) const
inline

Performs a strcmp()-style comparison.

void ACE_SString::dump ( void  ) const

Dump the state of an object.

const char * ACE_SString::fast_rep ( void  ) const
inline

Get the underlying pointer.

ACE_SString::size_type ACE_SString::find ( const ACE_SString str,
size_type  pos = 0 
) const
inline

Find str starting at pos. Returns the slot of the first location that matches (will be >= pos), else npos.

ACE_SString::size_type ACE_SString::find ( const char *  s,
size_type  pos = 0 
) const
inline

Find <s> starting at pos. Returns the slot of the first location that matches (will be >= pos), else npos.

ACE_SString::size_type ACE_SString::find ( char  c,
size_type  pos = 0 
) const
inline

Find c starting at pos. Returns the slot of the first location that matches (will be >= pos), else npos.

u_long ACE_SString::hash ( void  ) const
inline

Returns a hash value for this string.

ACE_SString::size_type ACE_SString::length ( void  ) const
inline

Return the length of the string.

bool ACE_SString::operator!= ( const ACE_SString s) const
inline

Inequality comparison operator.

bool ACE_SString::operator< ( const ACE_SString s) const
inline

Less than comparison operator.

ACE_SString & ACE_SString::operator= ( const ACE_SString s)

Assignment operator (does copy memory).

bool ACE_SString::operator== ( const ACE_SString s) const
inline

Equality comparison operator (must match entire string).

bool ACE_SString::operator> ( const ACE_SString s) const
inline

Greater than comparison operator.

char ACE_SString::operator[] ( size_type  slot) const
inline

Return the <slot'th> character in the string (doesn't perform bounds checking).

char & ACE_SString::operator[] ( size_type  slot)
inline

Return the <slot'th> character by reference in the string (doesn't perform bounds checking).

void ACE_SString::rep ( char *  s)

Set the underlying pointer. Since this does not copy memory or delete existing memory use with extreme caution!!!

const char * ACE_SString::rep ( void  ) const
inline

Get the underlying pointer.

ACE_SString::size_type ACE_SString::rfind ( char  c,
size_type  pos = npos 
) const
inline

Find c starting at pos (counting from the end). Returns the slot of the first location that matches, else npos.

ACE_SString::size_type ACE_SString::strstr ( const ACE_SString s) const
inline

Comparison operator that will match substrings. Returns the slot of the first location that matches, else npos.

ACE_SString ACE_SString::substr ( size_type  offset,
size_type  length = npos 
) const
inline

Same as substring.

ACE_SString ACE_SString::substring ( size_type  offset,
size_type  length = npos 
) const

Return a substring given an offset and length, if length == npos use rest of str return empty substring if offset or offset/length are invalid

Member Data Documentation

ACE_SString::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

ACE_Allocator* ACE_SString::allocator_
private

Pointer to a memory allocator.

size_type ACE_SString::len_
private

Length of the ACE_SString (not counting the trailing '\0').

ACE_SString::size_type const ACE_SString::npos
static
Initial value:

No position constant.

char* ACE_SString::rep_
private

Pointer to data.


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