SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Related Functions

Offers powerful and convenient facilities for manipulating wide character strings. More...

#include <rw/wstring.h>

Inheritance diagram for RWWString:
RWCollectableWString

Public Types

enum  ascii_ { ascii }
 
enum  caseCompare { exact, ignoreCase, ignoreCaseStrict }
 
typedef RWWConstSubString ConstSubString
 
enum  multiByte_ { multiByte }
 
enum  stripType { leading, trailing, both }
 
typedef RWWSubString SubString
 

Public Member Functions

 RWWString ()
 
 RWWString (const std::wstring &str)
 
 RWWString (const RWWString &str)
 
 RWWString (RWWString &&str)
 
 RWWString (RWSize_T cap)
 
 RWWString (wchar_t c)
 
 RWWString (wchar_t c, size_t count)
 
 RWWString (const wchar_t *str)
 
 RWWString (const wchar_t *str, size_t len)
 
 RWWString (char c)
 
 RWWString (char c, size_t count)
 
 RWWString (signed char c)
 
 RWWString (unsigned char c)
 
 RWWString (const char *str, ascii_)
 
 RWWString (const RWCString &str, ascii_)
 
 RWWString (const char *str, multiByte_)
 
 RWWString (const RWCString &str, multiByte_)
 
 RWWString (const char *str, size_t len, ascii_)
 
 RWWString (const char *str, size_t len, multiByte_)
 
 RWWString (const SubString &str)
 
 RWWString (const ConstSubString &str)
 
RWWStringappend (wchar_t c, size_t count=1)
 
RWWStringappend (const wchar_t *str)
 
RWWStringappend (const wchar_t *str, size_t len)
 
RWWStringappend (const std::wstring &str)
 
RWWStringappend (const RWWString &str)
 
RWWStringappend (const std::wstring &str, size_t len)
 
RWWStringappend (const RWWString &str, size_t len)
 
RWWStringassign (const RWWString &str)
 
RWWStringassign (const std::wstring &str)
 
RWWStringassign (const SubString &str)
 
RWWStringassign (const ConstSubString &str)
 
RWWStringassign (const wchar_t *str)
 
RWWStringassign (const wchar_t *str, size_t len)
 
RWWStringassign (const wchar_t c, size_t count=1)
 
RWspace binaryStoreSize () const
 
size_t capacity () const
 
size_t capacity (size_t cap)
 
int collate (const wchar_t *str) const
 
int collate (const std::wstring &str) const
 
int collate (const RWWString &str) const
 
int compareTo (const RWWString &str, caseCompare cmp=exact) const
 
int compareTo (const wchar_t *str, caseCompare cmp=exact) const
 
int compareTo (const std::wstring &str, caseCompare cmp=exact) const
 
int compareTo (const std::wstring *str, caseCompare cmp=exact) const
 
int compareTo (const RWWString *str, caseCompare cmp=exact) const
 
bool contains (const wchar_t *str, caseCompare cmp=exact) const
 
bool contains (const std::wstring &str, caseCompare cmp=exact) const
 
bool contains (const RWWString &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) const
 
size_t first (const wchar_t *str) const
 
size_t first (const wchar_t *str, size_t len) const
 
unsigned long hash (caseCompare cmp=exact) const
 
size_t index (const wchar_t *pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const std::wstring &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const RWWString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const wchar_t *pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const std::wstring &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const RWWString &pat, size_t patlen, size_t start, caseCompare cmp) const
 
RWWStringinsert (size_t pos, wchar_t c, size_t count)
 
RWWStringinsert (size_t pos, const wchar_t *str)
 
RWWStringinsert (size_t pos, const wchar_t *str, size_t len)
 
RWWStringinsert (size_t pos, const std::wstring &str)
 
RWWStringinsert (size_t pos, const RWWString &str)
 
RWWStringinsert (size_t pos, const std::wstring &str, size_t len)
 
RWWStringinsert (size_t pos, const RWWString &str, size_t len)
 
bool isAscii () const
 
bool isNull () const
 
size_t last (wchar_t c) const
 
size_t last (wchar_t c, size_t) const
 
size_t last (const wchar_t *str) const
 
size_t last (const wchar_t *str, size_t len) const
 
size_t length () const
 
 operator const wchar_t * () const
 
bool operator!= (const RWWString &rhs) const
 
wchar_t & operator() (size_t i)
 
wchar_t operator() (size_t i) const
 
SubString operator() (size_t start, size_t len)
 
ConstSubString operator() (size_t start, size_t len) const
 
RWWStringoperator+= (wchar_t c)
 
RWWStringoperator+= (const wchar_t *str)
 
RWWStringoperator+= (const std::wstring &str)
 
RWWStringoperator+= (const RWWString &str)
 
bool operator< (const RWWString &rhs) const
 
RWWStringoperator= (wchar_t c)
 
RWWStringoperator= (const wchar_t *str)
 
RWWStringoperator= (const std::wstring &str)
 
RWWStringoperator= (const RWWString &str)
 
RWWStringoperator= (const SubString &str)
 
RWWStringoperator= (const ConstSubString &str)
 
RWWStringoperator= (RWWString &&str)
 
bool operator== (const RWWString &rhs) const
 
bool operator> (const RWWString &rhs) const
 
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[] (short i) const
 
wchar_t operator[] (int 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 i)
 
wchar_t & operator[] (unsigned long long i)
 
wchar_t operator[] (long long i) const
 
wchar_t operator[] (unsigned long long i) const
 
RWWStringprepend (wchar_t c, size_t count=1)
 
RWWStringprepend (const wchar_t *str)
 
RWWStringprepend (const wchar_t *str, size_t len)
 
RWWStringprepend (const std::wstring &str)
 
RWWStringprepend (const RWWString &str)
 
RWWStringprepend (const std::wstring &str, size_t len)
 
RWWStringprepend (const RWWString &str, size_t len)
 
std::istream & readFile (std::istream &strm)
 
std::istream & readLine (std::istream &strm, bool skipWhite=true)
 
std::istream & readString (std::istream &strm)
 
std::istream & readToDelim (std::istream &strm)
 
std::istream & readToDelim (std::istream &strm, wchar_t delim)
 
std::istream & readToken (std::istream &strm)
 
std::wistream & readToken (std::wistream &strm)
 
RWWStringremove (size_t pos)
 
RWWStringremove (size_t pos, size_t len)
 
RWWStringreplace (size_t pos, size_t len, const wchar_t *str)
 
RWWStringreplace (size_t pos, size_t len, const std::wstring &str)
 
RWWStringreplace (size_t pos, size_t len, const RWWString &str)
 
RWWStringreplace (size_t pos, size_t len, const wchar_t *str, size_t strLen)
 
RWWStringreplace (size_t pos, size_t len, const std::wstring &str, size_t strLen)
 
RWWStringreplace (size_t pos, size_t len, const RWWString &str, size_t strLen)
 
void resize (size_t len)
 
size_t rindex (const wchar_t *pat, caseCompare cmp) const
 
size_t rindex (const wchar_t *pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const std::wstring &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const RWWString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const wchar_t *pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const std::wstring &pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const RWWString &pat, size_t patlen, size_t end, caseCompare cmp) const
 
std::wstring & std ()
 
const std::wstring & std () const
 
SubString strip (stripType st=trailing, wchar_t c=L' ')
 
ConstSubString strip (stripType st=trailing, wchar_t c=L' ') const
 
SubString subString (const wchar_t *pat, size_t start=0, caseCompare cmp=exact)
 
ConstSubString subString (const wchar_t *pat, size_t start=0, caseCompare cmp=exact) const
 
void swap (RWWString &str)
 
RWCString toAscii () const
 
void toLower ()
 
RWCString toMultiByte () const
 
void toUpper ()
 

Static Public Member Functions

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

Related Functions

(Note that these are not member functions.)

bool operator!= (const RWWString &lhs, const wchar_t *rhs)
 
bool operator!= (const wchar_t *lhs, const RWWString &rhs)
 
bool operator!= (const RWWString &lhs, const std::wstring &rhs)
 
bool operator!= (const std::wstring &lhs, const RWWString &rhs)
 
bool operator!= (const RWWSubString &lhs, const RWWString &rhs)
 
bool operator!= (const RWWString &lhs, const RWWSubString &rhs)
 
bool operator!= (const RWWConstSubString &lhs, const RWWString &rhs)
 
bool operator!= (const RWWString &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWString &lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWString &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWString &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWString &lhs, const std::wstring &rhs)
 
RWWString operator+ (const std::wstring &lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWString &lhs, const wchar_t *rhs)
 
RWWString operator+ (const wchar_t *lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const std::wstring &rhs)
 
RWWString operator+ (const std::wstring &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const wchar_t *rhs)
 
RWWString operator+ (const wchar_t *lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const std::wstring &rhs)
 
RWWString operator+ (const std::wstring &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const wchar_t *rhs)
 
RWWString operator+ (const wchar_t *lhs, const RWWConstSubString &rhs)
 
bool operator< (const RWWString &lhs, const wchar_t *rhs)
 
bool operator< (const wchar_t *lhs, const RWWString &rhs)
 
bool operator< (const RWWString &lhs, const std::wstring &rhs)
 
bool operator< (const std::wstring &lhs, const RWWString &rhs)
 
std::ostream & operator<< (std::ostream &os, const RWWString &s)
 
std::wostream & operator<< (std::wostream &os, const RWWString &str)
 
RWvostreamoperator<< (RWvostream &vos, const RWWString &str)
 
RWFileoperator<< (RWFile &file, const RWWString &str)
 
bool operator<= (const RWWString &rhs) const
 
bool operator<= (const RWWString &lhs, const wchar_t *rhs)
 
bool operator<= (const wchar_t *lhs, const RWWString &rhs)
 
bool operator<= (const RWWString &lhs, const std::wstring &rhs)
 
bool operator<= (const std::wstring &lhs, const RWWString &rhs)
 
bool operator== (const RWWString &lhs, const wchar_t *rhs)
 
bool operator== (const wchar_t *lhs, const RWWString &rhs)
 
bool operator== (const RWWString &lhs, const std::wstring &rhs)
 
bool operator== (const std::wstring &lhs, const RWWString &rhs)
 
bool operator== (const RWWSubString &lhs, const RWWString &rhs)
 
bool operator== (const RWWString &lhs, const RWWSubString &rhs)
 
bool operator== (const RWWConstSubString &lhs, const RWWString &rhs)
 
bool operator== (const RWWString &lhs, const RWWConstSubString &rhs)
 
bool operator> (const RWWString &lhs, const wchar_t *rhs)
 
bool operator> (const wchar_t *lhs, const RWWString &rhs)
 
bool operator> (const RWWString &lhs, const std::wstring &rhs)
 
bool operator> (const std::wstring &lhs, const RWWString &rhs)
 
bool operator>= (const RWWString &rhs) const
 
bool operator>= (const RWWString &lhs, const wchar_t *rhs)
 
bool operator>= (const wchar_t *lhs, const RWWString &rhs)
 
bool operator>= (const RWWString &lhs, const std::wstring &rhs)
 
bool operator>= (const std::wstring &lhs, const RWWString &rhs)
 
std::istream & operator>> (std::istream &s, RWWString &str)
 
RWvistreamoperator>> (RWvistream &str, RWWString &cstr)
 
RWFileoperator>> (RWFile &file, RWWString &cstr)
 
RWWString strXForm (const std::wstring &str)
 
RWWString strXForm (const RWWString &str)
 
RWWString toLower (const RWWString &str)
 
RWWString toUpper (const RWWString &str)
 

Detailed Description

Class RWWString offers very powerful and convenient facilities for manipulating wide character strings.

Note
RWWString is designed for use with wide character strings. To manipulate multibyte character sequences, use RWCString.

This string class manipulates wide characters of the fundamental type wchar_t. These characters are generally two or four bytes, and can be used to encode richer code sets than the classic char type. Because wchar_t characters are all the same size, indexing is fast.

Conversion to and from multibyte and US-ASCII forms are provided by the RWWString constructors, and by the RWWString member functions isAscii(), toAscii(), and toMultiByte().

Stream operations implicitly translate to and from the multibyte stream representation. That is, on output, wide character strings are converted into multibyte strings, while on input they are converted back into wide character strings. Hence, the external representation of wide character strings is usually as multibyte character strings, saving storage space, and making interfaces with devices (which usually expect multibyte strings) easier.

RWWString tolerates embedded nulls.

Parameters of type const wchar_t* must not be passed a value of zero. This is detected in the debug version of the library.

A separate RWWSubString class supports substring extraction and modification operations. RWWConstSubString supports substring extractions on const RWWString instances.

Synopsis
#include <rw/wstring.h>
Persistence
Simple
Example
#include <iostream>
#include <rw/wstring.h>
int main ()
{
RWWString a(L"There is no joy in Beantown");
std::cout << a << std::endl << "becomes......" << std::endl;
a.subString(L"Beantown") = L"Redmond";
std::cout << a << std::endl;
return 0;
}

Program output (assuming your platform displays wide characters as US-ASCII if they are in the US-ASCII character set):

"There is no joy in Beantown" becomes "There is no joy in Redmond."

Member Typedef Documentation

The immutable substring class associated with RWWString.

The mutable substring class associated with RWWString.

Member Enumeration Documentation

Specifies that a function should assume US-ASCII content when converting from a const char* string.

Enumerator
ascii 

Convert from US-ASCII

Specifies semantics used by comparisons, searches, and hashing functions

Enumerator
exact 

Use exact case sensitive semantics

ignoreCase 

Ignore case sensitive semantics

ignoreCaseStrict 

Case-insensitive for alpha characters only. ignoreCaseStrict only differs from ignoreCase in comparison operations, where changing case can affect the order of the strings.

Specifies that a function should assume multibyte content when converting from a const char* string.

Enumerator
multiByte 

Convert from multibyte

Specifies how to strip characters from a string. Used by strip().

Enumerator
leading 

Remove characters at beginning

trailing 

Remove characters at end

both 

Remove characters at both ends

Constructor & Destructor Documentation

RWWString::RWWString ( )
inline

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

RWWString::RWWString ( const std::wstring &  str)
inline

Constructs a string with data copied from str.

RWWString::RWWString ( const RWWString str)
inline

Copy constructor. The created string copies the data from str.

RWWString::RWWString ( RWWString &&  str)
inline

Move constructor. The created string takes ownership of the data owned by str.

Condition:
This method is available only on platforms with rvalue reference support.
RWWString::RWWString ( RWSize_T  cap)
inline

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 cap. We recommend creating an RWSize_T value from a numerical constant to pass into this constructor. While RWSize_T knows how to convert size_t values to itself, conforming compilers choose the conversion to char instead.

RWWString::RWWString ( wchar_t  c)
inline

Constructs a string containing the single character c.

RWWString::RWWString ( wchar_t  c,
size_t  count 
)
inline

Constructs a string containing the character c repeated count times.

RWWString::RWWString ( const wchar_t *  str)
inline

Converts from the null-terminated wide character string str. The created string copies the data pointed to by str, up to the first terminating null.

Note
This function is incompatible with str strings with embedded nulls.
RWWString::RWWString ( const wchar_t *  str,
size_t  len 
)
inline

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

RWWString::RWWString ( char  c)
inline

Constructs a string containing the single character c. The character c is widened to a wchar_t.

RWWString::RWWString ( char  c,
size_t  count 
)
inline

Constructs a string containing the character c repeated count times. The character c is widened to a wchar_t.

RWWString::RWWString ( signed char  c)
inline

Constructs a string containing the single signed character c. The character c is widened to a wchar_t.

RWWString::RWWString ( unsigned char  c)
inline

Constructs a string containing the single unsigned character c. The character c is widened to a wchar_t.

RWWString::RWWString ( const char *  str,
ascii_   
)
inline

Constructs a wide character string from the US-ASCII character string contained in str.

For this conversion to be successful, the string must contain only US-ASCII characters. This can be confirmed (if necessary) using RWCString::isAscii(). If str contains non-US-ASCII characters, the RWWString(const char*,multiByte_) constructor should be used instead.

This constructor can be used as follows:

RWWString a("An US-ASCII character string", RWWString::ascii);
RWWString::RWWString ( const RWCString str,
ascii_   
)

Constructs a wide character string from the US-ASCII character string contained in str.

For this conversion to be successful, the string must contain only US-ASCII characters. This can be confirmed (if necessary) using RWCString::isAscii(). If str contains non-US-ASCII characters, the RWWString(const char*,multiByte_) constructor should be used instead.

This constructor can be used as follows:

RWWString a("An US-ASCII character string", RWWString::ascii);
RWWString::RWWString ( const char *  str,
multiByte_   
)
inline

Constructs a wide character string from the multibyte character string contained in str. The conversion is done using the C++ Standard Library function std::mbstowcs().

This constructor can be used as follows:

RWWString a("\306\374\315\313\306\374", multiByte);
RWWString::RWWString ( const RWCString str,
multiByte_   
)

Constructs a wide character string from the multibyte character string contained in str. The conversion is done using the C++ Standard Library function std::mbstowcs().

This constructor can be used as follows:

RWWString a("\306\374\315\313\306\374", multiByte);
RWWString::RWWString ( const char *  str,
size_t  len,
ascii_   
)
inline

Constructs a wide character string from the US-ASCII character string contained in str, copying exactly len characters including any embedded nulls. Hence, the buffer pointed to by str must be long enough to hold len characters.

RWWString::RWWString ( const char *  str,
size_t  len,
multiByte_   
)
inline

Constructs a wide character string from the multibyte character string contained in str, copying exactly len characters including any embedded nulls. Hence, the buffer pointed to by str must be long enough to hold len characters.

RWWString::RWWString ( const SubString str)
inline

Converts from substring. The created string copies the substring represented by str.

RWWString::RWWString ( const ConstSubString str)
inline

Converts from substring. The created wide string copies the substring represented by str.

Member Function Documentation

RWWString & RWWString::append ( wchar_t  c,
size_t  count = 1 
)
inline

Appends count copies of the character c to self. Returns a reference to self.

RWWString & RWWString::append ( const wchar_t *  str)
inline

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

Note
This function is incompatible with str strings with embedded nulls.
RWWString & RWWString::append ( const wchar_t *  str,
size_t  len 
)
inline

Appends a copy of the wide character string str to self. Exactly len characters are copied, including any embedded nulls. Hence, the buffer pointed to by str must be at least len characters long. Returns a reference to self.

RWWString & RWWString::append ( const std::wstring &  str)
inline

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

RWWString & RWWString::append ( const RWWString str)
inline

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

RWWString & RWWString::append ( const std::wstring &  str,
size_t  len 
)
inline

Appends the first len characters of str to self. If len is greater than the length of str, the entire string is appended. Returns a reference to self.

RWWString & RWWString::append ( const RWWString str,
size_t  len 
)
inline

Appends the first len characters of str to self. If len is greater than the length of str, the entire string is appended. Returns a reference to self.

RWWString & RWWString::assign ( const RWWString str)
inline

Assigns a copy of the wide character string str to self, replacing existing content. Returns a reference to self.

RWWString & RWWString::assign ( const std::wstring &  str)
inline

Assigns a copy of the wide character string str to self, replacing existing content. Returns a reference to self.

RWWString & RWWString::assign ( const SubString str)
inline

Assigns a copy of the wide character string str to self, replacing existing content. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.
RWWString & RWWString::assign ( const ConstSubString str)
inline

Assigns a copy of the wide character string str to self, replacing existing content. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.
RWWString & RWWString::assign ( const wchar_t *  str)
inline

Assigns the null-terminated wide character string pointed to by str to self, replacing existing content. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.
RWWString & RWWString::assign ( const wchar_t *  str,
size_t  len 
)
inline

Assigns a copy of the wide character string str to self, replacing existing content. Exactly len bytes are copied, including any embedded nulls. Hence, the buffer pointed to by str must be at least len characters long. Returns a reference to self.

RWWString & RWWString::assign ( const wchar_t  c,
size_t  count = 1 
)
inline

Assigns count copies of the wide character c to self, replacing existing content. Returns a reference to self.

RWspace RWWString::binaryStoreSize ( ) const
inline

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

size_t RWWString::capacity ( ) const
inline

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

size_t RWWString::capacity ( size_t  cap)
inline

A non-binding request to alter the capacity of self to cap. The capacity is never reduced below the current number of characters. Returns the actual capacity.

int RWWString::collate ( const wchar_t *  str) const
inline

Returns an int less than, greater than, or equal to zero, according to the result of calling the C++ Standard Library function std::wcscoll() on self and the argument str. This method supports locale-dependent collation.

Note
This function is incompatible with str strings with embedded nulls.
int RWWString::collate ( const std::wstring &  str) const
inline

Returns an int less than, greater than, or equal to zero, according to the result of calling the C++ Standard Library function std::wcscoll() on self and the argument str. This method supports locale-dependent collation.

Note
This function is incompatible with str strings with embedded nulls.
int RWWString::collate ( const RWWString str) const
inline

Returns an int less than, greater than, or equal to zero, according to the result of calling the C++ Standard Library function std::wcscoll() on self and the argument str. This method supports locale-dependent collation.

Note
This function is incompatible with str strings with embedded nulls.
int RWWString::compareTo ( const RWWString str,
caseCompare  cmp = exact 
) const
inline

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

int RWWString::compareTo ( const wchar_t *  str,
caseCompare  cmp = exact 
) const
inline

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
This function is incompatible with str strings with embedded nulls.
int RWWString::compareTo ( const std::wstring &  str,
caseCompare  cmp = exact 
) const
inline

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

int RWWString::compareTo ( const std::wstring *  str,
caseCompare  cmp = exact 
) const
inline

This function is the equivalent of calling:

int RWWString::compareTo ( const RWWString str,
caseCompare  cmp = exact 
) const
inline

This function is the equivalent of calling:

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

Returns false if RWWString::index(str, cmp) returns RW_NPOS, otherwise returns true.

bool RWWString::contains ( const std::wstring &  str,
caseCompare  cmp = exact 
) const
inline

Returns false if RWWString::index(str, cmp) returns RW_NPOS, otherwise returns true.

bool RWWString::contains ( const RWWString str,
caseCompare  cmp = exact 
) const
inline

Returns false if RWWString::index(str, cmp) returns RW_NPOS, otherwise returns true.

const wchar_t* RWWString::data ( void  ) const
inline

Provides access to the RWWString instances's data as a null-terminated string. This datum is owned by the RWWString and may not be deleted or changed. If the RWWString 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 RWWString::first ( wchar_t  c) const
inline

Returns the index of the first occurrence of the character c in self. Returns RW_NPOS if there is no match.

size_t RWWString::first ( wchar_t  c,
size_t   
) const
inline
Deprecated:
As of SourcePro 12, use RWWString::first(wchar_t) const instead.
size_t RWWString::first ( const wchar_t *  str) const
inline

Returns the index of the first occurrence in self of any character in str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.
size_t RWWString::first ( const wchar_t *  str,
size_t  len 
) const
inline

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

static RWWString RWWString::fromAscii ( const RWCString str)
inlinestatic

Equivalent to calling:

static RWWString RWWString::fromMultiByte ( const RWCString str)
inlinestatic

Equivalent to calling:

unsigned long RWWString::hash ( caseCompare  cmp = exact) const

Returns a suitable hash value.

static unsigned RWWString::hash ( const RWWString wstr)
inlinestatic

Returns the hash value of str as returned by hash(caseCompare) const, where caseCompare is RWWString::exact.

size_t RWWString::index ( const wchar_t *  pat,
size_t  start = 0,
caseCompare  cmp = exact 
) const
inline

Pattern matching. Starting with index start, searches for the first occurrence of the null-terminated string 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 cmp.

Note
This function is incompatible with pat strings with embedded nulls.
size_t RWWString::index ( const std::wstring &  pat,
size_t  start = 0,
caseCompare  cmp = exact 
) const
inline

Pattern matching. Starting with index start, 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 cmp.

size_t RWWString::index ( const RWWString pat,
size_t  start = 0,
caseCompare  cmp = exact 
) const
inline

Pattern matching. Starting with index start, 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 cmp.

size_t RWWString::index ( const wchar_t *  pat,
size_t  patlen,
size_t  start,
caseCompare  cmp 
) const
inline

Pattern matching. Starting with index start, 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 cmp.

size_t RWWString::index ( const std::wstring &  pat,
size_t  patlen,
size_t  start,
caseCompare  cmp 
) const
inline

Pattern matching. Starting with index start, 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 cmp.

size_t RWWString::index ( const RWWString pat,
size_t  patlen,
size_t  start,
caseCompare  cmp 
) const
inline

Pattern matching. Starting with index start, 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 cmp.

static size_t RWWString::initialCapacity ( size_t  capacity = 15)
static
Deprecated:
As of SourcePro 12.

It has no effect on an RWWString instance and may be removed from a future release.

RWWString & RWWString::insert ( size_t  pos,
wchar_t  c,
size_t  count 
)
inline

Inserts count instances of the character c into self at index pos. Returns a reference to self.

RWWString & RWWString::insert ( size_t  pos,
const wchar_t *  str 
)
inline

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

Note
This function is incompatible with str strings with embedded nulls.
RWWString & RWWString::insert ( size_t  pos,
const wchar_t *  str,
size_t  len 
)
inline

Inserts a copy of the first len characters of str into self at index pos. Returns a reference to self.

RWWString & RWWString::insert ( size_t  pos,
const std::wstring &  str 
)
inline

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

RWWString & RWWString::insert ( size_t  pos,
const RWWString str 
)
inline

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

RWWString & RWWString::insert ( size_t  pos,
const std::wstring &  str,
size_t  len 
)
inline

Inserts the first len characters of str into self at index pos. If len is greater than the length of str, the entire string is inserted. Returns a reference to self.

RWWString & RWWString::insert ( size_t  pos,
const RWWString str,
size_t  len 
)
inline

Inserts the first len characters of str into self at index pos. If len is greater than the length of str, the entire string is inserted. Returns a reference to self.

bool RWWString::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 RWWString::isNull ( void  ) const
inline

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

size_t RWWString::last ( wchar_t  c) const
inline

Returns the index of the last occurrence of the character c in self. Returns RW_NPOS if there is no match.

size_t RWWString::last ( wchar_t  c,
size_t   
) const
inline
Deprecated:
As of SourcePro 12, use RWWString::last(wchar_t) const instead.
size_t RWWString::last ( const wchar_t *  str) const
inline

Returns the index of the last occurrence in self of any character in str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.
size_t RWWString::last ( const wchar_t *  str,
size_t  len 
) const
inline

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

size_t RWWString::length ( ) const
inline

Returns the number of characters in self.

static size_t RWWString::maxWaste ( size_t  maxwaste = 16)
static
Deprecated:
As of SourcePro 12.

It has no effect on an RWWString instance and may be removed from a future release.

RWWString::operator const wchar_t * ( ) const
inline

The equivalent of calling RWWString::data() on self.

bool RWWString::operator!= ( const RWWString rhs) const
inline

The equivalent of calling:

!(*this == rhs)
wchar_t & RWWString::operator() ( size_t  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the preprocessor macro RWBOUNDS_CHECK has been defined before including <rw/wstring.h>.

Exceptions
RWBoundsErrif RWBOUNDS_CHECK is defined and the index is out of range.
wchar_t RWWString::operator() ( size_t  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the preprocessor macro RWBOUNDS_CHECK has been defined before including <rw/wstring.h>.

Exceptions
RWBoundsErrif RWBOUNDS_CHECK is defined and the index is out of range.
RWWSubString RWWString::operator() ( size_t  start,
size_t  len 
)
inline

Substring operator. Returns a substring 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.

Exceptions
RWBoundsErrif the library was built using the RW_DEBUG flag, and start and len are out of range.
RWWConstSubString RWWString::operator() ( size_t  start,
size_t  len 
) const
inline

Substring operator. Returns a substring 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.

Exceptions
RWBoundsErrif the library was built using the RW_DEBUG flag, and start and len are out of range.
RWWString& RWWString::operator+= ( wchar_t  c)
inline

Appends the character c to self. Returns a reference to self.

RWWString& RWWString::operator+= ( const wchar_t *  str)
inline

Appends the null-terminated character string pointed to by str to self. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.
RWWString& RWWString::operator+= ( const std::wstring &  str)
inline

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

RWWString& RWWString::operator+= ( const RWWString str)
inline

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

bool RWWString::operator< ( const RWWString rhs) const
inline

Returns true if this lexicographically precedes rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

RWWString & RWWString::operator= ( wchar_t  c)
inline

Assignment operator. Copies the character c into self. Returns a reference to self.

RWWString & RWWString::operator= ( const wchar_t *  str)
inline

Assignment operator. Copies the null-terminated character string pointed to by str into self. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.
RWWString & RWWString::operator= ( const std::wstring &  str)
inline

Assignment operator. The string copies the data from str. Returns a reference to self.

RWWString & RWWString::operator= ( const RWWString str)
inline

Assignment operator. The string copies the data from str. Returns a reference to self.

RWWString & RWWString::operator= ( const SubString str)
inline

Assignment operator. The string copies the data from str. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.
RWWString & RWWString::operator= ( const ConstSubString str)
inline

Assignment operator. The string copies the data from str. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.
RWWString & RWWString::operator= ( RWWString &&  str)
inline

Move assignment. Self takes ownership of the data owned by str.

Condition:
This method is available only on platforms with rvalue reference support.
bool RWWString::operator== ( const RWWString rhs) const
inline

Returns true if this is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool RWWString::operator> ( const RWWString rhs) const
inline

The equivalent of calling:

!(rhs < *this)
wchar_t & RWWString::operator[] ( short  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( int  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( long  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( unsigned short  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( unsigned int  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( unsigned long  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( short  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( int  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( long  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( unsigned short  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( unsigned int  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( unsigned long  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( long long  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t & RWWString::operator[] ( unsigned long long  i)
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( long long  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
wchar_t RWWString::operator[] ( unsigned long long  i) const
inline

Returns the i th character in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.
RWWString & RWWString::prepend ( wchar_t  c,
size_t  count = 1 
)
inline

Prepends count copies of character c to self. Returns a reference to self.

RWWString & RWWString::prepend ( const wchar_t *  str)
inline

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

Note
This function is incompatible with str strings with embedded nulls.
RWWString & RWWString::prepend ( const wchar_t *  str,
size_t  len 
)
inline

Prepends a copy of the character string str to self. Exactly len characters are copied, including any embedded nulls. Hence, the buffer pointed to by str must be at least len characters long. Returns a reference to self.

RWWString & RWWString::prepend ( const std::wstring &  str)
inline

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

RWWString & RWWString::prepend ( const RWWString str)
inline

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

RWWString & RWWString::prepend ( const std::wstring &  str,
size_t  len 
)
inline

Prepends the first len characters of str to self. If len is greater than the length of str, the entire string is prepended. Returns a reference to self.

RWWString & RWWString::prepend ( const RWWString str,
size_t  len 
)
inline

Prepends the first len characters of str to self. If len is greater than the length of str, the entire string is prepended. Returns a reference to self.

std::istream& RWWString::readFile ( std::istream &  strm)

Reads characters from the input stream strm, replacing the previous contents of self, until EOF is reached. The input stream is treated as a sequence of wide characters, each of which is read and stored in the RWWString object. Null characters are treated the same as other characters.

Note
RWWString is designed for use with wide character strings; to manipulate multibyte character sequences, use RWCString.
std::istream & RWWString::readLine ( std::istream &  strm,
bool  skipWhite = true 
)
inline

Reads characters from the input stream strm, 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 wide characters, each of which is read and stored in the RWWString object. Null characters are treated the same as other characters. If the skipWhite argument is true, then whitespace is skipped (using the iostream library manipulator ws) before saving characters.

Note
RWWString is designed for use with wide character strings; to manipulate multibyte character sequences, use RWCString.
std::istream & RWWString::readString ( std::istream &  strm)
inline

Reads characters from the input stream strm, replacing the previous contents of self, until an EOF or null terminator is encountered. The input stream is treated as a sequence of wide characters, each of which is read and stored in the RWWString object.

Note
RWWString is designed for use with wide character strings; to manipulate multibyte character sequences, use RWCString.
std::istream& RWWString::readToDelim ( std::istream &  strm)
inline

The equivalent of calling:

std::istream& RWWString::readToDelim ( std::istream &  strm,
wchar_t  delim 
)
inline

Reads characters from the input stream strm, 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 wide characters, each of which is read and stored in the RWWString object. Null characters are treated the same as other characters.

Note
RWWString is designed for use with wide character strings; to manipulate multibyte character sequences, use RWCString.
std::istream& RWWString::readToken ( std::istream &  strm)

Whitespace is skipped before storing characters into a wide string. Characters are then read from the input stream strm, replacing 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 C++ Standard Library function std::iswspace(). The input stream is treated as a sequence of wide characters, each of which is read and stored in the RWWString object.

Note
RWWString is designed for use with wide character strings; to manipulate multibyte character sequences, use RWCString.
std::wistream & RWWString::readToken ( std::wistream &  strm)
inline

White space is skipped before reading from strm. Characters are then read from the input stream strm, replacing previous contents of self, until trailing white space or EOF is encountered. The white space is left on the input stream. Null characters are treated the same as other characters. White space is identified by the C++ Standard Library function std::iswspace().

RWWString & RWWString::remove ( size_t  pos)
inline

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

RWWString & RWWString::remove ( size_t  pos,
size_t  len 
)
inline

Removes len 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.

RWWString & RWWString::replace ( size_t  pos,
size_t  len,
const wchar_t *  str 
)
inline

Replaces the substring beginning at pos and of length len with the null-terminated string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.
Exceptions
RWBoundsErrIf pos is greater than the length of self.
RWWString & RWWString::replace ( size_t  pos,
size_t  len,
const std::wstring &  str 
)
inline

Replaces the substring beginning at pos and of length len with the string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
RWWString & RWWString::replace ( size_t  pos,
size_t  len,
const RWWString str 
)
inline

Replaces the substring beginning at pos and of length len with the string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
RWWString & RWWString::replace ( size_t  pos,
size_t  len,
const wchar_t *  str,
size_t  strLen 
)
inline

Replaces the substring beginning at pos and of length len with strLen characters from str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
RWWString & RWWString::replace ( size_t  pos,
size_t  len,
const std::wstring &  str,
size_t  strLen 
)
inline

Replaces the substring beginning at pos and of length len with the first strLen characters of string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string. If strLen is greater than the length of str, all of str is used.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
RWWString & RWWString::replace ( size_t  pos,
size_t  len,
const RWWString str,
size_t  strLen 
)
inline

Replaces the substring beginning at pos and of length len with the first strLen characters of string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string. If strLen is greater than the length of str, all of str is used.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
void RWWString::resize ( size_t  len)
inline

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

static size_t RWWString::resizeIncrement ( size_t  increment = 16)
static
Deprecated:
As of SourcePro 12.

It has no effect on an RWWString instance and may be removed from a future release.

size_t RWWString::rindex ( const wchar_t *  pat,
caseCompare  cmp 
) const
inline

Pattern matching. Searches for the last occurrence of the null-terminated string 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 cmp.

Note
This function is incompatible with pat strings with embedded nulls.
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
size_t RWWString::rindex ( const wchar_t *  pat,
size_t  end = RW_NPOS,
caseCompare  cmp = exact 
) const
inline

Pattern matching. Searches for the last occurrence of the null-terminated string pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
This function is incompatible with pat strings with embedded nulls.
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
size_t RWWString::rindex ( const std::wstring &  pat,
size_t  end = RW_NPOS,
caseCompare  cmp = exact 
) const
inline

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
size_t RWWString::rindex ( const RWWString pat,
size_t  end = RW_NPOS,
caseCompare  cmp = exact 
) const
inline

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
size_t RWWString::rindex ( const wchar_t *  pat,
size_t  patlen,
size_t  end,
caseCompare  cmp 
) const
inline

Pattern matching. Searches for the last occurrence of the first patlen characters from pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
size_t RWWString::rindex ( const std::wstring &  pat,
size_t  patlen,
size_t  end,
caseCompare  cmp 
) const
inline

Pattern matching. Searches for the last occurrence of the first patlen characters from pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
size_t RWWString::rindex ( const RWWString pat,
size_t  patlen,
size_t  end,
caseCompare  cmp 
) const
inline

Pattern matching. Searches for the last occurrence of the first patlen characters from pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
std::wstring& RWWString::std ( )

Returns the underlying std::wstring representation of self.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
const std::wstring& RWWString::std ( ) const
inline

Returns the underlying std::wstring representation of self.

Note
  • This member function is unavailable on RWWString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteWString
SubString RWWString::strip ( stripType  st = trailing,
wchar_t  c = L' ' 
)

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

ConstSubString RWWString::strip ( stripType  st = trailing,
wchar_t  c = L' ' 
) const

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

SubString RWWString::subString ( const wchar_t *  pat,
size_t  start = 0,
caseCompare  cmp = exact 
)

Starting at start, returns a substring representing the first occurrence of the null-terminated string pat in self. If pat is not found, a null substring instance is returned.

Note
This function is incompatible with pat strings with embedded nulls.
ConstSubString RWWString::subString ( const wchar_t *  pat,
size_t  start = 0,
caseCompare  cmp = exact 
) const

Starting at start, returns a substring representing the first occurrence of the null-terminated string pat in self. If pat is not found, a null substring instance is returned.

Note
This function is incompatible with pat strings with embedded nulls.
void RWWString::swap ( RWWString str)
inline

Swaps the contents of str with self.

RWCString RWWString::toAscii ( ) const

Returns an ASCII representation of self. 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 RWWString::toLower ( )
inline

Changes all upper-case letters in self to lower-case. Uses the C++ Standard Library function std::towlower().

RWCString RWWString::toMultiByte ( ) const

Returns a multibyte representation of self.

Note
This method does not handle embedded nulls on systems where std::wcstombs() doesn't handle them. Returns an empty string if the wide string cannot be translated (for instance, if the correct locale is not set to convert a specific character).
void RWWString::toUpper ( )
inline

Changes all lower-case letters in self to upper-case. Uses the C++ Standard Library function std::towupper().

Friends And Related Function Documentation

bool operator!= ( const RWWString lhs,
const wchar_t *  rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const wchar_t *  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const RWWString lhs,
const std::wstring &  rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const std::wstring &  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const RWWSubString lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const RWWString lhs,
const RWWSubString rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const RWWConstSubString lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
bool operator!= ( const RWWString lhs,
const RWWConstSubString rhs 
)
related

The equivalent of calling:

!(lhs == rhs)
RWWString operator+ ( const RWWString lhs,
const RWWString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWString lhs,
const RWWSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWSubString lhs,
const RWWString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWString lhs,
const RWWConstSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWConstSubString lhs,
const RWWString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWString lhs,
const std::wstring &  rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const std::wstring &  lhs,
const RWWString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWString lhs,
const wchar_t *  rhs 
)
related

Concatenates lhs and the null-terminated string rhs and returns the resulting string.

Note
This function is incompatible with rhs strings with embedded nulls.
RWWString operator+ ( const wchar_t *  lhs,
const RWWString rhs 
)
related

Concatenates the null-terminated string lhs and rhs and returns the resulting string.

Note
This function is incompatible with lhs strings with embedded nulls.
RWWString operator+ ( const RWWSubString lhs,
const RWWSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWSubString lhs,
const RWWConstSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWConstSubString lhs,
const RWWSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWSubString lhs,
const std::wstring &  rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const std::wstring &  lhs,
const RWWSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWSubString lhs,
const wchar_t *  rhs 
)
related

Concatenates lhs and the null-terminated string rhs and returns the resulting string.

Note
This function is incompatible with rhs strings with embedded nulls.
RWWString operator+ ( const wchar_t *  lhs,
const RWWSubString rhs 
)
related

Concatenates the null-terminated string lhs and rhs and returns the resulting string.

Note
This function is incompatible with lhs strings with embedded nulls.
RWWString operator+ ( const RWWConstSubString lhs,
const RWWConstSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWConstSubString lhs,
const std::wstring &  rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const std::wstring &  lhs,
const RWWConstSubString rhs 
)
related

Concatenates lhs and rhs and returns the resulting string.

RWWString operator+ ( const RWWConstSubString lhs,
const wchar_t *  rhs 
)
related

Concatenates lhs and the null-terminated string rhs and returns the resulting string.

Note
This function is incompatible with rhs strings with embedded nulls.
RWWString operator+ ( const wchar_t *  lhs,
const RWWConstSubString rhs 
)
related

Concatenates the null-terminated string lhs and rhs and returns the resulting string.

Note
This function is incompatible with lhs strings with embedded nulls.
bool operator< ( const RWWString lhs,
const wchar_t *  rhs 
)
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator< ( const wchar_t *  lhs,
const RWWString rhs 
)
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator< ( const RWWString lhs,
const std::wstring &  rhs 
)
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator< ( const std::wstring &  lhs,
const RWWString rhs 
)
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

std::ostream & operator<< ( std::ostream &  os,
const RWWString s 
)
related

Outputs an RWWString on ostream os as a sequence of bytes. This is done literally from the byte content of the characters.

std::wostream & operator<< ( std::wostream &  os,
const RWWString str 
)
related

Outputs an RWWString on wostream os as a sequence of wide characters.

RWvostream & operator<< ( RWvostream vos,
const RWWString str 
)
related

Saves string str to a virtual stream.

RWFile & operator<< ( RWFile file,
const RWWString str 
)
related

Saves string str to an RWFile.

bool operator<= ( const RWWString rhs) const
related

The equivalent of calling:

!(rhs < *this)
bool operator<= ( const RWWString lhs,
const wchar_t *  rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator<= ( const wchar_t *  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator<= ( const RWWString lhs,
const std::wstring &  rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator<= ( const std::wstring &  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator== ( const RWWString lhs,
const wchar_t *  rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const wchar_t *  lhs,
const RWWString rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const RWWString lhs,
const std::wstring &  rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const std::wstring &  lhs,
const RWWString rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const RWWSubString lhs,
const RWWString rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const RWWString lhs,
const RWWSubString rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const RWWConstSubString lhs,
const RWWString rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator== ( const RWWString lhs,
const RWWConstSubString rhs 
)
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWWString::collate() or RWWString::strXForm() for locale-sensitive comparisons.

bool operator> ( const RWWString lhs,
const wchar_t *  rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator> ( const wchar_t *  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator> ( const RWWString lhs,
const std::wstring &  rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator> ( const std::wstring &  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(rhs < lhs)
bool operator>= ( const RWWString rhs) const
related

The equivalent of calling:

!(*this < rhs)
bool operator>= ( const RWWString lhs,
const wchar_t *  rhs 
)
related

The equivalent of calling:

!(lhs < rhs)
bool operator>= ( const wchar_t *  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(lhs < rhs)
bool operator>= ( const RWWString lhs,
const std::wstring &  rhs 
)
related

The equivalent of calling:

!(lhs < rhs)
bool operator>= ( const std::wstring &  lhs,
const RWWString rhs 
)
related

The equivalent of calling:

!(lhs < rhs)
std::istream & operator>> ( std::istream &  s,
RWWString str 
)
related

Calls str.readToken(s). That is, a token is read from the input stream s.

RWvistream & operator>> ( RWvistream str,
RWWString cstr 
)
related

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

If an error occurs while extracting the string, the operator returns the original string contents unmodified. Check the virtual stream to determine if an error occurred on extraction.

RWFile & operator>> ( RWFile file,
RWWString cstr 
)
related

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

If an error occurs while extracting the string, the operator returns the original string contents unmodified. Check the file to determine if an error occurred on extraction.

RWWString strXForm ( const std::wstring &  str)
related
Deprecated:
As of SourcePro 12, use strXForm(const RWWString&) instead.
RWWString strXForm ( const RWWString str)
related

Returns the result of applying std::wcsxfrm() to str to allow quicker collation than RWWString::collate().

Note
This function is incompatible with str strings with embedded nulls.
RWWString toLower ( const RWWString str)
related

Returns a copy of str with all upper-case characters replaced with lower-case characters. This function is the equivalent of calling:

RWWString tmp(str);
tmp.toLower();
RWWString toUpper ( const RWWString str)
related

Returns a copy of str with all lower-case characters replaced with upper-case characters. This function is the equivalent of calling:

RWWString tmp(str);
tmp.toUpper();

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.