SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Provides a polymorphically persistable RWCString. More...
#include <rw/collstr.h>
Public Member Functions | |
virtual RWCollectable * | newSpecies () const |
virtual RWClassID | isA () const |
RWCollectableString () | |
RWCollectableString (const RWCollectableString &str) | |
RWCollectableString (RWCollectableString &&str) | |
RWCollectableString (const char *c) | |
RWCollectableString (const char *a, size_t N) | |
RWCollectableString (char c, size_t N) | |
RWCollectableString (const RWCString &s) | |
RWCollectableString (const RWCSubString &s) | |
virtual | ~RWCollectableString () |
RWCollectableString & | operator= (const RWCollectableString &str) |
RWCollectableString & | operator= (RWCollectableString &&str) |
virtual RWspace | binaryStoreSize () const |
virtual int | compareTo (const RWCollectable *c) const |
virtual int | compareTo (const RWCollectableString &c) const |
virtual unsigned | hash () const |
virtual bool | isEqual (const RWCollectable *c) const |
virtual void | restoreGuts (RWvistream &) |
virtual void | restoreGuts (RWFile &) |
virtual void | saveGuts (RWvostream &) const |
virtual void | saveGuts (RWFile &) const |
int | compareTo (const char *, caseCompare cmp=exact) const |
int | compareTo (const RWCString &, caseCompare cmp=exact) const |
unsigned | hash (caseCompare) const |
Static Public Member Functions | |
static RWClassID | classIsA () |
static unsigned | hash (const RWCString &) |
Collectable strings. This class is useful when strings are stored and retrieved as RWCollectable instances, or when they are used as keys in the "dictionary" collection classes. Class RWCollectableString inherits from both class RWCString and class RWCollectable.
The virtual functions of the base class RWCollectable have been redefined.
typedef RWCollectableString String; // Smalltalk typedef #include <rw/collstr.h> RWCollectableString c;
Polymorphic
RWCollectableString::RWCollectableString | ( | ) |
Creates a string of length zero (the null string).
RWCollectableString::RWCollectableString | ( | const RWCollectableString & | str | ) | [inline] |
Copy constructor. The created string copies the data from str.
RWCollectableString::RWCollectableString | ( | RWCollectableString && | str | ) | [inline] |
Move constructor. The created collectable string takes ownership of the data owned by str.
RWCollectableString::RWCollectableString | ( | const char * | c | ) | [inline] |
Converts from the null-terminated character string c. The created string copies the data pointed to by c, up to the first terminating null. This function is incompatible with c strings with embedded nulls. This function may be incompatible with c MBCS strings.
RWCollectableString::RWCollectableString | ( | const char * | a, | |
size_t | N | |||
) | [inline] |
Constructs an RWCollectableString from the character string a. The created string copies the data pointed to by a. Exactly N bytes are copied, including any embedded nulls. Hence, the buffer pointed to by a must be at least N bytes long.
RWCollectableString::RWCollectableString | ( | char | c, | |
size_t | N | |||
) | [inline] |
Constructs an RWCollectableString containing the character c repeated N times.
RWCollectableString::RWCollectableString | ( | const RWCString & | s | ) | [inline] |
Constructs an RWCollectableString from the RWCString s by copying data from s.
RWCollectableString::RWCollectableString | ( | const RWCSubString & | s | ) | [inline] |
Converts from a sub-string. The created string copies the substring represented by s.
virtual RWCollectableString::~RWCollectableString | ( | ) | [virtual] |
Empty destructor.
virtual RWspace RWCollectableString::binaryStoreSize | ( | ) | const [inline, virtual] |
Returns the number of bytes used by the virtual function saveGuts(RWFile&) to store an object. Typically, this involves adding up the space required to store all primitives, plus the results of calling recursiveStoreSize() for all objects inheriting from RWCollectable. See the Essential Tools Module User's Guide for details.
Reimplemented from RWCollectable.
static RWClassID RWCollectableString::classIsA | ( | ) | [static] |
Returns the RWClassID of this class.
Reimplemented from RWCollectable.
int RWCollectableString::compareTo | ( | const RWCString & | str, | |
caseCompare | cmp = exact | |||
) | const |
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.
Reimplemented from RWCString.
int RWCollectableString::compareTo | ( | const char * | str, | |
caseCompare | cmp = exact | |||
) | const |
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. |
Reimplemented from RWCString.
virtual int RWCollectableString::compareTo | ( | const RWCollectableString & | c | ) | const [inline, virtual] |
Returns the result of RWCString::compareTo(*(const String*)c, RWCString::exact). This compares strings lexicographically, with case considered. It would be possible to define, for instance, CaseFoldedString
which did comparisons ignoring case. We have deliberately left this as an exercise for two reasons: Because it is both easy to do and not universally needed; and because the presence of both RWCollectableStrings and such a CaseFoldedString
in any kind of sorted collection has the potential for very confusing behavior, since the result of a comparison would depend on the order in which the comparison was done.
virtual int RWCollectableString::compareTo | ( | const RWCollectable * | c | ) | const [virtual] |
Returns the result of RWCString::compareTo(*(const String*)c, RWCString::exact). This compares strings lexicographically, with case considered. It would be possible to define, for instance, CaseFoldedString
which did comparisons ignoring case. We have deliberately left this as an exercise for two reasons: Because it is both easy to do and not universally needed; and because the presence of both RWCollectableStrings and such a CaseFoldedString
in any kind of sorted collection has the potential for very confusing behavior, since the result of a comparison would depend on the order in which the comparison was done.
Reimplemented from RWCollectable.
static unsigned RWCollectableString::hash | ( | const RWCString & | str | ) | [static] |
Returns the hash value of str as returned by hash(caseCompare) const, where caseCompare is RWCString::exact.
Reimplemented from RWCString.
unsigned RWCollectableString::hash | ( | caseCompare | cmp | ) | const |
Returns a suitable hash value.
Reimplemented from RWCString.
virtual unsigned RWCollectableString::hash | ( | ) | const [virtual] |
Calls RWCString::hash() and returns the results.
Reimplemented from RWCollectable.
virtual RWClassID RWCollectableString::isA | ( | ) | const [virtual] |
Returns the unique ID for RWCollectableString.
Reimplemented from RWCollectable.
virtual bool RWCollectableString::isEqual | ( | const RWCollectable * | c | ) | const [virtual] |
Calls RWCString::operator==() (i.e., the equivalence operator) with c as the argument and returns the results.
Reimplemented from RWCollectable.
virtual RWCollectable* RWCollectableString::newSpecies | ( | ) | const [virtual] |
Allocates a new object off the heap of the same type as self and returns a pointer to it. You are responsible for deleting the object when done with it.
Reimplemented from RWCollectable.
RWCollectableString& RWCollectableString::operator= | ( | RWCollectableString && | str | ) | [inline] |
Move assignment. Self takes ownership of the data owned by str.
RWCollectableString& RWCollectableString::operator= | ( | const RWCollectableString & | str | ) | [inline] |
Assignment operator. The string copies the data from str. Returns a reference to self.
virtual void RWCollectableString::restoreGuts | ( | RWFile & | ) | [virtual] |
Reads an object's state from a binary file, using class RWFile, replacing the previous state.
Reimplemented from RWCollectable.
virtual void RWCollectableString::restoreGuts | ( | RWvistream & | ) | [virtual] |
Reads an object's state from an input stream, replacing the previous state.
Reimplemented from RWCollectable.
virtual void RWCollectableString::saveGuts | ( | RWFile & | ) | const [virtual] |
Writes an object's state to a binary file, using class RWFile.
Reimplemented from RWCollectable.
virtual void RWCollectableString::saveGuts | ( | RWvostream & | ) | const [virtual] |
Writes an object's state to an output stream.
Reimplemented from RWCollectable.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.