rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWCollectableWString Class Reference
[RWCollectable-derived]

Provides a polymorphically persistable RWWString. More...

#include <rw/collstr.h>

Inheritance diagram for RWCollectableWString:
RWCollectable RWWString

List of all members.

Public Member Functions

virtual RWCollectablenewSpecies () const
virtual RWClassID isA () const
 RWCollectableWString ()
 RWCollectableWString (const RWCollectableWString &str)
 RWCollectableWString (RWCollectableWString &&str)
 RWCollectableWString (const wchar_t *a)
 RWCollectableWString (const wchar_t *a, size_t N)
 RWCollectableWString (wchar_t c, size_t N)
 RWCollectableWString (const RWWString &s)
 RWCollectableWString (const RWWSubString &s)
virtual ~RWCollectableWString ()
RWCollectableWStringoperator= (const RWCollectableWString &str)
RWCollectableWStringoperator= (RWCollectableWString &&str)
virtual RWspace binaryStoreSize () const
virtual int compareTo (const RWCollectable *c) const
virtual int compareTo (const RWCollectableWString &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 wchar_t *, caseCompare cmp=exact) const
int compareTo (const RWWString &, caseCompare cmp=exact) const
unsigned hash (caseCompare) const

Static Public Member Functions

static RWClassID classIsA ()
static unsigned hash (const RWWString &)

Detailed Description

Collectable wide strings paralleling RWCollectableString. This class is useful when wide strings are stored and retrieved as RWCollectables, or when they are used as keys in the "dictionary" collection classes. Class RWCollectableWString inherits from both class RWWString and class RWCollectable.

The virtual functions of the base class RWCollectable have been redefined.

Note:
Encodings used by operating systems for wchar_t strings may vary. If your application is dependent on the presence of encodings across different operating systems, you need to ensure that it supports the desired formats.

Synopsis

 #include <rw/collstr.h>
 RWCollectableWString  c;

Persistence

Polymorphic


Constructor & Destructor Documentation

RWCollectableWString::RWCollectableWString (  ) 

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

RWCollectableWString::RWCollectableWString ( const RWCollectableWString str  )  [inline]

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

RWCollectableWString::RWCollectableWString ( RWCollectableWString &&  str  )  [inline]

Move constructor. The created collectable string takes ownership of the data owned by str.

Condition:
This method is only available on platforms with rvalue reference support.
RWCollectableWString::RWCollectableWString ( const wchar_t *  a  )  [inline]

Creates a string from the wide character string a. The created string copies the data pointed to by a, up to the first terminating null.

RWCollectableWString::RWCollectableWString ( const wchar_t *  a,
size_t  N 
) [inline]

Constructs a string from the character string a. The created string copies the data pointed to by a. Exactly N characters are copied, including any embedded nulls. Hence, the buffer pointed to by a must be at least N * sizeof(wchar_t) bytes or N wide characters long.

RWCollectableWString::RWCollectableWString ( wchar_t  c,
size_t  N 
) [inline]

Constructs a string containing the character c repeated N times.

RWCollectableWString::RWCollectableWString ( const RWWString s  )  [inline]

Constructs an RWCollectableWString from the RWWString s by copying data from s.

RWCollectableWString::RWCollectableWString ( const RWWSubString s  )  [inline]

Converts from sub-string. The created string copies the substring represented by s.

virtual RWCollectableWString::~RWCollectableWString (  )  [virtual]

Empty destructor.


Member Function Documentation

virtual RWspace RWCollectableWString::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 RWCollectableWString::classIsA (  )  [static]

Returns the RWClassID of this class.

Reimplemented from RWCollectable.

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

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0self precedes str.
0self is equal to str.
>0self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Reimplemented from RWWString.

int RWCollectableWString::compareTo ( const wchar_t *  str,
caseCompare  cmp = exact 
) const

Lexicographically compares self to str. Returns the following values based on the results of the comparison:
<0self precedes str.
0self is equal to str.
>0self 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.

Reimplemented from RWWString.

virtual int RWCollectableWString::compareTo ( const RWCollectableWString c  )  const [inline, virtual]

Redefined from class RWCollectable. Returns the result of RWWString::compareTo(*(constString*)c, RWWString::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 RWCollectableWStrings and 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 RWCollectableWString::compareTo ( const RWCollectable c  )  const [virtual]

Redefined from class RWCollectable. Returns the result of RWWString::compareTo(*(constString*)c, RWWString::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 RWCollectableWStrings and 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 RWCollectableWString::hash ( const RWWString wstr  )  [static]

Returns the hash value of str as returned by hash(caseCompare) const, where caseCompare is RWWString::exact.

Reimplemented from RWWString.

unsigned RWCollectableWString::hash ( caseCompare  cmp  )  const

Returns a suitable hash value.

Reimplemented from RWWString.

virtual unsigned RWCollectableWString::hash (  )  const [virtual]

Calls RWWString::hash() and returns the results.

Reimplemented from RWCollectable.

virtual RWClassID RWCollectableWString::isA (  )  const [virtual]

Returns the unique ID for RWCollectableWString.

Reimplemented from RWCollectable.

virtual bool RWCollectableWString::isEqual ( const RWCollectable c  )  const [virtual]

Calls RWWString::operator==() (i.e., the equivalence operator) with c as the argument and returns the results.

Reimplemented from RWCollectable.

virtual RWCollectable* RWCollectableWString::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.

RWCollectableWString& RWCollectableWString::operator= ( RWCollectableWString &&  str  )  [inline]

Move assignment. Self takes ownership of the data owned by str.

Condition:
This method is only available on platforms with rvalue reference support.
RWCollectableWString& RWCollectableWString::operator= ( const RWCollectableWString str  )  [inline]

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

virtual void RWCollectableWString::restoreGuts ( RWFile  )  [virtual]

Reads an object's state from a binary file, using class RWFile, replacing the previous state.

Reimplemented from RWCollectable.

virtual void RWCollectableWString::restoreGuts ( RWvistream  )  [virtual]

Reads an object's state from an input stream, replacing the previous state.

Reimplemented from RWCollectable.

virtual void RWCollectableWString::saveGuts ( RWFile  )  const [virtual]

Writes an object's state to a binary file, using class RWFile.

Reimplemented from RWCollectable.

virtual void RWCollectableWString::saveGuts ( RWvostream  )  const [virtual]

Writes an object's state to an output stream.

Reimplemented from RWCollectable.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

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