Tools.h++ Class Reference

Table Of Contents
macro RWBOUNDS_CHECK has been defined before including <rw/cstring.h>. In this
case, if the index is out of range, then an exception of type RWBoundsErr will occur.
RWCSubString
operator()(size_t start, size_t len);
const RWCSubString
operator()(size_t start, size_t len) const;
Substring operator. Returns an RWCSubString of self with length len, starting at index
start. The first variant can be used as an lvalue. The sum of start plus len must be less than
or equal to the string length. If the library was built using the RWDEBUG flag, and start
and len are out of range, then an exception of type RWBoundsErr will occur.
RWCSubString
operator()(const RWCRExpr& re, size_t start=0);
const RWCSubString
operator()(const RWCRExpr& re, size_t start=0) const;
RWCSubString
operator()(const RWCRegexp& re, size_t start=0);
const RWCSubString
operator()(const RWCRegexp& re, size_t start=0) const;
Returns the first substring starting after index start that matches the regular expression re.
If there is no such substring, then the null substring is returned. The first variant can be
used as an lvalue.
Note that if you wish to use operator()(const RWCRExpr&...) you must instead use
match(const RWCRExpr&...) described below. The reason for this is that we are presently
retaining RWCRegexp but operator(const RWCRExpr&...) and operator(const
RWCRegexp) are ambiguous in the case of RWCString::operator("string"). In addition,
operator(const char *) and operator(size_t) are ambiguous in the case of
RWCString::operator(0). This function maybe incompatible with strings with embedded
nulls. This function is incompatible with MBCS strings.
Public Member Functions
RWCString&
append(const char* cs);
Append a copy of the null-terminated character string pointed to by cs to self. Returns a
reference to self. This function is incompatible with cs strings with embedded nulls. This
function may be incompatible with cs MBCS strings.
RWCString&
append(const char* cs, size_t N);
Append a copy of the character string cs to self. Exactly N bytes are copied, including any
embedded nulls. Hence, the buffer pointed to by cs must be at least N bytes long. Returns
a reference to self.