SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

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 (char c)
 
 RWWString (char c, size_t count)
 
 RWWString (const char *str, ascii_)
 
 RWWString (const char *str, multiByte_)
 
 RWWString (const char *str, size_t len, ascii_)
 
 RWWString (const char *str, size_t len, multiByte_)
 
 RWWString (const ConstSubString &str)
 
 RWWString (const RWCString &str, ascii_)
 
 RWWString (const RWCString &str, multiByte_)
 
 RWWString (const RWWString &str)
 
 RWWString (const std::wstring &str)
 
 RWWString (const SubString &str)
 
 RWWString (const wchar_t *str)
 
 RWWString (const wchar_t *str, size_t len)
 
 RWWString (RWSize_T cap)
 
 RWWString (RWWString &&str)
 
 RWWString (signed char c)
 
 RWWString (unsigned char c)
 
 RWWString (wchar_t c)
 
 RWWString (wchar_t c, size_t count)
 
RWWStringappend (const RWWString &str)
 
RWWStringappend (const RWWString &str, size_t len)
 
RWWStringappend (const std::wstring &str)
 
RWWStringappend (const std::wstring &str, size_t len)
 
RWWStringappend (const wchar_t *str)
 
RWWStringappend (const wchar_t *str, size_t len)
 
RWWStringappend (wchar_t c, size_t count=1)
 
RWWStringassign (const ConstSubString &str)
 
RWWStringassign (const RWWString &str)
 
RWWStringassign (const std::wstring &str)
 
RWWStringassign (const SubString &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 RWWString &str) const
 
int collate (const std::wstring &str) const
 
int collate (const wchar_t *str) const
 
int compareTo (const RWWString &str, caseCompare cmp=exact) const
 
int compareTo (const RWWString *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 wchar_t *str, caseCompare cmp=exact) const
 
bool contains (const RWWString &str, caseCompare cmp=exact) const
 
bool contains (const std::wstring &str, caseCompare cmp=exact) const
 
bool contains (const wchar_t *str, caseCompare cmp=exact) const
 
const wchar_t * data () const
 
size_t first (const wchar_t *str) const
 
size_t first (const wchar_t *str, size_t len) const
 
size_t first (wchar_t c) const
 
size_t first (wchar_t c, size_t) const
 
unsigned long hash (caseCompare cmp=exact) const
 
size_t index (const RWWString &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const RWWString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const std::wstring &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const std::wstring &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 wchar_t *pat, size_t start=0, caseCompare cmp=exact) const
 
RWWStringinsert (size_t pos, const RWWString &str)
 
RWWStringinsert (size_t pos, const RWWString &str, size_t len)
 
RWWStringinsert (size_t pos, const std::wstring &str)
 
RWWStringinsert (size_t pos, const std::wstring &str, size_t len)
 
RWWStringinsert (size_t pos, const wchar_t *str)
 
RWWStringinsert (size_t pos, const wchar_t *str, size_t len)
 
RWWStringinsert (size_t pos, wchar_t c, size_t count)
 
bool isAscii () const
 
bool isNull () const
 
size_t last (const wchar_t *str) const
 
size_t last (const wchar_t *str, size_t len) const
 
size_t last (wchar_t c) const
 
size_t last (wchar_t c, size_t) 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+= (const RWWString &str)
 
RWWStringoperator+= (const std::wstring &str)
 
RWWStringoperator+= (const wchar_t *str)
 
RWWStringoperator+= (wchar_t c)
 
bool operator< (const RWWString &rhs) const
 
RWWStringoperator= (const ConstSubString &str)
 
RWWStringoperator= (const RWWString &str)
 
RWWStringoperator= (const std::wstring &str)
 
RWWStringoperator= (const SubString &str)
 
RWWStringoperator= (const wchar_t *str)
 
RWWStringoperator= (RWWString &&str)
 
RWWStringoperator= (wchar_t c)
 
bool operator== (const RWWString &rhs) const
 
bool operator> (const RWWString &rhs) const
 
wchar_t & operator[] (int i)
 
wchar_t operator[] (int i) const
 
wchar_t & operator[] (long i)
 
wchar_t operator[] (long i) const
 
wchar_t & operator[] (long long i)
 
wchar_t operator[] (long long i) const
 
wchar_t & operator[] (short i)
 
wchar_t operator[] (short i) const
 
wchar_t & operator[] (unsigned int i)
 
wchar_t operator[] (unsigned int i) const
 
wchar_t & operator[] (unsigned long i)
 
wchar_t operator[] (unsigned long i) const
 
wchar_t & operator[] (unsigned long long i)
 
wchar_t operator[] (unsigned long long i) const
 
wchar_t & operator[] (unsigned short i)
 
wchar_t operator[] (unsigned short i) const
 
RWWStringprepend (const RWWString &str)
 
RWWStringprepend (const RWWString &str, size_t len)
 
RWWStringprepend (const std::wstring &str)
 
RWWStringprepend (const std::wstring &str, size_t len)
 
RWWStringprepend (const wchar_t *str)
 
RWWStringprepend (const wchar_t *str, size_t len)
 
RWWStringprepend (wchar_t c, size_t count=1)
 
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 RWWString &str)
 
RWWStringreplace (size_t pos, size_t len, const RWWString &str, size_t strLen)
 
RWWStringreplace (size_t pos, size_t len, const std::wstring &str)
 
RWWStringreplace (size_t pos, size_t len, const std::wstring &str, size_t strLen)
 
RWWStringreplace (size_t pos, size_t len, const wchar_t *str)
 
RWWStringreplace (size_t pos, size_t len, const wchar_t *str, size_t strLen)
 
void resize (size_t len)
 
size_t rindex (const RWWString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const RWWString &pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const std::wstring &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const std::wstring &pat, size_t patlen, size_t end, caseCompare cmp) const
 
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 wchar_t *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)
 

Friends

class RWWConstSubString
 
class RWWSubString
 
class RWWTokenizer
 

Related Symbols

(Note that these are not member symbols.)

bool operator!= (const RWWConstSubString &lhs, const RWWString &rhs)
 
bool operator!= (const RWWString &lhs, const RWWConstSubString &rhs)
 
bool operator!= (const RWWString &lhs, const RWWSubString &rhs)
 
bool operator!= (const RWWString &lhs, const std::wstring &rhs)
 
bool operator!= (const RWWString &lhs, const wchar_t *rhs)
 
bool operator!= (const RWWSubString &lhs, const RWWString &rhs)
 
bool operator!= (const std::wstring &lhs, const RWWString &rhs)
 
bool operator!= (const wchar_t *lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const std::wstring &rhs)
 
RWWString operator+ (const RWWConstSubString &lhs, const wchar_t *rhs)
 
RWWString 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 RWWString &lhs, const std::wstring &rhs)
 
RWWString operator+ (const RWWString &lhs, const wchar_t *rhs)
 
RWWString operator+ (const RWWSubString &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const RWWString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const std::wstring &rhs)
 
RWWString operator+ (const RWWSubString &lhs, const wchar_t *rhs)
 
RWWString operator+ (const std::wstring &lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const std::wstring &lhs, const RWWString &rhs)
 
RWWString operator+ (const std::wstring &lhs, const RWWSubString &rhs)
 
RWWString operator+ (const wchar_t *lhs, const RWWConstSubString &rhs)
 
RWWString operator+ (const wchar_t *lhs, const RWWString &rhs)
 
RWWString operator+ (const wchar_t *lhs, const RWWSubString &rhs)
 
bool operator< (const RWWString &lhs, const std::wstring &rhs)
 
bool operator< (const RWWString &lhs, const wchar_t *rhs)
 
bool operator< (const std::wstring &lhs, const RWWString &rhs)
 
bool operator< (const wchar_t *lhs, const RWWString &rhs)
 
RWFileoperator<< (RWFile &file, const RWWString &str)
 
RWvostreamoperator<< (RWvostream &vos, const RWWString &str)
 
std::ostream & operator<< (std::ostream &os, const RWWString &s)
 
std::wostream & operator<< (std::wostream &os, const RWWString &str)
 
bool operator<= (const RWWString &lhs, const std::wstring &rhs)
 
bool operator<= (const RWWString &lhs, const wchar_t *rhs)
 
bool operator<= (const RWWString &rhs) const
 
bool operator<= (const std::wstring &lhs, const RWWString &rhs)
 
bool operator<= (const wchar_t *lhs, const RWWString &rhs)
 
bool operator== (const RWWConstSubString &lhs, const RWWString &rhs)
 
bool operator== (const RWWString &lhs, const RWWConstSubString &rhs)
 
bool operator== (const RWWString &lhs, const RWWSubString &rhs)
 
bool operator== (const RWWString &lhs, const std::wstring &rhs)
 
bool operator== (const RWWString &lhs, const wchar_t *rhs)
 
bool operator== (const RWWSubString &lhs, const RWWString &rhs)
 
bool operator== (const std::wstring &lhs, const RWWString &rhs)
 
bool operator== (const wchar_t *lhs, const RWWString &rhs)
 
bool operator> (const RWWString &lhs, const std::wstring &rhs)
 
bool operator> (const RWWString &lhs, const wchar_t *rhs)
 
bool operator> (const std::wstring &lhs, const RWWString &rhs)
 
bool operator> (const wchar_t *lhs, const RWWString &rhs)
 
bool operator>= (const RWWString &lhs, const std::wstring &rhs)
 
bool operator>= (const RWWString &lhs, const wchar_t *rhs)
 
bool operator>= (const RWWString &rhs) const
 
bool operator>= (const std::wstring &lhs, const RWWString &rhs)
 
bool operator>= (const wchar_t *lhs, const RWWString &rhs)
 
RWFileoperator>> (RWFile &file, RWWString &cstr)
 
RWvistreamoperator>> (RWvistream &str, RWWString &cstr)
 
std::istream & operator>> (std::istream &s, RWWString &str)
 
RWWString strXForm (const RWWString &str)
 
RWWString strXForm (const std::wstring &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>
Offers powerful and convenient facilities for manipulating wide character strings.
Definition stdwstring.h:784
Persistence
Simple
Example
#include <rw/wstring.h>
#include <iostream>
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;
}
SubString subString(const wchar_t *pat, size_t start=0, caseCompare cmp=exact)

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

◆ ConstSubString

The immutable substring class associated with RWWString.

◆ SubString

The mutable substring class associated with RWWString.

Member Enumeration Documentation

◆ ascii_

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

Enumerator
ascii 

Convert from US-ASCII

◆ caseCompare

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.

◆ multiByte_

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

Enumerator
multiByte 

Convert from multibyte

◆ stripType

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() [1/21]

RWWString::RWWString ( )
inline

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

◆ RWWString() [2/21]

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

Constructs a string with data copied from str.

◆ RWWString() [3/21]

RWWString::RWWString ( const RWWString & str)
inline

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

◆ RWWString() [4/21]

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() [5/21]

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() [6/21]

RWWString::RWWString ( wchar_t c)
inline

Constructs a string containing the single character c.

◆ RWWString() [7/21]

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

Constructs a string containing the character c repeated count times.

◆ RWWString() [8/21]

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() [9/21]

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() [10/21]

RWWString::RWWString ( char c)
inline

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

◆ RWWString() [11/21]

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() [12/21]

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() [13/21]

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() [14/21]

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);
@ ascii
Definition stdwstring.h:855

◆ RWWString() [15/21]

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() [16/21]

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);
@ multiByte
Definition stdwstring.h:878

◆ RWWString() [17/21]

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() [18/21]

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() [19/21]

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() [20/21]

RWWString::RWWString ( const SubString & str)
inline

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

◆ RWWString() [21/21]

RWWString::RWWString ( const ConstSubString & str)
inline

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

Member Function Documentation

◆ append() [1/7]

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

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

◆ append() [2/7]

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.

◆ append() [3/7]

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

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

◆ append() [4/7]

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.

◆ append() [5/7]

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.

◆ append() [6/7]

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.

◆ append() [7/7]

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.

◆ assign() [1/7]

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.

◆ assign() [2/7]

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.

◆ assign() [3/7]

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.

◆ assign() [4/7]

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.

◆ assign() [5/7]

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.

◆ assign() [6/7]

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.

◆ assign() [7/7]

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.

◆ binaryStoreSize()

RWspace RWWString::binaryStoreSize ( ) const
inline

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

Represents an abstraction of a filesystem regular file.
Definition rwfile.h:68
std::ostream & operator<<(std::ostream &os, const RWWString &s)
Abstract base class that provides an interface for format-dependent storage of fundamental types and ...
Definition vstream.h:749

◆ capacity() [1/2]

size_t RWWString::capacity ( ) const
inline

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

◆ capacity() [2/2]

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.

◆ collate() [1/3]

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.

◆ collate() [2/3]

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.

◆ collate() [3/3]

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.

◆ compareTo() [1/5]

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.

◆ compareTo() [2/5]

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

This function is the equivalent of calling:

int compareTo(const RWWString &str, caseCompare cmp=exact) const
Definition stdwstring.h:3138

◆ compareTo() [3/5]

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.

◆ compareTo() [4/5]

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

This function is the equivalent of calling:

◆ compareTo() [5/5]

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.

◆ contains() [1/3]

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

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

◆ contains() [2/3]

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.

◆ contains() [3/3]

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.

◆ data()

const wchar_t * RWWString::data ( ) 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.

◆ first() [1/4]

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.

◆ first() [2/4]

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.

◆ first() [3/4]

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.

◆ first() [4/4]

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

◆ fromAscii()

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

Equivalent to calling:

RWWString()
Definition stdwstring.h:918

◆ fromMultiByte()

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

Equivalent to calling:

◆ hash() [1/2]

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

Returns a suitable hash value.

◆ hash() [2/2]

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.

◆ index() [1/6]

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.

◆ index() [2/6]

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.

◆ index() [3/6]

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.

◆ index() [4/6]

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.

◆ index() [5/6]

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.

◆ index() [6/6]

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.

◆ initialCapacity()

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.

◆ insert() [1/7]

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.

◆ insert() [2/7]

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.

◆ insert() [3/7]

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.

◆ insert() [4/7]

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.

◆ insert() [5/7]

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.

◆ insert() [6/7]

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.

◆ insert() [7/7]

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.

◆ isAscii()

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).

◆ isNull()

bool RWWString::isNull ( ) const
inline

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

◆ last() [1/4]

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.

◆ last() [2/4]

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.

◆ last() [3/4]

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.

◆ last() [4/4]

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

◆ length()

size_t RWWString::length ( ) const
inline

Returns the number of characters in self.

◆ maxWaste()

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.

◆ operator const wchar_t *()

RWWString::operator const wchar_t * ( ) const
inline

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

◆ operator!=()

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

The equivalent of calling:

!(*this == rhs)

◆ operator()() [1/4]

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.

◆ operator()() [2/4]

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.

◆ operator()() [3/4]

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.

◆ operator()() [4/4]

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.

◆ operator+=() [1/4]

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

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

◆ operator+=() [2/4]

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

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

◆ operator+=() [3/4]

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.

◆ operator+=() [4/4]

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

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

◆ operator<()

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.

◆ operator=() [1/7]

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.

◆ operator=() [2/7]

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

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

◆ operator=() [3/7]

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

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

◆ operator=() [4/7]

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.

◆ operator=() [5/7]

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.

◆ operator=() [6/7]

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.

◆ operator=() [7/7]

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

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

◆ operator==()

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.

◆ operator>()

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

The equivalent of calling:

!(rhs < *this)

◆ operator[]() [1/16]

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.

◆ operator[]() [2/16]

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.

◆ operator[]() [3/16]

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.

◆ operator[]() [4/16]

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.

◆ operator[]() [5/16]

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.

◆ operator[]() [6/16]

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.

◆ operator[]() [7/16]

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.

◆ operator[]() [8/16]

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.

◆ operator[]() [9/16]

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.

◆ operator[]() [10/16]

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.

◆ operator[]() [11/16]

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.

◆ operator[]() [12/16]

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.

◆ operator[]() [13/16]

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.

◆ operator[]() [14/16]

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.

◆ operator[]() [15/16]

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.

◆ operator[]() [16/16]

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.

◆ prepend() [1/7]

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

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

◆ prepend() [2/7]

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.

◆ prepend() [3/7]

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

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

◆ prepend() [4/7]

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.

◆ prepend() [5/7]

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.

◆ prepend() [6/7]

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.

◆ prepend() [7/7]

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

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

◆ readFile()

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.

◆ readLine()

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.

◆ readString()

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.

◆ readToDelim() [1/2]

std::istream & RWWString::readToDelim ( std::istream & strm)
inline

The equivalent of calling:

std::istream & readToDelim(std::istream &strm)
Definition stdwstring.h:2031

◆ readToDelim() [2/2]

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.

◆ readToken() [1/2]

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.

◆ readToken() [2/2]

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().

◆ remove() [1/2]

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.

◆ remove() [2/2]

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.

◆ replace() [1/6]

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.

◆ replace() [2/6]

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.

◆ replace() [3/6]

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.

◆ replace() [4/6]

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.

◆ replace() [5/6]

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.

◆ replace() [6/6]

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.

◆ resize()

void RWWString::resize ( size_t len)
inline

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

◆ resizeIncrement()

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.

◆ rindex() [1/7]

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

◆ rindex() [2/7]

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

◆ rindex() [3/7]

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

◆ rindex() [4/7]

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

◆ rindex() [5/7]

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

◆ rindex() [6/7]

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

◆ rindex() [7/7]

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

◆ std() [1/2]

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

◆ std() [2/2]

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

◆ strip() [1/2]

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.

◆ strip() [2/2]

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() [1/2]

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.

◆ subString() [2/2]

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.

◆ swap()

void RWWString::swap ( RWWString & str)
inline

Swaps the contents of str with self.

◆ toAscii()

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.

◆ toLower()

void RWWString::toLower ( )
inline

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

◆ toMultiByte()

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).

◆ toUpper()

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 Symbol Documentation

◆ operator!=() [1/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [2/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [3/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [4/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [5/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [6/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [7/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [8/8]

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

The equivalent of calling:

!(lhs == rhs)

◆ operator+() [1/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [2/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [3/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [4/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [5/21]

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.

◆ operator+() [6/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [7/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [8/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [9/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [10/21]

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.

◆ operator+() [11/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [12/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [13/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [14/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [15/21]

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.

◆ operator+() [16/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [17/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [18/21]

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

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [19/21]

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.

◆ operator+() [20/21]

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.

◆ operator+() [21/21]

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.

◆ operator<() [1/4]

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.

◆ operator<() [2/4]

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.

◆ operator<() [3/4]

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.

◆ operator<() [4/4]

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.

◆ operator<<() [1/4]

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

Saves string str to an RWFile.

◆ operator<<() [2/4]

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

Saves string str to a virtual stream.

◆ operator<<() [3/4]

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.

◆ operator<<() [4/4]

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

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

◆ operator<=() [1/5]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [2/5]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [3/5]

bool operator<= ( const RWWString & rhs) const
related

The equivalent of calling:

!(rhs < *this)

◆ operator<=() [4/5]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [5/5]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator==() [1/8]

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.

◆ operator==() [2/8]

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.

◆ operator==() [3/8]

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.

◆ operator==() [4/8]

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.

◆ operator==() [5/8]

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.

◆ operator==() [6/8]

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.

◆ operator==() [7/8]

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.

◆ operator==() [8/8]

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.

◆ operator>() [1/4]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [2/4]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [3/4]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [4/4]

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

The equivalent of calling:

!(rhs < lhs)

◆ operator>=() [1/5]

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

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [2/5]

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

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [3/5]

bool operator>= ( const RWWString & rhs) const
related

The equivalent of calling:

!(*this < rhs)

◆ operator>=() [4/5]

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

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [5/5]

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

The equivalent of calling:

!(lhs < rhs)

◆ operator>>() [1/3]

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.

◆ operator>>() [2/3]

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.

◆ operator>>() [3/3]

std::istream & operator>> ( std::istream & s,
RWWString & str )
related

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

◆ strXForm() [1/2]

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.

◆ strXForm() [2/2]

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

◆ toLower()

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();

◆ toUpper()

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.