Tools.h++ Manual

21-86 104011 Tandem Computers Incorporated
21
Assignment operators
void operator=(const RWCString&);
Assignment to a
RWCString
. The statements:
RWCString a;
RWCString 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 char*)
;
Assignment from a character string. Example:
RWCString a("Mary had a lamb");
char dat[] = "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
char operator[](size_t i);
char& 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 occur.
char operator()(size_t i);
char& 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/cstring.h>
. In
this case, if the index is out of range, then an exception of type
RWBoundsErr
will occur.
Public member functions
RWBoolean isNull() const;
Returns
TRUE
if this is a null substring.