SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Encapsulates a string name in a reference-counted handle-body pattern. More...
#include <rw/types/RWSymbol.h>
Public Member Functions | |
RWSymbol () | |
RWSymbol (const char *name) | |
RWSymbol (const RWSymbol &sym) | |
RWSymbol (const wchar_t *name) | |
~RWSymbol () | |
RWCString | asAsciiString () const |
RWWString | asWCharString () const |
int | collate (const RWSymbol &rhs) const |
unsigned | hash () const |
bool | isBound () const |
bool | operator< (const RWSymbol &rhs) const |
RWSymbol & | operator= (const RWSymbol &sym) |
Public Member Functions inherited from RWHandleBase | |
bool | isValid (void) const |
bool | operator!= (const RWHandleBase &second) const |
bool | operator== (const RWHandleBase &second) const |
Static Public Member Functions | |
static RWSymbol | genSymbol (const RWCString &prefix) |
static RWSymbol | genSymbol (const RWWString &prefix=L"G") |
static unsigned | hash (const RWSymbol &key) |
Friends | |
RWvostream & | operator<< (RWvostream &vstrm, const RWSymbol &sym) |
std::ostream & | operator<< (std::ostream &strm, const RWSymbol &sym) |
RWvistream & | operator>> (RWvistream &vstrm, RWSymbol &sym) |
std::istream & | operator>> (std::istream &strm, RWSymbol &sym) |
class | RWObjectInputStreamImp |
class | RWObjectOutputStreamImp |
Additional Inherited Members | |
Protected Member Functions inherited from RWHandleBase | |
RWHandleBase (const RWHandleBase &second) | |
RWHandleBase (RWBodyBase *body) | |
RWHandleBase (RWStaticCtor) | |
RWHandleBase (void) | |
~RWHandleBase (void) | |
RWBodyBase & | body (void) const |
RWHandleBase & | operator= (const RWHandleBase &second) |
Class RWSymbol is the only API class in the Types package.
It encapsulates a string name in a reference-counted handle-body pattern. Therefore, several RWSymbol objects can reference one string name, making storage space smaller, name memory management easier, and name comparisons faster.
The strings are stored internally as wide characters (wchar_t
). Members are provided to construct symbols from US-ASCII or wide characters.
RWSymbol objects can be streamed across the network, to files, and to standard input and output. The genSymbol() static member allows you to create unique symbols from a name.
RWSymbol inherits a highly efficient operator==() from RWHandleBase. RWHandleBase::operator==() returns true
or false
based on whether the two RWHandleBase objects point to the same body instance.
RWSymbol::RWSymbol | ( | ) |
Creates an empty or unbound RWSymbol.
RWSymbol::RWSymbol | ( | const char * | name | ) |
Creates a symbol for the string name. The string is treated as a sequence of US-ASCII characters and internally converted and stored as a sequence of wide characters. This constructor is not intended to be used with multibyte character strings (MBCS).
RWSymbol::RWSymbol | ( | const wchar_t * | name | ) |
Creates a symbol for the string name of wide characters.
RWSymbol::RWSymbol | ( | const RWSymbol & | sym | ) |
Copy constructor. Constructed object references the same string name as sym.
RWSymbol::~RWSymbol | ( | ) |
Destroys the symbol. If it is the last reference to a given name, the internal storage associated with it is deallocated.
RWCString RWSymbol::asAsciiString | ( | ) | const |
Converts the symbol's name from the internal wide character representation to US-ASCII and returns it as an RWCString.
int RWSymbol::collate | ( | const RWSymbol & | rhs | ) | const |
Returns an int
less than, greater than, or equal to zero, according to the result of calling the function "::wcscoll()"
on self and the symbol supplied as rhs. This supports locale-dependent collation.
Creates a new RWSymbol with a uniquely manufactured name. The symbol name consists of the US-ASCII prefix followed by an incremented process-global count.
Creates a new RWSymbol with a unique manufactured name. The symbol name consists of prefix followed by an incremented process-global count. The wide character prefix can be set. Therefore, by default, the first generated symbol would be G1, the second G2, and so on.
unsigned RWSymbol::hash | ( | ) | const |
Returns an unsigned value from the hash function for the symbol.
|
static |
Returns an unsigned from the hash function for the symbol.
bool RWSymbol::isBound | ( | ) | const |
Returns true
if the symbol has been bound to a name.
bool RWSymbol::operator< | ( | const RWSymbol & | rhs | ) | const |
Supplied for sorting of symbols. Compares address locations of string names referenced by self and rhs.
Assignment operator. The resulting object will reference the same string name as sym.
|
friend |
Streams a symbol sym into an RWvostream vstrm.
|
friend |
Streams a symbol sym, as US-ASCII, into an output stream strm.
|
friend |
Streams an RWvistream vstrm into a symbol sym.
|
friend |
Streams an input stream strm, as US-ASCII, into a symbol sym.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |