rwlogo
SourcePro 11.1

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWClassicWString Class Reference
[String Processing]

Alternate implementation of RWWString that does not depend on the C++ Standard Library. More...

#include <rw/tools/nostl/wstring.h>

List of all members.

Public Types

enum  stripType { leading, trailing, both }
enum  caseCompare { exact, ignoreCase, ignoreCaseStrict }
enum  scopeType { one, all }
enum  multiByte_ { multiByte }
enum  ascii_ { ascii }

Public Member Functions

 RWClassicWString ()
 RWClassicWString (RWSize_T ic)
 RWClassicWString (const RWClassicWString &str)
 RWClassicWString (const wchar_t *cs)
 RWClassicWString (const wchar_t *cs, size_t N)
 RWClassicWString (wchar_t cs)
 RWClassicWString (char c)
 RWClassicWString (const RWClassicWSubString &ss)
 RWClassicWString (const char *mbcs, multiByte_)
 RWClassicWString (const RWClassicCString &mbcs, multiByte_)
 RWClassicWString (const char *mbcs, size_t N, multiByte_)
 RWClassicWString (const char *acs, ascii_ asc)
 RWClassicWString (const RWClassicCString &acs, ascii_ asc)
 RWClassicWString (const char *cs, size_t N, ascii_ asc)
 operator const wchar_t * () const
RWClassicWStringoperator= (const wchar_t *wcs)
RWClassicWStringoperator= (const RWClassicWString &wcs)
RWClassicWStringoperator+= (const wchar_t *wcs)
RWClassicWStringoperator+= (const RWClassicWString &s)
wchar_t & operator[] (short i)
wchar_t & operator[] (int i)
wchar_t & operator[] (long i)
wchar_t & operator[] (unsigned short i)
wchar_t & operator[] (unsigned int i)
wchar_t & operator[] (unsigned long i)
wchar_t & operator[] (long long)
wchar_t & operator[] (unsigned long long)
wchar_t operator[] (int i) const
wchar_t operator[] (short i) const
wchar_t operator[] (long i) const
wchar_t operator[] (unsigned short i) const
wchar_t operator[] (unsigned int i) const
wchar_t operator[] (unsigned long i) const
wchar_t operator[] (long long) const
wchar_t operator[] (unsigned long long) const
wchar_t & operator() (size_t)
wchar_t operator() (size_t) const
RWClassicWSubString operator() (size_t start, size_t len)
RWClassicWSubString operator() (size_t start, size_t len) const
RWClassicWSubString subString (const wchar_t *cs, size_t start=0, caseCompare cmp=exact)
RWClassicWSubString subString (const wchar_t *cs, size_t start=0, caseCompare cmp=exact) const
RWClassicWStringappend (const wchar_t *cs)
RWClassicWStringappend (const wchar_t *cs, size_t N)
RWClassicWStringappend (const RWClassicWString &s)
RWClassicWStringappend (const RWClassicWString &s, size_t N)
RWClassicWStringappend (wchar_t c, size_t rep=1)
RWspace binaryStoreSize () const
size_t capacity () const
size_t capacity (size_t N)
int collate (const wchar_t *cs) const
int collate (const RWClassicWString &cs) const
int compareTo (const wchar_t *st, caseCompare cmp=exact) const
int compareTo (const RWClassicWString &st, caseCompare cmp=exact) const
int compareTo (const RWClassicWString *st, caseCompare cmp=exact) const
bool contains (const wchar_t *str, caseCompare cmp=exact) const
bool contains (const RWClassicWString &str, caseCompare cmp=exact) const
const wchar_t * data () const
size_t first (wchar_t c) const
size_t first (wchar_t c, size_t i) const
size_t first (const wchar_t *cs) const
size_t first (const wchar_t *cs, size_t N) const
unsigned hash (caseCompare cmp=exact) const
size_t index (const wchar_t *pat, size_t i=0, caseCompare cmp=exact) const
size_t index (const RWClassicWString &s, size_t i=0, caseCompare cmp=exact) const
size_t index (const wchar_t *pat, size_t patlen, size_t i, caseCompare cmp) const
size_t index (const RWClassicWString &pat, size_t patlen, size_t i, caseCompare cmp) const
RWClassicWStringinsert (size_t pos, const wchar_t *cs)
RWClassicWStringinsert (size_t pos, const wchar_t *cs, size_t N)
RWClassicWStringinsert (size_t pos, const RWClassicWString &str)
RWClassicWStringinsert (size_t pos, const RWClassicWString &str, size_t N)
bool isAscii () const
bool isNull () const
size_t last (wchar_t c) const
size_t length () const
RWClassicWStringprepend (const wchar_t *cs)
RWClassicWStringprepend (const wchar_t *cs, size_t N)
RWClassicWStringprepend (const RWClassicWString &str)
RWClassicWStringprepend (const RWClassicWString &cstr, size_t N)
RWClassicWStringprepend (wchar_t c, size_t rep=1)
std::istream & readFile (std::istream &s)
std::istream & readLine (std::istream &s, bool skipWhite=true)
std::istream & readString (std::istream &s)
std::istream & readToDelim (std::istream &s, wchar_t delim=(wchar_t)'\n')
std::istream & readToDelim (std::istream &is, wchar_t delim, bool skipWhite)
std::istream & readToken (std::istream &s)
std::wistream & readFile (std::wistream &s)
std::wistream & readLine (std::wistream &s, bool skipWhite=true)
std::wistream & readString (std::wistream &s)
std::wistream & readToDelim (std::wistream &s, wchar_t delim=(wchar_t)'\n')
std::wistream & readToDelim (std::wistream &s, wchar_t delim, bool skipWhite)
std::wistream & readToken (std::wistream &s)
RWClassicWStringremove (size_t pos)
RWClassicWStringremove (size_t pos, size_t N)
RWClassicWStringreplace (size_t pos, size_t N, const wchar_t *cs)
RWClassicWStringreplace (size_t pos, size_t N1, const wchar_t *cs, size_t N2)
RWClassicWStringreplace (size_t pos, size_t N, const RWClassicWString &str)
RWClassicWStringreplace (size_t pos, size_t N1, const RWClassicWString &, size_t N2)
void resize (size_t n)
RWClassicWSubString strip (stripType s=trailing, wchar_t c=(wchar_t)' ')
RWClassicWSubString strip (stripType s=trailing, wchar_t c=(wchar_t)' ') const
RWClassicCString toAscii () const
RWClassicCString toMultiByte () const
void toLower ()
void toUpper ()

Static Public Member Functions

static RWClassicWString fromAscii (const RWClassicCString &str)
static RWClassicWString fromMultiByte (const RWClassicCString &str)
static size_t initialCapacity (size_t capacity=15)
static size_t maxWaste (size_t maxwaste=15)
static size_t resizeIncrement (size_t increment=16)
static unsigned hash (const RWClassicWString &wstr)

Related Functions

(Note that these are not member functions.)



RWClassicWString operator+ (const RWClassicWString &s1, const RWClassicWString &s2)
RWClassicWString operator+ (const RWClassicWString &s, const wchar_t *cs)
RWClassicWString operator+ (const wchar_t *cs, const RWClassicWString &s)
bool operator== (const RWClassicWString &s1, const RWClassicWString &s2)
bool operator== (const RWClassicWString &s1, const wchar_t *s2)
std::istream & operator>> (std::istream &s, RWClassicWString &wcstr)
std::ostream & operator<< (std::ostream &s, const RWClassicWString &str)
RWFileoperator<< (RWFile &file, const RWClassicWString &wcstr)
RWvostreamoperator<< (RWvostream &s, const RWClassicWString &wcstr)
RWvistreamoperator>> (RWvistream &str, RWClassicWString &wcstr)
RWFileoperator>> (RWFile &file, RWClassicWString &wcstr)
RWClassicWString toLower (const RWClassicWString &str)
RWClassicWString toUpper (const RWClassicWString &str)
RWClassicWString strXForm (const RWClassicWString &)
bool operator== (const wchar_t *s1, const RWClassicWString &s2)
bool operator!= (const RWClassicWString &s1, const wchar_t *s2)
bool operator!= (const wchar_t *s1, const RWClassicWString &s2)
bool operator!= (const RWClassicWString &s1, const RWClassicWString &s2)
bool operator< (const RWClassicWString &s1, const RWClassicWString &s2)
bool operator> (const RWClassicWString &s1, const RWClassicWString &s2)
bool operator<= (const RWClassicWString &s1, const RWClassicWString &s2)
bool operator>= (const RWClassicWString &s1, const RWClassicWString &s2)
bool operator< (const RWClassicWString &s1, const wchar_t *s2)
bool operator> (const RWClassicWString &s1, const wchar_t *s2)
bool operator<= (const RWClassicWString &s1, const wchar_t *s2)
bool operator>= (const RWClassicWString &s1, const wchar_t *s2)
bool operator< (const wchar_t *s1, const RWClassicWString &s2)
bool operator> (const wchar_t *s1, const RWClassicWString &s2)
bool operator<= (const wchar_t *s1, const RWClassicWString &s2)
bool operator>= (const wchar_t *s1, const RWClassicWString &s2)

Detailed Description

RWClassicWString is an alternate implementation of RWWString, that does not depend on the C++ Standard Library. RWWString is a typedef for RWClassicWString if you define a non-standard library build.

Note:
Rogue Wave does not support non-standard library builds.

For more information on how to use this class, see the Description section of RWWString in this reference guide.

Synopsis

 #include <rw/tools/nostl/wstring.h>

Persistence

Simple

Examples

 #include <rw/rstream.h>
 #include <rw/wstring.h>

 main(){
  RWClassicWString a(L"There is no joy in Beantown");
  a.subString(L"Beantown") = L"Redmond";
  cout << a << endl;
  return 0;
 }

Program output:

There is no joy in Redmond.


Member Enumeration Documentation

Allows conversion from US-ASCII character strings to wide character strings. See constructor below.

Enumerator:
ascii 

Convert from US-ASCII.

Used to specify whether comparisons, searches, and hashing functions should use exact (case sensitive), ignoreCase (case-insensitive) or ignoreCaseStrict (case-insensitive for alpha characters only).

Enumerator:
exact 

Match comparisons exactly.

ignoreCase 

Case-insensitive comparisons.

ignoreCaseStrict 

Case-insenstive comparisons for alpha characters only.

Allows conversion from multibyte character strings to wide character strings. See constructor below.

Enumerator:
multiByte 

Convert from multibyte.

Used to specify whether to replace the first substring matched by the regular expression or all matched substrings.

Enumerator:
one 

Replace first substring matched.

all 

Replace all substrings matched.

Used to specify whether characters are stripped from the beginning of the string, the end, or both.

Enumerator:
leading 

Remove characters at beginning.

trailing 

Remove characters at end.

both 

Remove characters at both ends.


Constructor & Destructor Documentation

RWClassicWString::RWClassicWString (  ) 

Creates a string of length zero (the null string).

RWClassicWString::RWClassicWString ( RWSize_T  ic  ) 

Creates a string of length zero (the null string). The string's capacity (that is, the size it can grow to without resizing) is given by the parameter ic.

RWClassicWString::RWClassicWString ( const RWClassicWString str  ) 

Copy constructor. The created string copies str's data.

RWClassicWString::RWClassicWString ( const wchar_t *  cs  ) 

Creates a string from the wide character string cs. The created string copies the data pointed to by cs up to the first terminating null.

RWClassicWString::RWClassicWString ( const wchar_t *  cs,
size_t  N 
)

Constructs a string from the character string cs. The created string copies the data pointed to by cs. Exactly N characters are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at least N*sizeof(wchar_t) bytes or N wide characters long.

RWClassicWString::RWClassicWString ( wchar_t  cs  ) 

Constructs a string containing a single wide character.

RWClassicWString::RWClassicWString ( char  c  )  [inline]

Constructs a wide character string from the single character c.

RWClassicWString::RWClassicWString ( const RWClassicWSubString ss  ) 

Conversion from a substring. The created string copies the substring represented by ss.

RWClassicWString::RWClassicWString ( const char *  mbcs,
multiByte_   
) [inline]

Constructs a wide character string from the multibyte character string contained in mbcs. The conversion is done using the Standard C library function mbstowcs(). This constructor can be used as follows:

 RWClassicWString a("\306\374\315\313\306\374", multiByte);
RWClassicWString::RWClassicWString ( const RWClassicCString mbcs,
multiByte_   
)

Constructs a wide character string from the multibyte character string contained in mbcs. The conversion is done using the Standard C library function mbstowcs(). This constructor can be used as follows:

 RWClassicWString a("\306\374\315\313\306\374", multiByte);

RWClassicWString::RWClassicWString ( const char *  mbcs,
size_t  N,
multiByte_   
) [inline]

Constructs a wide character string from the multibyte character string contained in mbcs, converting exactly N characters, including any embedded nulls. Hence, the buffer pointed to by mbcs must be at least N bytes long. The conversion is done using the Standard C library function mbstowcs().

RWClassicWString::RWClassicWString ( const char *  acs,
ascii_  asc 
)

Constructs a wide character string from a US-ASCII character string. The conversion is done by simply stripping the high-order bit and, hence, is much faster than the other constructors for this class. For this conversion to be successful, you must be certain that the string contains only US-ASCII characters. This can be confirmed (if necessary) using isAscii().

This constructor can be used as follows:

 RWClassicWString a("A US-ASCII character string", ascii);
RWClassicWString::RWClassicWString ( const RWClassicCString acs,
ascii_  asc 
)

Constructs a wide character string from a US-ASCII character string. The conversion is done by simply stripping the high-order bit and, hence, is much faster than the other constructors for this class. For this conversion to be successful, you must be certain that the string contains only US-ASCII characters. This can be confirmed (if necessary) using isAscii().This constructor can be used as follows:

 RWClassicWString a("A US-ASCII character string", ascii);

RWClassicWString::RWClassicWString ( const char *  cs,
size_t  N,
ascii_  asc 
)

Constructs a wide character string from a US-ASCII character string, converting exactly N characters, including an embedded nulls. The conversion is done by simply stripping the high-order bit and, hence, is much faster than the other constructors for this class. For this conversion to be successful, you must be certain that the string contains only US-ASCII characters. This can be confirmed (if necessary) using isAscii().


Member Function Documentation

RWClassicWString& RWClassicWString::append ( wchar_t  c,
size_t  rep = 1 
)

Appends c rep times. The default is 1.

RWClassicWString & RWClassicWString::append ( const RWClassicWString s,
size_t  N 
) [inline]

Appends the first N characters or the length of s (whichever is less) to self. Returns a reference to self.

RWClassicWString & RWClassicWString::append ( const RWClassicWString s  )  [inline]

Appends a copy of the string s to self. Returns a reference to self.

RWClassicWString & RWClassicWString::append ( const wchar_t *  cs,
size_t  N 
) [inline]

Appends a copy of the wide character string cs to self. Exactly N wide characters are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at least N*sizeof(wchar_t) bytes long. Returns a reference to self.

RWClassicWString& RWClassicWString::append ( const wchar_t *  cs  ) 

Appends a copy of the null-terminated wide character string pointed to by cs to self. Returns a reference to self.

RWspace RWClassicWString::binaryStoreSize (  )  const [inline]

Returns the number of bytes necessary to store the object using the global function:

size_t RWClassicWString::capacity ( size_t  N  ) 

Hint to the implementation to change the capacity of self to N. Returns the actual capacity.

size_t RWClassicWString::capacity (  )  const [inline]

Returns the current capacity of self. This is the number of characters the string can hold without resizing.

int RWClassicWString::collate ( const RWClassicWString cs  )  const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the POSIX function wscoll() on self and the argument cs. This supports locale-dependent collation.

int RWClassicWString::collate ( const wchar_t *  cs  )  const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the POSIX function wscoll() on self and the argument cs. This supports locale-dependent collation.

int RWClassicWString::compareTo ( const RWClassicWString st,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C library function memcmp() on self and the argument st. Case sensitivity is according to the caseCompare argument, and may be RWClassicWString::exact or RWClassicWString::ignoreCase.

int RWClassicWString::compareTo ( const RWClassicWString st,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C library function memcmp() on self and the argument st. Case sensitivity is according to the caseCompare argument, and may be RWClassicWString::exact or RWClassicWString::ignoreCase.

int RWClassicWString::compareTo ( const wchar_t *  st,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C library function memcmp() on self and the argument st. Case sensitivity is according to the caseCompare argument, and may be RWClassicWString::exact or RWClassicWString::ignoreCase.

bool RWClassicWString::contains ( const RWClassicWString str,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Returns true if str occurs in self. Case sensitivity is according to the caseCompare argument, and may be RWClassicWString::exact or RWClassicWString::ignoreCase.

bool RWClassicWString::contains ( const wchar_t *  str,
caseCompare  cmp = exact 
) const

Pattern matching. Returns true if str occurs in self. Case sensitivity is according to the caseCompare argument, and may be RWClassicWString::exact or RWClassicWString::ignoreCase.

const wchar_t* RWClassicWString::data ( void   )  const [inline]

Access to the RWClassicWString instance's data as a null terminated string. This datum is owned by the RWClassicWString and may not be deleted or changed. If the RWClassicWString object itself changes or goes out of scope, the pointer value previously returned becomes invalid. While the string is null-terminated, note that its length is still given by the member function length(). That is, it may contain embedded nulls.

size_t RWClassicWString::first ( const wchar_t *  cs,
size_t  N 
) const [inline]

Returns the index of the first occurrence in self of any character in cs. Exactly N characters in self are checked, including any embedded nulls, so self must point to a buffer containing at least N wide characters. Returns RW_NPOS if there is no match.

size_t RWClassicWString::first ( const wchar_t *  cs  )  const [inline]

Returns the index of the first occurrence in self of any character in cs. Returns RW_NPOS if there is no match or if there is an embedded null prior to finding any character from cs.

size_t RWClassicWString::first ( wchar_t  c,
size_t  i 
) const [inline]

Starting with index i, returns the index of the first occurrence of the wide character c in self. Continues to search past embedded nulls. Returns RW_NPOS if there is no such character.

size_t RWClassicWString::first ( wchar_t  c  )  const [inline]

Returns the index of the first occurrence of the wide character c in self. Returns RW_NPOS if there is no such character or if there is an embedded null prior to finding c.

static RWClassicWString RWClassicWString::fromAscii ( const RWClassicCString str  )  [inline, static]

Convenience member function. Returns the result of the constructor RWClassicWString(const RWClassicCString&, ascii_) where ascii_ is ascii.

static RWClassicWString RWClassicWString::fromMultiByte ( const RWClassicCString str  )  [inline, static]

Convenience member function. Returns the result of the constructor RWClassicWString(const RWClassicCString&, multiByte_) where multiByte_ is multiByte.

static unsigned RWClassicWString::hash ( const RWClassicWString wstr  )  [static]

Returns the hash value of wstr as returned by hash(caseCompare) const where caseCompare is RWClassicWString::exact.

unsigned RWClassicWString::hash ( caseCompare  cmp = exact  )  const

Returns a suitable hash value.

size_t RWClassicWString::index ( const RWClassicWString pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting at index i, searches for the first occurrence of the first patlen characters from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument.

size_t RWClassicWString::index ( const wchar_t *  pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const

Pattern matching. Starting at index i, searches for the first occurrence of the first patlen characters from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument.

size_t RWClassicWString::index ( const RWClassicWString s,
size_t  i = 0,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument, which defaults to RWClassicWString::exact.

size_t RWClassicWString::index ( const wchar_t *  pat,
size_t  i = 0,
caseCompare  cmp = exact 
) const

Pattern matching. Starting with index i, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument, which defaults to RWClassicWString::exact.

static size_t RWClassicWString::initialCapacity ( size_t  capacity = 15  )  [static]

Sets the minimum initial capacity of an RWClassicWString, and returns the old value. The initial setting is 15 wide characters. Larger values will use more memory, but result in fewer resizes when concatenating or reading strings. Smaller values will waste less memory, but result in more resizes.

RWClassicWString & RWClassicWString::insert ( size_t  pos,
const RWClassicWString str,
size_t  N 
) [inline]

Inserts a copy of the first N wide characters or the length of str (whichever is less) into self at position pos. Returns a reference to self.

RWClassicWString & RWClassicWString::insert ( size_t  pos,
const RWClassicWString str 
) [inline]

Inserts a copy of the string str into self at position pos. Returns a reference to self.

RWClassicWString & RWClassicWString::insert ( size_t  pos,
const wchar_t *  cs,
size_t  N 
) [inline]

Inserts a copy of the first N wide characters of cs into self at position pos. Exactly N wide characters are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at least N*sizeof(wchar_t) bytes long. Returns a reference to self.

RWClassicWString& RWClassicWString::insert ( size_t  pos,
const wchar_t *  cs 
)

Inserts a copy of the null-terminated string cs into self at position pos. Returns a reference to self.

bool RWClassicWString::isAscii (  )  const

Returns true if it is safe to perform the conversion toAscii() (that is, if all characters of self are US-ASCII characters).

bool RWClassicWString::isNull ( void   )  const [inline]

Returns true if this string has zero length (i.e., if it is the null string).

size_t RWClassicWString::last ( wchar_t  c  )  const [inline]

Returns the index of the last occurrence in the string of the wide character c. Returns RW_NPOS if there is no such character.

size_t RWClassicWString::length (  )  const [inline]

Returns the number of characters in self.

static size_t RWClassicWString::maxWaste ( size_t  maxwaste = 15  )  [static]

Sets the maximum amount of unused space allowed in a wide string should it shrink, and returns the old value. The initial setting is 15 wide characters. If more than maxwaste characters are wasted, excess space is reclaimed.

RWClassicWString::operator const wchar_t * (  )  const [inline]

Access to the RWClassicWString instance's data as a null terminated wide string. This datum is owned by the RWClassicWString and may not be deleted or changed. If the RWClassicWString object itself changes or goes out of scope, the pointer value previously returned becomes invalid. While the string is null-terminated, note that its length is still given by the member function length(). That is, it may contain embedded nulls.

RWClassicWSubString RWClassicWString::operator() ( size_t  start,
size_t  len 
) const

Substring operator. Returns an RWClassicWSubString of self with length len, starting at index start. The sum of start plus len must be less than or equal to the string length. If the library was built using the RW_DEBUG flag, and start and len are out of range, throws an RWBoundsErr exception.

RWClassicWSubString RWClassicWString::operator() ( size_t  start,
size_t  len 
)

Substring operator. Returns an RWClassicWSubString of self with length len, starting at index start. The sum of start plus len must be less than or equal to the string length. If the library was built using the RW_DEBUG flag, and start and len are out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator() ( size_t  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the pre-processor macro RWBOUNDS_CHECK has been defined before including <rw/wstring.h>. In this case, if the index is out of range, throws an RWBoundsErr exception.

wchar_t & RWClassicWString::operator() ( size_t  i  )  [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the pre-processor macro RWBOUNDS_CHECK has been defined before including <rw/wstring.h>. In this case, if the index is out of range, throws an RWBoundsErr exception.

RWClassicWString & RWClassicWString::operator+= ( const RWClassicWString s  )  [inline]

Appends the string s to self. Returns a reference to self.

RWClassicWString& RWClassicWString::operator+= ( const wchar_t *  wcs  ) 

Appends a null-terminated character string. Returns a reference to self.

RWClassicWString& RWClassicWString::operator= ( const RWClassicWString wcs  ) 

Assignment operator. Returns a reference to self.

RWClassicWString& RWClassicWString::operator= ( const wchar_t *  wcs  ) 

Assignment operator. Copies a null-terminated character string into self. Returns a reference to self.

wchar_t RWClassicWString::operator[] ( unsigned long long  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( long long  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( unsigned long  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( unsigned int  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( unsigned short  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( long  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( short  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t RWClassicWString::operator[] ( int  i  )  const [inline]

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( unsigned long  long  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( long  long  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( unsigned long  i  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( unsigned int  i  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( unsigned short  i  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( long  i  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( int  i  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

wchar_t& RWClassicWString::operator[] ( short  i  ) 

Returns the i th character. The index i must be between 0 and the length of the string less one. Bounds checking is performed. If the index is out of range, throws an RWBoundsErr exception.

RWClassicWString& RWClassicWString::prepend ( wchar_t  c,
size_t  rep = 1 
)

Prepends the wide character c to self rep times. Returns a reference to self.

RWClassicWString & RWClassicWString::prepend ( const RWClassicWString cstr,
size_t  N 
) [inline]

Prepends the first N wide characters or the length of cstr (whichever is less) to self. Returns a reference to self.

RWClassicWString & RWClassicWString::prepend ( const RWClassicWString str  )  [inline]

Prepends a copy of the string str to self. Returns a reference to self.

RWClassicWString & RWClassicWString::prepend ( const wchar_t *  cs,
size_t  N 
) [inline]

Prepends a copy of the character string cs to self. Exactly N characters are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at least N*sizeof(wchar_t) bytes long. Returns a reference to self.

RWClassicWString& RWClassicWString::prepend ( const wchar_t *  cs  ) 

Prepends a copy of the null-terminated wide character string pointed to by cs to self. Returns a reference to self.

std::wistream& RWClassicWString::readFile ( std::wistream &  s  ) 

Reads characters from the input stream s, replacing the previous contents of self, until EOF is reached.

std::istream& RWClassicWString::readFile ( std::istream &  s  ) 

Reads characters from the input stream s, replacing the previous contents of self, until EOF is reached. The input stream is treated as a sequence of multibyte characters, each of which is converted to a wide character before storing, using the Standard C library function mbtowc(). Null characters are treated the same as other characters.

std::wistream& RWClassicWString::readLine ( std::wistream &  s,
bool  skipWhite = true 
)

Reads characters from the input stream s, replacing the previous contents of self, until a newline (or an EOF) is encountered. The newline is removed from the input stream, but is not stored. If the skipWhite argument is true, whitespace is skipped (using the iostream library manipulator ws) before saving characters.

std::istream& RWClassicWString::readLine ( std::istream &  s,
bool  skipWhite = true 
)

Reads characters from the input stream s, replacing the previous contents of self, until a newline (or an EOF) is encountered. The newline is removed from the input stream, but is not stored. The input stream is treated as a sequence of multibyte characters, each of which is converted to a wide character before storing, using the Standard C library function mbtowc(). Null characters are treated the same as other characters. If the skipWhite argument is true, whitespace is skipped (using the iostream library manipulator ws) before saving characters.

std::wistream& RWClassicWString::readString ( std::wistream &  s  ) 

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or null terminator is encountered.

std::istream& RWClassicWString::readString ( std::istream &  s  ) 

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or null terminator is encountered. The input stream is treated as a sequence of multibyte characters, each of which is converted to a wide character before storing, using the Standard C library function mbtowc().

std::wistream& RWClassicWString::readToDelim ( std::wistream &  s,
wchar_t  delim,
bool  skipWhite 
)

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or the delimiting character delim is encountered. The delimiter is removed from the input stream but is not stored. If the skipWhite argument is true, whitespace is skipped (using the iostream library manipulator ws) before saving characters.

std::wistream& RWClassicWString::readToDelim ( std::wistream &  s,
wchar_t  delim = (wchar_t)'\n' 
)

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or the delimiting character delim is encountered. The delimiter is removed from the input stream but is not stored.

std::istream& RWClassicWString::readToDelim ( std::istream &  is,
wchar_t  delim,
bool  skipWhite 
)

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or the delimiting character delim is encountered. The delimiter is removed from the input stream but is not stored. The input stream is treated as a sequence of multibyte characters, each of which is converted to a wide character before storing, using the Standard C library function mbtowc(). Null characters are treated the same as other characters. If the skipWhite argument is true, whitespace is skipped (using the iostream library manipulator ws) before saving characters.

std::istream& RWClassicWString::readToDelim ( std::istream &  s,
wchar_t  delim = (wchar_t)'\n' 
)

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or the delimiting character delim is encountered. The delimiter is removed from the input stream but is not stored. The input stream is treated as a sequence of multibyte characters, each of which is converted to a wide character before storing, using the Standard C library function mbtowc(). Null characters are treated the same as other characters.

std::wistream& RWClassicWString::readToken ( std::wistream &  s  ) 

Reads characters from the input stream s, skipping whitespace and replacing the previous contents of self, until trailing whitespace or an EOF is encountered. The trailing whitespace is left on the input stream. Only US-ASCII whitespace characters are recognized, as defined by the Standard C Library function isspace().

std::istream& RWClassicWString::readToken ( std::istream &  s  ) 

Reads characters from the input stream s, skipping whitespace, replacing the previous contents of self, until trailing whitespace or an EOF is encountered. The trailing whitespace is left on the input stream. Only US-ASCII whitespace characters are recognized, as defined by the standard C library function isspace(). The input stream is treated as a sequence of multibyte characters, each of which is converted to a wide character before storing, using the Standard C library function mbtowc().

RWClassicWString & RWClassicWString::remove ( size_t  pos,
size_t  N 
) [inline]

Removes N wide characters or to the end of string (whichever comes first) starting at the position pos, which must be no greater than length(). Returns a reference to self.

RWClassicWString & RWClassicWString::remove ( size_t  pos  )  [inline]

Removes the characters from the position pos, which must be no greater than length(), to the end of string. Returns a reference to self.

RWClassicWString & RWClassicWString::replace ( size_t  pos,
size_t  N1,
const RWClassicWString wcstr,
size_t  N2 
) [inline]

Replaces N1 characters or to the end of string (whichever comes first) starting at position pos, which must be no greater than length(), with a copy of the first N2 characters, or the length of str (whichever is less), from str. Returns a reference to self.

RWClassicWString & RWClassicWString::replace ( size_t  pos,
size_t  N,
const RWClassicWString str 
) [inline]

Replaces N characters or to the end of string (whichever comes first) starting at position pos, which must be no greater than length(), with a copy of the string str. Returns a reference to self.

RWClassicWString& RWClassicWString::replace ( size_t  pos,
size_t  N1,
const wchar_t *  cs,
size_t  N2 
)

Replaces N1 characters or to the end of string (whichever comes first) starting at position pos, which must be no greater than length(), with a copy of the string cs. Exactly N2 characters are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at least N2*sizeof(wchar_t) bytes long. Returns a reference to self.

RWClassicWString& RWClassicWString::replace ( size_t  pos,
size_t  N,
const wchar_t *  cs 
)

Replaces N wide characters or to the end of string (whichever comes first) starting at position pos, which must be no greater than length(), with a copy of the null-terminated string cs. Returns a reference to self.

void RWClassicWString::resize ( size_t  n  ) 

Changes the length of self to size n, adding blanks (i.e., L' ') or truncating as necessary.

static size_t RWClassicWString::resizeIncrement ( size_t  increment = 16  )  [static]

Sets the resize increment when more memory is needed to grow a wide string. Returns the old value. The initial setting is 16 wide characters.

RWClassicWSubString RWClassicWString::strip ( stripType  s = trailing,
wchar_t  c = (wchar_t)' ' 
) const

Returns a substring of self where the character c has been stripped off the beginning, end, or both ends of the string.

RWClassicWSubString RWClassicWString::strip ( stripType  s = trailing,
wchar_t  c = (wchar_t)' ' 
)

Returns a substring of self where the character c has been stripped off the beginning, end, or both ends of the string.

RWClassicWSubString RWClassicWString::subString ( const wchar_t *  cs,
size_t  start = 0,
caseCompare  cmp = exact 
) const

Returns a substring representing the first occurrence of the null-terminated string pointed to by cs. Case sensitivity is according to the caseCompare argument, defaulting to RWClassicWString::exact.

RWClassicWSubString RWClassicWString::subString ( const wchar_t *  cs,
size_t  start = 0,
caseCompare  cmp = exact 
)

Returns a substring representing the first occurrence of the null-terminated string pointed to by cs. Case sensitivity is according to the caseCompare argument, defaulting to RWClassicWString::exact.

RWClassicCString RWClassicWString::toAscii (  )  const

Returns an RWClassicCString object of the same length as self, containing only US-ASCII characters. Any non-US-ASCII characters in self simply have the high bits stripped off. Use isAscii() to determine whether this function is safe to use.

void RWClassicWString::toLower (  ) 

Changes all upper-case letters in self to lower-case. Uses the Standard C library function towlower().

RWClassicCString RWClassicWString::toMultiByte (  )  const

Returns an RWClassicCString containing the result of applying the Standard C Library function wcstombs() to self. This function is always safe to use.

void RWClassicWString::toUpper (  ) 

Changes all lower-case letters in self to upper-case. Uses the Standard C library function towupper().


Friends And Related Function Documentation

bool operator!= ( const RWClassicWString s1,
const RWClassicWString s2 
) [related]

Logical inequality. Case sensitivity is exact.

bool operator!= ( const wchar_t *  s1,
const RWClassicWString s2 
) [related]

Logical inequality. Case sensitivity is exact.

bool operator!= ( const RWClassicWString s1,
const wchar_t *  s2 
) [related]

Logical inequality. Case sensitivity is exact.

RWClassicWString operator+ ( const wchar_t *  cs,
const RWClassicWString s 
) [friend]

Concatenation operators.

RWClassicWString operator+ ( const RWClassicWString s,
const wchar_t *  cs 
) [friend]

Concatenation operators.

RWClassicWString operator+ ( const RWClassicWString s1,
const RWClassicWString s2 
) [friend]

Concatenation operators.

bool operator< ( const wchar_t *  s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator< ( const RWClassicWString s1,
const wchar_t *  s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator< ( const RWClassicWString s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

RWvostream & operator<< ( RWvostream s,
const RWClassicWString wcstr 
) [related]

Saves string wcstr to a virtual stream.

RWFile & operator<< ( RWFile file,
const RWClassicWString wcstr 
) [related]

Saves string wcstr to an RWFile.

std::ostream & operator<< ( std::ostream &  s,
const RWClassicWString str 
) [related]

Writes out an RWClassicWString on the ostream s. Each character of str is first converted to a multibyte character before being shifted out to s.

bool operator<= ( const wchar_t *  s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator<= ( const RWClassicWString s1,
const wchar_t *  s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator<= ( const RWClassicWString s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator== ( const wchar_t *  s1,
const RWClassicWString s2 
) [related]

Logical equality. Case sensitivity is exact.

bool operator== ( const RWClassicWString s1,
const wchar_t *  s2 
) [friend]

Logical equality. Case sensitivity is exact.

bool operator== ( const RWClassicWString s1,
const RWClassicWString s2 
) [friend]

Logical equality and inequality. Case sensitivity is exact.

bool operator> ( const wchar_t *  s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator> ( const RWClassicWString s1,
const wchar_t *  s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator> ( const RWClassicWString s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator>= ( const wchar_t *  s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator>= ( const RWClassicWString s1,
const wchar_t *  s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

bool operator>= ( const RWClassicWString s1,
const RWClassicWString s2 
) [related]

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member function collate() or strXForm() for locale sensitivity.

RWFile & operator>> ( RWFile file,
RWClassicWString wcstr 
) [related]

Restores a wide character string into wcstr from an RWFile, replacing the previous contents of file.

RWvistream & operator>> ( RWvistream str,
RWClassicWString wcstr 
) [related]

Restores a wide character string into wcstr from a virtual stream, replacing the previous contents of str.

std::istream & operator>> ( std::istream &  s,
RWClassicWString wcstr 
) [related]

Calls RWClassicWString::readToken(std::istream&). That is, a token is read from the input stream s.

RWClassicWString strXForm ( const RWClassicWString  )  [related]

Returns a string transformed by wsxfrm(), to allow quicker collation than RWClassicWString::collate().

RWClassicWString toLower ( const RWClassicWString str  )  [related]

Returns a version of str where all upper-case characters have been replaced with lower-case characters. Uses the Standard C library function towlower().

RWClassicWString toUpper ( const RWClassicWString str  )  [related]

Returns a version of str where all lower-case characters have been replaced with upper-case characters. Uses the Standard C library function towupper().


© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.