wstring Class Reference
[WString]

#include <wstring.h>


Public Member Functions

 ~wstring ()
 wstring ()
 wstring (const char *arg)
 wstring (const wchar_t *arg)
 wstring (const char *data, size_t len)
 wstring (const wchar_t *data, size_t len)
 wstring (wstring_ty *arg)
 wstring (string_ty *arg)
 wstring (const nstring &arg)
 wstring (const wstring &arg)
wstringoperator= (const wstring &arg)
void clear ()
const wchar_t * c_str () const
nstring to_nstring () const
bool empty () const
size_t size () const
size_t length () const
wstring catenate (const wstring &arg) const
 join two strings together
wstring operator+ (const wstring &arg) const
wstringoperator+= (const wstring &arg)
wstring cat_three (const wstring &str2, const wstring &str3) const
 joing strings together
wstring upcase () const
 convert to upper case
wstring downcase () const
 convert to lower case
wstring capitalize () const
 convert to title case
bool equal (const wstring &arg) const
 test string equality
bool operator== (const wstring &arg) const
bool operator!= (const wstring &arg) const
wstring_tyget_ref () const
wstring identifier () const
char operator[] (size_t n) const
int column_width () const

Static Private Member Functions

static wstring_tyget_empty_ref ()

Private Attributes

wstring_tyref


Detailed Description

The wstring class is used to represent a reference counted wide string with fast equality comparison.

This is a wide string class, using wchar_t as the internal character type. For ordinary narrow strings, which use char as the internal character type, see the nstring class.

Definition at line 41 of file wstring.h.


Constructor & Destructor Documentation

wstring::~wstring (  ) 

The destructor.

This destructor is not virtual, do not derive from this class.

wstring::wstring (  )  [inline]

The default constructor.

Definition at line 54 of file wstring.h.

wstring::wstring ( const char *  arg  )  [inline, explicit]

The constructor.

Definition at line 63 of file wstring.h.

wstring::wstring ( const wchar_t *  arg  )  [inline, explicit]

The constructor.

Definition at line 72 of file wstring.h.

wstring::wstring ( const char *  data,
size_t  len 
) [inline]

The constructor.

Definition at line 80 of file wstring.h.

wstring::wstring ( const wchar_t *  data,
size_t  len 
) [inline]

The constructor.

Definition at line 88 of file wstring.h.

wstring::wstring ( wstring_ty arg  )  [inline]

The constructor.

Definition at line 96 of file wstring.h.

wstring::wstring ( string_ty arg  ) 

The constructor.

This will be DEPRECATED as soon as possible.

wstring::wstring ( const nstring arg  ) 

The constructor.

wstring::wstring ( const wstring arg  )  [inline]

The copy constructor.

Definition at line 116 of file wstring.h.


Member Function Documentation

wstring& wstring::operator= ( const wstring arg  )  [inline]

The assignment operator.

Definition at line 125 of file wstring.h.

void wstring::clear (  ) 

The clear method may be used to discard the contents of the string, and replace it with the empty string.

const wchar_t* wstring::c_str (  )  const [inline]

The c_str method is used to obtain a pointer to the underlying C string (guaranteed to the NUL terminated).

Definition at line 146 of file wstring.h.

nstring wstring::to_nstring (  )  const

The to_nstring method is used to convert a wide string to a narrow string.

bool wstring::empty (  )  const [inline]

Definition at line 159 of file wstring.h.

size_t wstring::size (  )  const [inline]

Definition at line 166 of file wstring.h.

size_t wstring::length (  )  const [inline]

Definition at line 173 of file wstring.h.

wstring wstring::catenate ( const wstring arg  )  const [inline]

join two strings together

The wstr_catenate function is used to join two strings togther to form a new string. The are joined in the order given.

Parameters:
arg A string to be joined. Will not be modified.
Returns:
a pointer to a string in dynamic memory. Use wstr_free() when finished with. The contents of the structure pointed to shall not be altered.

Definition at line 195 of file wstring.h.

wstring wstring::operator+ ( const wstring arg  )  const [inline]

Definition at line 202 of file wstring.h.

wstring& wstring::operator+= ( const wstring arg  )  [inline]

Definition at line 209 of file wstring.h.

wstring wstring::cat_three ( const wstring str2,
const wstring str3 
) const [inline]

joing strings together

The wstr_cat_three function is used to join three strings together to form a new string. The are joined in the order given.

Parameters:
str2 A string to be joined. Will not be modified.
str3 A string to be joined. Will not be modified.
Returns:
a pointer to a string in dynamic memory. Use wstr_free() when finished with. The contents of the structure pointed to shall not be altered.

Definition at line 238 of file wstring.h.

wstring wstring::upcase (  )  const [inline]

convert to upper case

The wstr_upcase function is used to create a new string where the lower case characters in the input string are converted to upper case.

Returns:
a pointer to a string in dynamic memory. Use wstr_free() when finished with. The contents of the structure pointed to shall not be altered.

Definition at line 258 of file wstring.h.

wstring wstring::downcase (  )  const [inline]

convert to lower case

The wstr_downcase function is used to create a new string where the upper case characters in the input string are converted to lower case.

Returns:
a pointer to a string in dynamic memory. Use wstr_free() when finished with. The contents of the structure pointed to shall not be altered.

Definition at line 278 of file wstring.h.

wstring wstring::capitalize (  )  const [inline]

convert to title case

The wstr_capitalize function is used to create a new string where the first letter or each word of the inopuyt string are upper case, and the remaining letters in each word are lower case. (Sometimes called Title Case.)

Returns:
a pointer to a string in dynamic memory.

Definition at line 297 of file wstring.h.

bool wstring::equal ( const wstring arg  )  const [inline]

test string equality

The wstr_equal function is used to test to see if two strings are exactly the same.

Parameters:
arg A string to be compared. Will not be modified.
Note:
Users shall always write code as if they did not know that a string equality test is a pointer equality test.
Returns:
Non-zero if the strings are equal, zero if the strings are unequal.

Definition at line 322 of file wstring.h.

bool wstring::operator== ( const wstring arg  )  const [inline]

Definition at line 329 of file wstring.h.

bool wstring::operator!= ( const wstring arg  )  const [inline]

Definition at line 336 of file wstring.h.

wstring_ty* wstring::get_ref (  )  const [inline]

The get_ref method is used to extract the reference to the underlying reference counted string object. If the ref pointer is NULL a pointer to a common empty string object is returned.

Once the sources cease using wstring_ty directly, this method will become private.

Definition at line 351 of file wstring.h.

wstring wstring::identifier (  )  const [inline]

The identifier method is used to convert all non-C-identifier characters in the string to underscores. The intention is to create a valid C identifier from the string.

Definition at line 363 of file wstring.h.

char wstring::operator[] ( size_t  n  )  const [inline]

The indexing operator is used to extract the nth character of a string. Indexes out of range will result in the NUL character ('') being returned.

Parameters:
n The character to extract. Zero based.
Returns:
The character requested, or NUL ('') if the index is out of range.

Definition at line 381 of file wstring.h.

int wstring::column_width (  )  const [inline]

The column_width method is used to determine how many printing columns wde this character is. Most characters are one printing column wide, byt Kanji characters (for example0 can be two columns wide.

Definition at line 394 of file wstring.h.

static wstring_ty* wstring::get_empty_ref (  )  [inline, static, private]

The get_empty_ref() class method is used to get a pointer to an underlying string object of length zero.

Definition at line 413 of file wstring.h.


Field Documentation

The ref instance variable is used to remember the location of the object common to all of the references. The is never the NULL pointer.

Definition at line 406 of file wstring.h.


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

Generated on Wed Mar 12 23:37:45 2008 for Aegis by  doxygen 1.5.5