#include <ace/SString.h>
class ACE_WString {
public:
static const int npos;
ACE_WString (ACE_Allocator *alloc = 0);
ACE_WString (const char *s, ACE_Allocator *alloc = 0);
ACE_WString (const ACE_USHORT16 *s, ACE_Allocator *alloc = 0);
ACE_WString ( const ACE_USHORT16 *s, size_t len, ACE_Allocator *alloc = 0 );
ACE_WString (size_t len, ACE_Allocator *alloc = 0);
ACE_WString (const ACE_WString &s);
ACE_WString (ACE_USHORT16 c, ACE_Allocator *alloc = 0);
~ACE_WString (void);
ACE_USHORT16 operator [] (size_t slot) const;
ACE_USHORT16 &operator [] (size_t slot);
ACE_WString &operator = (const ACE_WString &);
void set (const ACE_USHORT16 *s);
void set (const ACE_USHORT16 *s, size_t len);
ACE_WString substring (size_t offset, ssize_t length = -1) const;
ACE_WString substr (size_t offset, ssize_t length = -1) const;
ACE_WString &operator += (const ACE_WString &);
u_long hash (void) const;
size_t length (void) const;
ACE_USHORT16 *rep (void) const;
char *char_rep (void) const;
const ACE_USHORT16 *fast_rep (void) const;
const ACE_USHORT16 *c_str (void) const;
int strstr (const ACE_WString &s) const;
int find (const ACE_WString &str, int pos = 0) const;
int find (const ACE_USHORT16 *s, int pos = 0) const;
int find (ACE_USHORT16 c, int pos = 0) const;
int rfind (ACE_USHORT16 c, int pos = npos) const;
int operator == (const ACE_WString &s) const;
int operator < (const ACE_WString &s) const;
int operator > (const ACE_WString &s) const;
int operator != (const ACE_WString &s) const;
int compare (const ACE_WString &s) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
static size_t strlen (const ACE_USHORT16 *);
static const ACE_USHORT16 *strstr ( const ACE_USHORT16 *s1, const ACE_USHORT16 *s2 );
void resize (size_t len);
private:
ACE_Allocator *allocator_;
size_t len_;
ACE_USHORT16 *rep_;
};
ACE_Allocator
to allocate memory. The
user can make this a persistant class by providing an
ACE_Allocator
with a persistable memory pool. This class is
optimized for efficiency, so it doesn't provide any internal
locking.
static const int npos;
ACE_WString (ACE_Allocator *alloc = 0);
ACE_WString (const char *s, ACE_Allocator *alloc = 0);
s
into dynamically allocated memory.
ACE_WString (const ACE_USHORT16 *s, ACE_Allocator *alloc = 0);
s
into dynamically allocated memory.
ACE_WString (
const ACE_USHORT16 *s,
size_t len,
ACE_Allocator *alloc = 0
);
len
ACE_USHORT16's of s
into dynamically
allocated memory (will NUL terminate the result).
ACE_WString (size_t len, ACE_Allocator *alloc = 0);
len
+ 1
ACE_USHORT16 characters. The newly created memory is set memset to 0.
ACE_WString (const ACE_WString &s);
ACE_WString (ACE_USHORT16 c, ACE_Allocator *alloc = 0);
c
into dynamically allocated memory.
~ACE_WString (void);
ACE_USHORT16 operator [] (size_t slot) const;
slot'th
character in the string (doesn't perform
bounds checking).
ACE_USHORT16 &operator [] (size_t slot);
slot'th
character by reference in the string
(doesn't perform bounds checking).
ACE_WString &operator = (const ACE_WString &);
void set (const ACE_USHORT16 *s);
s
void set (const ACE_USHORT16 *s, size_t len);
len
bytes of s
(will NUL terminate the result)
ACE_WString substring (size_t offset, ssize_t length = -1) const;
ACE_WString substr (size_t offset, ssize_t length = -1) const;
ACE_WString &operator += (const ACE_WString &);
u_long hash (void) const;
size_t length (void) const;
ACE_USHORT16 *rep (void) const;
char *char_rep (void) const;
const ACE_USHORT16 *fast_rep (void) const;
const ACE_USHORT16 *c_str (void) const;
c_str
and fast_rep
.
int strstr (const ACE_WString &s) const;
int find (const ACE_WString &str, int pos = 0) const;
str
starting at pos. Returns the slot of the first
location that matches, else npos.
int find (const ACE_USHORT16 *s, int pos = 0) const;
s
starting at pos. Returns the slot of the first
location that matches, else npos.
int find (ACE_USHORT16 c, int pos = 0) const;
c
starting at pos. Returns the slot of the first
location that matches, else npos.
int rfind (ACE_USHORT16 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_WString &s) const;
int operator < (const ACE_WString &s) const;
int operator > (const ACE_WString &s) const;
int operator != (const ACE_WString &s) const;
int compare (const ACE_WString &s) const;
strcmp
-style comparison.
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
static size_t strlen (const ACE_USHORT16 *);
static const ACE_USHORT16 *strstr (
const ACE_USHORT16 *s1,
const ACE_USHORT16 *s2
);
void resize (size_t len);
len
,
the string is resized to the new length. The data is is zero'd
out after this operation.
ACE_Allocator *allocator_;
size_t len_;
ACE_USHORT16 *rep_;