Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_WString Class Reference

This class provides a wrapper facade for C wide strings. More...

#include <SString.h>

Collaboration diagram for ACE_WString:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_WString (ACE_Allocator *alloc = 0)
 Default constructor.

 ACE_WString (const char *s, ACE_Allocator *alloc = 0)
 Constructor that copies <s> into dynamically allocated memory.

 ACE_WString (const ACE_WSTRING_TYPE *s, ACE_Allocator *alloc = 0)
 Constructor that copies <s> into dynamically allocated memory.

 ACE_WString (const ACE_USHORT16 *s, size_t len, ACE_Allocator *alloc = 0)
 Constructor that takes in a ushort16 string (mainly used by the ACE Name_Space classes).

 ACE_WString (const ACE_WSTRING_TYPE *s, size_t len, ACE_Allocator *alloc = 0)
 Constructor that copies <len> ACE_WSTRING_TYPE's of <s> into dynamically allocated memory (will NUL terminate the result).

 ACE_WString (size_t len, ACE_Allocator *alloc = 0)
 Constructor that dynamically allocates memory for <len> + 1 ACE_WSTRING_TYPE characters. The newly created memory is set memset to 0.

 ACE_WString (const ACE_WString &s)
 Copy constructor.

 ACE_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0)
 Constructor that copies <c> into dynamically allocated memory.

 ~ACE_WString (void)
 Deletes the memory...

ACE_WSTRING_TYPE operator[] (size_t slot) const
 Return the <slot'th> character in the string (doesn't perform bounds checking).

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

ACE_WString& operator= (const ACE_WString &)
 Assignment operator(does copy memory).

void set (const ACE_WSTRING_TYPE *s)
 Copy <s>.

void set (const ACE_WSTRING_TYPE *s, size_t len)
 Copy <len> bytes of <s> (will NUL terminate the result).

void clear ()
 Clear this string.

ACE_WString substring (size_t offset, ssize_t length = -1) const
ACE_WString substr (size_t offset, ssize_t length = -1) const
 Same as substring.

ACE_WString& operator+= (const ACE_WString &)
 Concat operator(does copy memory).

ACE_WString& operator+= (const ACE_WSTRING_TYPE *)
 Concat operator(does copy memory).

u_long hash (void) const
 Returns a hash value for this string.

size_t length (void) const
 Return the length of the string.

size_t buffer_size (void) const
 Return the size of the buffer.

ACE_WSTRING_TYPErep (void) const
 Gets a copy of the underlying pointer.

char* char_rep (void) const
 Transform into a copy of the ASCII character representation. (caller must delete).

ACE_USHORT16ushort_rep (void) const
 Transform into a copy of a USHORT16 representation (caller must delete). Note, behavior is undefined when sizeof (wchar_t) != 2.

const ACE_WSTRING_TYPEfast_rep (void) const
 Get at the underlying representation directly!

const ACE_WSTRING_TYPEc_str (void) const
 Same as STL String's <c_str> and <fast_rep>.

int strstr (const ACE_WString &s) const
 Comparison operator that will match substrings. Returns the slot of the first location that matches, else -1.

int find (const ACE_WString &str, int pos = 0) const
 Find <str> starting at pos. Returns the slot of the first location that matches (will be >= pos), else npos.

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

int find (ACE_WSTRING_TYPE c, int pos = 0) const
 Find <c> starting at pos. Returns the slot of the first location that matches (will be >= pos), else npos.

int rfind (ACE_WSTRING_TYPE c, int pos = npos) const
 Find <c> starting at pos (counting from the end). Returns the slot of the first location that matches, else npos.

int operator== (const ACE_WString &s) const
 Equality comparison operator(must match entire string).

int operator< (const ACE_WString &s) const
 Less than comparison operator.

int operator> (const ACE_WString &s) const
 Greater than comparison operator.

int operator!= (const ACE_WString &s) const
 Inequality comparison operator.

int compare (const ACE_WString &s) const
 Performs a <strcmp>-style comparison.

void dump (void) const
 Dump the state of an object.

void resize (size_t len)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Static Public Methods

size_t strlen (const ACE_WSTRING_TYPE *)
 Computes the length of a "0" terminated ACE_WSTRING_TYPE *.

const ACE_WSTRING_TYPEstrstr (const ACE_WSTRING_TYPE *s1, const ACE_WSTRING_TYPE *s2)
 Traditional style strstr.


Static Public Attributes

const int npos
 No position constant.


Private Methods

void check_allocate (size_t len)

Private Attributes

ACE_Allocatorallocator_
 Pointer to a memory allocator.

size_t buf_len_
 Size of the buffer of the ACE_WString.

size_t len_
 Length of the ACE_WString.

ACE_WSTRING_TYPErep_
 Pointer to data.


Static Private Attributes

ACE_WSTRING_TYPE NULL_WString_
 Represents the "NULL" string to simplify the internal logic.


Detailed Description

This class provides a wrapper facade for C wide strings.

This class uses an to allocate memory. The user can make this a persistant class by providing an with a persistable memory pool. This class is optimized for efficiency, so it doesn't provide any internal locking.


Constructor & Destructor Documentation

ACE_WString::ACE_WString ( ACE_Allocator * alloc = 0 )
 

Default constructor.

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

Constructor that copies <s> into dynamically allocated memory.

ACE_WString::ACE_WString ( const ACE_WSTRING_TYPE * s,
ACE_Allocator * alloc = 0 )
 

Constructor that copies <s> into dynamically allocated memory.

ACE_WString::ACE_WString ( const ACE_USHORT16 * s,
size_t len,
ACE_Allocator * alloc = 0 )
 

Constructor that takes in a ushort16 string (mainly used by the ACE Name_Space classes).

ACE_WString::ACE_WString ( const ACE_WSTRING_TYPE * s,
size_t len,
ACE_Allocator * alloc = 0 )
 

Constructor that copies <len> ACE_WSTRING_TYPE's of <s> into dynamically allocated memory (will NUL terminate the result).

ACE_WString::ACE_WString ( size_t len,
ACE_Allocator * alloc = 0 )
 

Constructor that dynamically allocates memory for <len> + 1 ACE_WSTRING_TYPE characters. The newly created memory is set memset to 0.

ACE_WString::ACE_WString ( const ACE_WString & s )
 

Copy constructor.

ACE_WString::ACE_WString ( ACE_WSTRING_TYPE c,
ACE_Allocator * alloc = 0 )
 

Constructor that copies <c> into dynamically allocated memory.

ACE_WString::~ACE_WString ( void )
 

Deletes the memory...


Member Function Documentation

ACE_INLINE size_t ACE_WString::buffer_size ( void ) const
 

Return the size of the buffer.

ACE_INLINE const ACE_WSTRING_TYPE * ACE_WString::c_str ( void ) const
 

Same as STL String's <c_str> and <fast_rep>.

char * ACE_WString::char_rep ( void ) const
 

Transform into a copy of the ASCII character representation. (caller must delete).

void ACE_WString::check_allocate ( size_t len ) [private]
 

This method checks the size of the buffer. If the size of the buffer is not large enough the buffer will be resized. All new allocated space is zero'd out after this operation.

ACE_INLINE void ACE_WString::clear ( )
 

Clear this string.

ACE_INLINE int ACE_WString::compare ( const ACE_WString & s ) const
 

Performs a <strcmp>-style comparison.

void ACE_WString::dump ( void ) const
 

Dump the state of an object.

ACE_INLINE const ACE_WSTRING_TYPE * ACE_WString::fast_rep ( void ) const
 

Get at the underlying representation directly!

ACE_INLINE int ACE_WString::find ( ACE_WSTRING_TYPE c,
int pos = 0 ) const
 

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

ACE_INLINE int ACE_WString::find ( const ACE_WSTRING_TYPE * s,
int pos = 0 ) const
 

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

ACE_INLINE int ACE_WString::find ( const ACE_WString & str,
int pos = 0 ) const
 

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

ACE_INLINE u_long ACE_WString::hash ( void ) const
 

Returns a hash value for this string.

ACE_INLINE size_t ACE_WString::length ( void ) const
 

Return the length of the string.

ACE_INLINE int ACE_WString::operator!= ( const ACE_WString & s ) const
 

Inequality comparison operator.

ACE_WString & ACE_WString::operator+= ( const ACE_WSTRING_TYPE * s )
 

Concat operator(does copy memory).

ACE_WString & ACE_WString::operator+= ( const ACE_WString & s )
 

Concat operator(does copy memory).

ACE_INLINE int ACE_WString::operator< ( const ACE_WString & s ) const
 

Less than comparison operator.

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

Assignment operator(does copy memory).

ACE_INLINE int ACE_WString::operator== ( const ACE_WString & s ) const
 

Equality comparison operator(must match entire string).

ACE_INLINE int ACE_WString::operator> ( const ACE_WString & s ) const
 

Greater than comparison operator.

ACE_INLINE ACE_WSTRING_TYPE & ACE_WString::operator[] ( size_t slot )
 

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

ACE_INLINE ACE_WSTRING_TYPE ACE_WString::operator[] ( size_t slot ) const
 

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

ACE_INLINE ACE_WSTRING_TYPE * ACE_WString::rep ( void ) const
 

Gets a copy of the underlying pointer.

void ACE_WString::resize ( size_t len )
 

This method is designed for high-performance. Please use with care ;-) If the current size of the string is less than <len>, the string is resized to the new length. The data is zero'd out after this operation.

ACE_INLINE int ACE_WString::rfind ( ACE_WSTRING_TYPE c,
int pos = npos ) const
 

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

void ACE_WString::set ( const ACE_WSTRING_TYPE * s,
size_t len )
 

Copy <len> bytes of <s> (will NUL terminate the result).

void ACE_WString::set ( const ACE_WSTRING_TYPE * s )
 

Copy <s>.

size_t ACE_WString::strlen ( const ACE_WSTRING_TYPE * s ) [static]
 

Computes the length of a "0" terminated ACE_WSTRING_TYPE *.

const ACE_WSTRING_TYPE * ACE_WString::strstr ( const ACE_WSTRING_TYPE * s1,
const ACE_WSTRING_TYPE * s2 ) [static]
 

Traditional style strstr.

ACE_INLINE int ACE_WString::strstr ( const ACE_WString & s ) const
 

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

ACE_INLINE ACE_WString ACE_WString::substr ( size_t offset,
ssize_t length = -1 ) const
 

Same as substring.

ACE_WString ACE_WString::substring ( size_t offset,
ssize_t length = -1 ) const
 

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

ACE_USHORT16 * ACE_WString::ushort_rep ( void ) const
 

Transform into a copy of a USHORT16 representation (caller must delete). Note, behavior is undefined when sizeof (wchar_t) != 2.


Member Data Documentation

ACE_WString::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

ACE_WSTRING_TYPE ACE_WString::NULL_WString_ [static, private]
 

Represents the "NULL" string to simplify the internal logic.

ACE_Allocator * ACE_WString::allocator_ [private]
 

Pointer to a memory allocator.

size_t ACE_WString::buf_len_ [private]
 

Size of the buffer of the ACE_WString.

size_t ACE_WString::len_ [private]
 

Length of the ACE_WString.

const int ACE_WString::npos [static]
 

No position constant.

ACE_WSTRING_TYPE * ACE_WString::rep_ [private]
 

Pointer to data.


The documentation for this class was generated from the following files:
Generated at Sat Dec 1 11:06:59 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000