Tools.h++ Manual

104011 Tandem Computers Incorporated 21-219
21
Assignment operators
void operator=(const RWWString&);
Assignment to a
RWWString
. The statements:
RWWString a;
RWWString b;
...
b(2, 3) = a;
will copy a’s data into the substring b(2,3). The number of elements need not
match: if they differ, b will be resized appropriately. If self is the null
substring, then the statement has no effect.
void operator=(const wchar_t*);
Assignment from a wide character string. Example:
RWWString a(L"Mary had a little lamb");
wchar_t dat[] = L"Perrier";
a(11,4) = dat; // "Mary had a Perrier"
Note – the number of characters selected need not match: if they differ, a will
be resized appropriately. If self is the null substring, then the statement has no
effect.
Indexing operators
wchar_t operator[](size_t i);
cchar_t& operator[](size_t i) const;
Returns the i’th character of the substring. The first variant can be used as an
lvalue, the second cannot. The index i must be between zero and the length of
the substring, less one. Bounds checking is performed: if the index is out of
range, then an exception of type
RWBoundsErr
will be thrown.
wchar_t operator()(size_t i);
wchar_t& operator()(size_t i) const;
Returns the i’th character of the substring. The first variant can be used as an
lvalue, the second cannot. The index i must be between zero and the length of
the substring, less one. Bounds checking is enabled by defining the pre-
processor macro
RWBOUNDS_CHECK
before including <
rw/wstring.h
>. In
this case, if the index is out of range, then an exception of type
RWBoundsErr
will be thrown.
Public member functions
RWBoolean isNull() const;
Returns
TRUE
if this is a null substring.