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...
#include <ace/SString.h>
class ACE_SString {
public:
static const int npos;
ACE_SString (ACE_Allocator *alloc = 0);
ACE_SString (const char *s, ACE_Allocator *alloc = 0);
ACE_SString (const char *s, size_t len, ACE_Allocator *alloc = 0);
ACE_SString (const ACE_SString &);
ACE_SString (char c, ACE_Allocator *alloc = 0);
~ACE_SString (void);
char operator [] (size_t slot) const;
char &operator [] (size_t slot);
ACE_SString &operator = (const ACE_SString &);
ACE_SString substring (size_t offset, ssize_t length = -1) const;
ACE_SString substr (size_t offset, ssize_t length = -1) const;
u_long hash (void) const;
size_t length (void) const;
void rep (char *s);
const char *rep (void) const;
const char *fast_rep (void) const;
const char *c_str (void) const;
int strstr (const ACE_SString &s) const;
int find (const ACE_SString &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_SString &s) const;
int operator < (const ACE_SString &s) const;
int operator > (const ACE_SString &s) const;
int operator != (const ACE_SString &s) const;
int compare (const ACE_SString &s) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
ACE_Allocator *allocator_;
size_t len_;
char *rep_;
};
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.
static const int npos;
ACE_SString (ACE_Allocator *alloc = 0);
ACE_SString (const char *s, ACE_Allocator *alloc = 0);
s
into dynamically allocated memory.
ACE_SString (const char *s, size_t len, ACE_Allocator *alloc = 0);
len
chars of s
into dynamically
allocated memory (will NUL terminate the result).
ACE_SString (const ACE_SString &);
ACE_SString (char c, ACE_Allocator *alloc = 0);
c
into dynamically allocated memory.
~ACE_SString (void);
char operator [] (size_t slot) const;
slot'th
character in the string (doesn't perform
bounds checking).
char &operator [] (size_t slot);
slot'th
character by reference in the string
(doesn't perform bounds checking).
ACE_SString &operator = (const ACE_SString &);
ACE_SString substring (size_t offset, ssize_t length = -1) const;
ACE_SString substr (size_t offset, ssize_t length = -1) const;
u_long hash (void) const;
size_t length (void) const;
void rep (char *s);
const char *rep (void) const;
const char *fast_rep (void) const;
const char *c_str (void) const;
c_str
and fast_rep
.
int strstr (const ACE_SString &s) const;
int find (const ACE_SString &str, int pos = 0) const;
str
starting at pos. Returns the slot of the first
location that matches, else npos.
int find (const char *s, int pos = 0) const;
s
starting at pos. Returns the slot of the first
location that matches, else npos.
int find (char c, int pos = 0) const;
c
starting at pos. Returns the slot of the first
location that matches, else npos.
int rfind (char c, int pos = npos) const;
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;
int operator < (const ACE_SString &s) const;
int operator > (const ACE_SString &s) const;
int operator != (const ACE_SString &s) const;
int compare (const ACE_SString &s) const;
strcmp
-style comparison.
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
ACE_Allocator *allocator_;
size_t len_;
char *rep_;