NAME
ACE_WString -
A persistent wide string class.
SYNOPSIS
#include <ace/SString.h>
class ACE_WString
{
public:
ACE_WString (ACE_Allocator *allocator = 0);
ACE_WString (const char *s, ACE_Allocator *allocator = 0);
ACE_WString (const ACE_USHORT16 *s, ACE_Allocator *allocator = 0);
ACE_WString (
const ACE_USHORT16 *s,
size_t len,
ACE_Allocator *allocator = 0
);
ACE_WString (const ACE_WString &s);
~ACE_WString (void);
ACE_USHORT16 operator[] (size_t index) const;
void operator= (const ACE_WString &);
void operator += (const ACE_WString &);
size_t length (void) const;
ACE_USHORT16 *rep (void) const;
char *char_rep (void) const;
ACE_USHORT16 *fast_rep (void) const;
int strstr (const ACE_WString &s) const;
int operator== (const ACE_WString &s) const;
int operator!= (const ACE_WString &s) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
ACE_Allocator *allocator_;
size_t wstrlen (const ACE_USHORT16 *);
size_t len_;
ACE_USHORT16 *rep_;
};
DESCRIPTION
This is *not* a general-purpose string class. It is only
intended for use with applications that understand how it
works. Note that we need to use this class since the ACE
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
PUBLIC MEMBERS
ACE_WString (ACE_Allocator *allocator = 0);
ACE_WString (const char *s, ACE_Allocator *allocator = 0);
Constructor that copies s into dynamically allocated memory.
ACE_WString (const ACE_USHORT16 *s, ACE_Allocator *allocator = 0);
Constructor that copies s into dynamically allocated memory.
ACE_WString (
const ACE_USHORT16 *s,
size_t len,
ACE_Allocator *allocator = 0
);
Constructor that copies len ACE_USHORT16's of s into dynamically
allocated memory (will NUL terminate the result).
ACE_WString (const ACE_WString &s);
~ACE_WString (void);
ACE_USHORT16 operator[] (size_t index) const;
Return the index'th character in the string (doesn't perform
bounds checking).
void operator= (const ACE_WString &);
Assignment operator (does copy memory).
void operator += (const ACE_WString &);
Concat operator (does copy memory).
size_t length (void) const;
Return the length of the string.
ACE_USHORT16 *rep (void) const;
Gets a copy of the underlying pointer.
char *char_rep (void) const;
Transform into a copy of the ASCII character representation.
ACE_USHORT16 *fast_rep (void) const;
Get at the underlying representation directly!
int strstr (const ACE_WString &s) const;
Comparison operator that will match substrings. Returns the
index of the first location that matches, else -1.
int operator== (const ACE_WString &s) const;
Comparison operator (must match entire string).
int operator!= (const ACE_WString &s) const;
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
PRIVATE MEMBERS
ACE_Allocator *allocator_;
Pointer to a memory allocator.
size_t wstrlen (const ACE_USHORT16 *);
Computes the length of a "0" terminated ACE_USHORT16 *.
size_t len_;
Length of the ACE_WString.
ACE_USHORT16 *rep_;
AUTHOR
Douglas C. Schmidt (schmidt@cs.wustl.edu)
LIBRARY
ace