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

# ACE_SString Class Reference

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

`#include <SString.h>`

Collaboration diagram for ACE_SString:

[legend]
List of all members.

## Public Methods
| ACE_SString (ACE_Allocator *alloc = 0)
| Default constructor.
| ACE_SString (const char *s, ACE_Allocator *alloc = 0)
| Constructor that copies <s> into dynamically allocated memory.
| ACE_SString (const char *s, size_t len, ACE_Allocator *alloc = 0)
| Constructor that copies <len> chars of <s> into dynamically allocated memory (will NUL terminate the result).
| ACE_SString (const ACE_SString &)
| Copy constructor.
| ACE_SString (char c, ACE_Allocator *alloc = 0)
| Constructor that copies <c> into dynamically allocated memory.
| ~ACE_SString (void)
| Default dtor.
char | operator[] (size_t slot) const
| Return the <slot'th> character in the string (doesn't perform bounds checking).
char& | operator[] (size_t slot)
| Return the <slot'th> character by reference in the string (doesn't perform bounds checking).
ACE_SString& | operator= (const ACE_SString &)
| Assignment operator(does copy memory).
ACE_SString | substring (size_t offset, ssize_t length = -1) const
ACE_SString | substr (size_t offset, ssize_t length = -1) const
| Same as substring.
u_long | hash (void) const
| Returns a hash value for this string.
size_t | length (void) const
| Return the length of the string.
void | rep (char *s)
| Set the underlying pointer. Since this does not copy memory or delete existing memory use with extreme caution!!!
const char* | rep (void) const
| Get the underlying pointer.
const char* | fast_rep (void) const
| Get the underlying pointer.
const char* | c_str (void) const
| Same as STL String's <c_str> and <fast_rep>.
int | strstr (const ACE_SString &s) const
| Comparison operator that will match substrings. Returns the slot of the first location that matches, else -1.
int | find (const ACE_SString &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 char *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 (char 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 (char 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_SString &s) const
| Equality comparison operator(must match entire string).
int | operator< (const ACE_SString &s) const
| Less than comparison operator.
int | operator> (const ACE_SString &s) const
| Greater than comparison operator.
int | operator!= (const ACE_SString &s) const
| Inequality comparison operator.
int | compare (const ACE_SString &s) const
| Performs a <strcmp>-style comparison.
void | dump (void) const
| Dump the state of an object.
## Public Attributes
| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.
## Static Public Attributes
const int | npos
| No position constant.
## Private Attributes
ACE_Allocator* | allocator_
| Pointer to a memory allocator.
size_t | len_
| Length of the ACE_SString (not counting the trailing '\0').
char* | rep_
| Pointer to data.

## Detailed Description

A very Simple String class. This is not a general-purpose string class, and you should probably consider using 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 requires an object that supports the operator == and operator !=. This class uses an to allocate memory. The user can make this a persistant class by providing an with a persistable memory pool.

## 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_t 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_INLINE ACE_SString::~ACE_SString ( | void )

| Default dtor.

## Member Function Documentation

ACE_INLINE const char * ACE_SString::c_str ( | void ) const

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

ACE_INLINE int ACE_SString::compare ( | const ACE_SString & s ) const

| Performs a <strcmp>-style comparison.

void ACE_SString::dump ( | void ) const

| Dump the state of an object.

ACE_INLINE const char * ACE_SString::fast_rep ( | void ) const

| Get the underlying pointer.

ACE_INLINE int ACE_SString::find ( | char 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_SString::find ( | const char * 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_SString::find ( | const ACE_SString & 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_SString::hash ( | void ) const

| Returns a hash value for this string.

ACE_INLINE size_t ACE_SString::length ( | void ) const

| Return the length of the string.

ACE_INLINE int ACE_SString::operator!= ( | const ACE_SString & s ) const

| Inequality comparison operator.

ACE_INLINE int ACE_SString::operator< ( | const ACE_SString & s ) const

| Less than comparison operator.

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

| Assignment operator(does copy memory).

ACE_INLINE int ACE_SString::operator== ( | const ACE_SString & s ) const

| Equality comparison operator(must match entire string).

ACE_INLINE int ACE_SString::operator> ( | const ACE_SString & s ) const

| Greater than comparison operator.

ACE_INLINE char & ACE_SString::operator[] ( | size_t slot )

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

ACE_INLINE char ACE_SString::operator[] ( | size_t slot ) const

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

ACE_INLINE const char * ACE_SString::rep ( | void ) const

| Get the underlying pointer.

void ACE_SString::rep ( | char * s )

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

ACE_INLINE int ACE_SString::rfind ( | char 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.

ACE_INLINE int ACE_SString::strstr ( | const ACE_SString & s ) const

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

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

| Same as substring.

ACE_SString ACE_SString::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

## 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_t ACE_SString::len_`[private]`

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

const int ACE_SString::npos`[static]`

| No position constant.

char * ACE_SString::rep_`[private]`

| Pointer to data.

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

- SString.h
- SString.cpp
- SString.i