SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

An identifier for RWCollectable instances. More...

#include <rw/stringid.h>

Inheritance diagram for RWStringID:
RWCString

Public Member Functions

 RWStringID ()
 
 RWStringID (const char *name)
 
 RWStringID (const RWCString &s)
 
 RWStringID (const RWStringID &sid)
 
 RWStringID (RWCString &&s)
 
 RWStringID (RWStringID &&sid)
 
 ~RWStringID ()
 
RWspace binaryStoreSize () const
 
size_t capacity () const
 
size_t capacity (size_t N)
 
int collate (const char *cs) const
 
int collate (const RWCString &st) const
 
int compareTo (const char *cs, caseCompare cmp=exact) const
 
int compareTo (const RWCString &st, caseCompare cmp=exact) const
 
bool contains (const char *pat, caseCompare cmp=exact) const
 
bool contains (const RWCString &pat, caseCompare cmp=exact) const
 
const char * data () const
 
size_t first (char c) const
 
size_t first (const char *cs) const
 
size_t firstOf (char c, size_t pos=0) const
 
size_t firstOf (const char *str, size_t pos=0) const
 
unsigned hash () const
 
size_t index (const char *pat, size_t *ext, size_t i=0) const
 
size_t index (const char *pat, size_t i=0, caseCompare cmp=exact) const
 
size_t index (const char *pat, size_t patlen, size_t i, caseCompare cmp) const
 
size_t index (const RWCRegexp &pat, size_t *ext, size_t i=0) const
 
size_t index (const RWCRegexp &pat, size_t i=0) const
 
size_t index (const RWCRExpr &pat, size_t *ext, size_t i=0) const
 
size_t index (const RWCRExpr &pat, size_t i=0) const
 
size_t index (const RWCString &s, size_t i=0, caseCompare cmp=exact) const
 
size_t index (const RWCString &s, size_t patlen, size_t i, caseCompare cmp) const
 
bool isAscii () const
 
bool isNull () const
 
size_t last (char c) const
 
size_t last (char c, size_t) const
 
size_t lastOf (char c, size_t pos=RW_NPOS) const
 
size_t length () const
 
 operator const char * () const
 
char operator() (size_t t) const
 
RWStringIDoperator= (const RWCString &s)
 
RWStringIDoperator= (const RWStringID &sid)
 
RWStringIDoperator= (RWCString &&s)
 
RWStringIDoperator= (RWStringID &&sid)
 
char operator[] (size_t t) const
 
void swap (RWStringID &rhs)
 

Related Symbols

(Note that these are not member symbols.)

bool operator!= (const char *lhs, const RWStringID &rhs)
 
bool operator!= (const RWStringID &lhs, const char *rhs)
 
bool operator!= (const RWStringID &lhs, const RWStringID &rhs)
 
bool operator< (const RWStringID &lhs, const RWStringID &rhs)
 
RWFileoperator<< (RWFile &file, const RWStringID &sid)
 
RWvostreamoperator<< (RWvostream &vos, const RWStringID &sid)
 
std::ostream & operator<< (std::ostream &os, const RWStringID &sid)
 
bool operator<= (const RWStringID &lhs, const RWStringID &rhs)
 
bool operator== (const char *lhs, const RWStringID &rhs)
 
bool operator== (const RWStringID &lhs, const char *rhs)
 
bool operator== (const RWStringID &lhs, const RWStringID &rhs)
 
bool operator> (const RWStringID &lhs, const RWStringID &rhs)
 
bool operator>= (const RWStringID &lhs, const RWStringID &rhs)
 
RWFileoperator>> (RWFile &file, RWStringID &sid)
 
RWvistreamoperator>> (RWvistream &vis, RWStringID &sid)
 
std::istream & operator>> (std::istream &is, RWStringID &sid)
 

Additional Inherited Members

- Protected Types inherited from RWCString
enum  caseCompare { exact , ignoreCase , ignoreCaseStrict }
 
typedef RWCConstSubString ConstSubString
 
enum  scopeType { one , all }
 
enum  stripType { leading , trailing , both }
 
typedef RWCSubString SubString
 
- Protected Member Functions inherited from RWCString
 RWCString ()
 
 RWCString (char c)
 
 RWCString (char c, size_t count)
 
 RWCString (const char *str)
 
 RWCString (const char *str, size_t len)
 
 RWCString (const ConstSubString &str)
 
 RWCString (const RWCString &str)
 
 RWCString (const std::string &str)
 
 RWCString (const SubString &str)
 
 RWCString (RWCString &&str)
 
 RWCString (RWSize_T cap)
 
 RWCString (signed char c)
 
 RWCString (unsigned char c)
 
RWCStringappend (char c, size_t count=1)
 
RWCStringappend (const char *str)
 
RWCStringappend (const char *str, size_t len)
 
RWCStringappend (const ConstSubString &str)
 
RWCStringappend (const RWCString &str)
 
RWCStringappend (const RWCString &str, size_t len)
 
RWCStringappend (const std::string &str)
 
RWCStringappend (const std::string &str, size_t len)
 
RWCStringappend (const SubString &str)
 
RWCStringassign (char c, size_t count=1)
 
RWCStringassign (const char *str)
 
RWCStringassign (const char *str, size_t len)
 
RWCStringassign (const ConstSubString &str)
 
RWCStringassign (const RWCString &str)
 
RWCStringassign (const std::string &str)
 
RWCStringassign (const SubString &str)
 
RWspace binaryStoreSize () const
 
size_t capacity () const
 
size_t capacity (size_t cap)
 
int collate (const char *str) const
 
int collate (const RWCString &str) const
 
int collate (const std::string &str) const
 
int compareTo (const char *str, caseCompare cmp=exact) const
 
int compareTo (const char *str, size_t len, caseCompare cmp=exact) const
 
int compareTo (const ConstSubString &str, caseCompare cmp=exact) const
 
int compareTo (const RWCString &str, caseCompare cmp=exact) const
 
int compareTo (const RWCString *str, caseCompare cmp=exact) const
 
int compareTo (const std::string &str, caseCompare cmp=exact) const
 
int compareTo (const std::string *str, caseCompare cmp=exact) const
 
int compareTo (const SubString &str, caseCompare cmp=exact) const
 
bool contains (const char *str, caseCompare cmp=exact) const
 
bool contains (const char *str, size_t len, caseCompare cmp=exact) const
 
bool contains (const ConstSubString &str, caseCompare cmp=exact) const
 
bool contains (const RWCString &str, caseCompare cmp=exact) const
 
bool contains (const std::string &str, caseCompare cmp=exact) const
 
bool contains (const SubString &str, caseCompare cmp=exact) const
 
const char * data () const
 
size_t first (char c) const
 
size_t first (char c, size_t) const
 
size_t first (const char *str) const
 
size_t first (const char *str, size_t len) const
 
size_t firstNotOf (char c, size_t pos=0) const
 
size_t firstNotOf (const char *str, size_t pos, size_t len) const
 
size_t firstNotOf (const char *str, size_t pos=0) const
 
size_t firstNotOf (const ConstSubString &str, size_t pos=0) const
 
size_t firstNotOf (const RWCString &str, size_t pos=0) const
 
size_t firstNotOf (const std::string &str, size_t pos=0) const
 
size_t firstNotOf (const SubString &str, size_t pos=0) const
 
size_t firstOf (char c, size_t pos=0) const
 
size_t firstOf (const char *str, size_t pos, size_t len) const
 
size_t firstOf (const char *str, size_t pos=0) const
 
size_t firstOf (const ConstSubString &str, size_t pos=0) const
 
size_t firstOf (const RWCString &str, size_t pos=0) const
 
size_t firstOf (const std::string &str, size_t pos=0) const
 
size_t firstOf (const SubString &str, size_t pos=0) const
 
unsigned hash (caseCompare cmp=exact) const
 
size_t index (const char *pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const char *pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const char *re, size_t *ext, size_t start=0) const
 
size_t index (const char pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const ConstSubString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const RWCRegexp &re, size_t *ext, size_t start=0) const
 
size_t index (const RWCRegexp &re, size_t start=0) const
 
size_t index (const RWCRExpr &re, size_t *ext, size_t start=0) const
 
size_t index (const RWCRExpr &re, size_t start=0) const
 
size_t index (const RWCString &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const RWCString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const std::string &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const std::string &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const SubString &pat, size_t start=0, caseCompare cmp=exact) const
 
RWCStringinsert (size_t pos, char c, size_t count)
 
RWCStringinsert (size_t pos, const char *str)
 
RWCStringinsert (size_t pos, const char *str, size_t len)
 
RWCStringinsert (size_t pos, const ConstSubString &str)
 
RWCStringinsert (size_t pos, const RWCString &str)
 
RWCStringinsert (size_t pos, const RWCString &str, size_t len)
 
RWCStringinsert (size_t pos, const std::string &str)
 
RWCStringinsert (size_t pos, const std::string &str, size_t len)
 
RWCStringinsert (size_t pos, const SubString &str)
 
bool isAscii () const
 
bool isNull () const
 
size_t last (char c) const
 
size_t last (char c, size_t) const
 
size_t last (const char *str) const
 
size_t last (const char *str, size_t len) const
 
size_t lastNotOf (char c, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const char *str, size_t pos, size_t len) const
 
size_t lastNotOf (const char *str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const ConstSubString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const RWCString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const std::string &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const SubString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (char c, size_t pos=RW_NPOS) const
 
size_t lastOf (const char *str, size_t pos, size_t len) const
 
size_t lastOf (const char *str, size_t pos=RW_NPOS) const
 
size_t lastOf (const ConstSubString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const RWCString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const std::string &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const SubString &str, size_t pos=RW_NPOS) const
 
size_t length () const
 
ConstSubString match (const RWCRExpr &) const
 
SubString match (const RWCRExpr &re)
 
SubString match (const RWCRExpr &re, size_t start)
 
ConstSubString match (const RWCRExpr &re, size_t start) const
 
size_t mbLength () const
 
 operator const char * () const
 
SubString operator() (const RWCRegexp &re)
 
ConstSubString operator() (const RWCRegexp &re) const
 
SubString operator() (const RWCRegexp &re, size_t start)
 
ConstSubString operator() (const RWCRegexp &re, size_t start) const
 
char & operator() (size_t i)
 
char operator() (size_t i) const
 
SubString operator() (size_t start, size_t len)
 
ConstSubString operator() (size_t start, size_t len) const
 
RWCStringoperator+= (char c)
 
RWCStringoperator+= (const char *str)
 
RWCStringoperator+= (const ConstSubString &str)
 
RWCStringoperator+= (const RWCString &str)
 
RWCStringoperator+= (const std::string &str)
 
RWCStringoperator+= (const SubString &str)
 
RWCStringoperator= (char c)
 
RWCStringoperator= (const char *str)
 
RWCStringoperator= (const ConstSubString &str)
 
RWCStringoperator= (const RWCString &str)
 
RWCStringoperator= (const std::string &str)
 
RWCStringoperator= (const SubString &str)
 
RWCStringoperator= (RWCString &&str)
 
char & operator[] (char i)
 
char operator[] (char i) const
 
char & operator[] (int i)
 
char operator[] (int i) const
 
char & operator[] (long i)
 
char operator[] (long i) const
 
char & operator[] (long long i)
 
char operator[] (long long i) const
 
char & operator[] (short i)
 
char operator[] (short i) const
 
char & operator[] (signed char i)
 
char operator[] (signed char i) const
 
char & operator[] (unsigned char i)
 
char operator[] (unsigned char i) const
 
char & operator[] (unsigned int i)
 
char operator[] (unsigned int i) const
 
char & operator[] (unsigned long i)
 
char operator[] (unsigned long i) const
 
char & operator[] (unsigned long long i)
 
char operator[] (unsigned long long i) const
 
char & operator[] (unsigned short i)
 
char operator[] (unsigned short i) const
 
RWCStringprepend (char c, size_t count=1)
 
RWCStringprepend (const char *str)
 
RWCStringprepend (const char *str, size_t len)
 
RWCStringprepend (const ConstSubString &str)
 
RWCStringprepend (const RWCString &str)
 
RWCStringprepend (const RWCString &str, size_t len)
 
RWCStringprepend (const std::string &str)
 
RWCStringprepend (const std::string &str, size_t len)
 
RWCStringprepend (const SubString &str)
 
std::istream & readFile (std::istream &strm)
 
std::istream & readLine (std::istream &strm, bool skipWhite=true)
 
std::istream & readString (std::istream &strm)
 
std::istream & readToDelim (std::istream &strm, char delim='\n')
 
std::istream & readToken (std::istream &strm)
 
RWCStringremove (size_t pos)
 
RWCStringremove (size_t pos, size_t len)
 
RWCStringreplace (const RWCRExpr &re, const char *str, scopeType scope=one)
 
RWCStringreplace (const RWCRExpr &re, const RWCString &str, scopeType scope=one)
 
RWCStringreplace (size_t pos, size_t len, const char *str)
 
RWCStringreplace (size_t pos, size_t len, const char *str, size_t strLen)
 
RWCStringreplace (size_t pos, size_t len, const ConstSubString &str)
 
RWCStringreplace (size_t pos, size_t len, const RWCString &str)
 
RWCStringreplace (size_t pos, size_t len, const RWCString &str, size_t strLen)
 
RWCStringreplace (size_t pos, size_t len, const std::string &str)
 
RWCStringreplace (size_t pos, size_t len, const std::string &str, size_t strLen)
 
RWCStringreplace (size_t pos, size_t len, const SubString &str)
 
void resize (size_t len)
 
size_t rindex (const char *pat, caseCompare cmp) const
 
size_t rindex (const char *pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const char *pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const char pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const ConstSubString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const RWCString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const RWCString &pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const std::string &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const std::string &pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const SubString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
void shrink ()
 
std::string & std ()
 
const std::string & std () const
 
SubString strip (stripType st=trailing, char c=' ')
 
ConstSubString strip (stripType st=trailing, char c=' ') const
 
SubString subString (const char *pat, size_t start=0, caseCompare cmp=exact)
 
ConstSubString subString (const char *pat, size_t start=0, caseCompare cmp=exact) const
 
void swap (RWCString &str)
 
void toLower ()
 
void toUpper ()
 
- Static Protected Member Functions inherited from RWCString
static size_t byteCount (const char *str, size_t nChars=RW_NPOS)
 
static unsigned hash (const RWCString &str)
 
static size_t mbLength (const char *str, size_t nBytes=RW_NPOS)
 

Detailed Description

Class RWStringID is an identifier for RWCollectable instances. It is derived from RWCString, and may be manipulated by any of the const RWCString methods. The non-const methods have been hidden to prevent the disaster that could occur if the RWStringID of a class changed at run time.

You can associate an RWStringID with an RWCollectable class in one of two ways: pick the RWStringID for the class, or allow the library to automatically generate an RWStringID that is the same sequence of characters as the name of the class; for example, class MyColl : public RWCollectable would get the automatic RWStringID "MyColl".

Example

You specify a class with a fixed RWClassID and generated RWStringID by using the macro RW_DEFINE_COLLECTABLE_CLASS_BY_ID as follows:

RW_DEFINE_COLLECTABLE_CLASS_BY_ID(USER_MODULE, ClassName, ClassID)
// for example
RW_DEFINE_COLLECTABLE_CLASS_BY_ID(USER_MODULE, MyCollectable1, 0x1000)
#define RW_DEFINE_COLLECTABLE_CLASS_BY_ID(libName, className, id)
Definition collect.h:244

You specify a class with a fixed RWStringID and a generated RWClassID by using the new macro RW_DEFINE_COLLECTABLE_CLASS_BY_NAME as follows:

// for example
RW_DEFINE_COLLECTABLE_CLASS_BY_NAME(USER_MODULE, MyCollectable2,
"Second Collectable")
An identifier for RWCollectable instances.
Definition stringid.h:117
#define RW_DEFINE_COLLECTABLE_CLASS_BY_NAME(libName, className, str)
Definition collect.h:333
Example
#include <rw/collect.h>
// See the section in the Essential Tools Module User's Guide
// about exporting symbols for more information about this macro.
#define EXPORT
class MyCollectable1 : public RWCollectable {
RW_DECLARE_COLLECTABLE_CLASS(EXPORT, MyCollectable1);
};
RW_DEFINE_COLLECTABLE_CLASS_BY_ID(EXPORT, MyCollectable1, 0x1000)
class MyCollectable2 : public RWCollectable {
RW_DECLARE_COLLECTABLE_CLASS(EXPORT, MyCollectable2);
};
RW_DEFINE_COLLECTABLE_CLASS_BY_NAME(EXPORT, MyCollectable2,
"Second Collectable")
int main() {
// First set up the experiment
MyCollectable1 one;
MyCollectable2 two;
// All running RWClassIDs are guaranteed distinct
one.isA() != two.isA();
// Every RWCollectable has an RWStringID
one.stringID() == "MyCollectable1";
// There are several ways to find ids
two.isA();
RWCollectable::classID("Second Collectable");
return 0;
}
@ one
Definition stdcstring.h:905
Contains virtual functions for identifying, hashing, comparing, storing and retrieving collectable ob...
Definition collect.h:441
static RWClassID classID(const RWStringID &name)
Definition collect.h:698
#define RW_DECLARE_COLLECTABLE_CLASS(libName, className)
Definition collect.h:133

Constructor & Destructor Documentation

◆ RWStringID() [1/6]

RWStringID::RWStringID ( )
inline

Default constructor. Sets the value of the string ID to "NoID".

◆ RWStringID() [2/6]

RWStringID::RWStringID ( const RWStringID & sid)
inline

Copy constructor. Sets the value of the string ID to the value of sid.

◆ RWStringID() [3/6]

RWStringID::RWStringID ( const RWCString & s)
inline

Sets the value of the string ID to the value of string s.

◆ RWStringID() [4/6]

RWStringID::RWStringID ( const char * name)
inline

Sets the value of the string ID to the value of char name.

◆ RWStringID() [5/6]

RWStringID::RWStringID ( RWCString && s)
inline

Move Constructor. The created string ID takes ownership of the data owned by s.

Condition:
This method is available only on platforms with rvalue reference support.

◆ RWStringID() [6/6]

RWStringID::RWStringID ( RWStringID && sid)
inline

Move constructor. The created string ID takes ownership of the data owned by sid.

Condition:
This method is available only on platforms with rvalue reference support.

◆ ~RWStringID()

RWStringID::~RWStringID ( )
inline

Destructor

Member Function Documentation

◆ binaryStoreSize()

RWspace RWStringID::binaryStoreSize ( ) const
inline

Returns the number of bytes necessary to store the object using the global functions:

Offers powerful and convenient facilities for manipulating strings.
Definition stdcstring.h:826
Represents an abstraction of a filesystem regular file.
Definition rwfile.h:68
friend RWvostream & operator<<(RWvostream &vos, const RWStringID &sid)
Definition stringid.h:578
Abstract base class that provides an interface for format-dependent storage of fundamental types and ...
Definition vstream.h:749

◆ capacity() [1/2]

size_t RWStringID::capacity ( ) const
inline

Returns the current capacity of self. This is the number of bytes the string can hold without resizing.

◆ capacity() [2/2]

size_t RWStringID::capacity ( size_t N)
inline

A non-binding request to alter the capacity of self to cap. The capacity is never reduced below the current number of bytes. Returns the actual capacity.

◆ collate() [1/2]

int RWStringID::collate ( const char * cs) const
inline

Returns an int less than, greater than, or equal to zero, according to the result of calling the C++ Standard Library function std::strcoll() on self and the argument str. This supports locale-dependent collation.

Note
This function is incompatible with strings with embedded nulls.

◆ collate() [2/2]

int RWStringID::collate ( const RWCString & st) const
inline

Returns an int less than, greater than, or equal to zero, according to the result of calling the C++ Standard Library function std::strcoll() on self and the argument str. This supports locale-dependent collation.

Note
This function is incompatible with strings with embedded nulls.

◆ compareTo() [1/2]

int RWStringID::compareTo ( const char * cs,
caseCompare cmp = exact ) const
inline

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.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.
This function is incompatible with str strings with embedded nulls.

◆ compareTo() [2/2]

int RWStringID::compareTo ( const RWCString & st,
caseCompare cmp = exact ) const
inline

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.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.

◆ contains() [1/2]

bool RWStringID::contains ( const char * pat,
caseCompare cmp = exact ) const
inline

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

◆ contains() [2/2]

bool RWStringID::contains ( const RWCString & pat,
caseCompare cmp = exact ) const
inline

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

◆ data()

const char * RWStringID::data ( ) const
inline

Provides access to the RWCString instances's data as a null-terminated string. This datum is owned by the RWCString and may not be deleted or changed. If the RWCString object itself changes or goes out of scope, the pointer value previously returned becomes invalid. While the string is null-terminated, its length is still given by the member function length(). That is, it may contain embedded nulls.

◆ first() [1/2]

size_t RWStringID::first ( char c) const
inline
Deprecated
As of SourcePro 12, use RWCString::firstOf(char, size_t) const instead.

◆ first() [2/2]

size_t RWStringID::first ( const char * cs) const
inline

◆ firstOf() [1/2]

size_t RWStringID::firstOf ( char c,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence of the character c in self, starting at position pos. Returns RW_NPOS if there is no match.

◆ firstOf() [2/2]

size_t RWStringID::firstOf ( const char * str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in the null-terminated string str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.

◆ hash()

unsigned RWStringID::hash ( ) const
inline

Returns a suitable hash value.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [1/9]

size_t RWStringID::index ( const char * pat,
size_t * ext,
size_t i = 0 ) const
inline
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [2/9]

size_t RWStringID::index ( const char * pat,
size_t i = 0,
caseCompare cmp = exact ) const
inline

Pattern matching. Starting with index start, searches for the first occurrence of the null-terminated string pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
This function is incompatible with pat strings with embedded nulls.
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [3/9]

size_t RWStringID::index ( const char * pat,
size_t patlen,
size_t i,
caseCompare cmp ) const
inline

Pattern matching. Starting with index start, searches for the first occurrence of the first patlen bytes from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [4/9]

size_t RWStringID::index ( const RWCRegexp & pat,
size_t * ext,
size_t i = 0 ) const
inline
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [5/9]

size_t RWStringID::index ( const RWCRegexp & pat,
size_t i = 0 ) const
inline
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [6/9]

size_t RWStringID::index ( const RWCRExpr & pat,
size_t * ext,
size_t i = 0 ) const
inline
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [7/9]

size_t RWStringID::index ( const RWCRExpr & pat,
size_t i = 0 ) const
inline
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [8/9]

size_t RWStringID::index ( const RWCString & s,
size_t i = 0,
caseCompare cmp = exact ) const
inline

Pattern matching. Starting with index start, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [9/9]

size_t RWStringID::index ( const RWCString & s,
size_t patlen,
size_t i,
caseCompare cmp ) const
inline

Pattern matching. Starting with index start, searches for the first occurrence of the first patlen bytes from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ isAscii()

bool RWStringID::isAscii ( ) const
inline

Returns true if all bytes in self are between [0, 127].

◆ isNull()

bool RWStringID::isNull ( ) const
inline

Returns true if this is a zero length string (i.e., the null string).

◆ last() [1/2]

size_t RWStringID::last ( char c) const
inline
Deprecated
As of SourcePro 12, use RWCString::lastOf(char, size_t) const instead.

◆ last() [2/2]

size_t RWStringID::last ( char c,
size_t  ) const
inline
Deprecated
As of SourcePro 12, use RWCString::lastOf(char, size_t) const instead.

◆ lastOf()

size_t RWStringID::lastOf ( char c,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence of the character c in self, ending at position pos. Returns RW_NPOS if there is no match.

◆ length()

size_t RWStringID::length ( ) const
inline

Returns the number of bytes in self.

Note
If self contains any multibyte characters, RWCString::mbLength() should be used to determine the number of characters in self.

◆ operator const char *()

RWStringID::operator const char * ( ) const
inline

Provides access to the RWCString instances's data as a null-terminated string. This datum is owned by the RWCString and may not be deleted or changed. If the RWCString object itself changes or goes out of scope, the pointer value previously returned becomes invalid. While the string is null-terminated, its length is still given by the member function length(). That is, it may contain embedded nulls.

◆ operator()()

char RWStringID::operator() ( size_t t) const
inline

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the preprocessor macro RWBOUNDS_CHECK has been defined before including <rw/cstring.h>.

Exceptions
RWBoundsErrif RWBOUNDS_CHECK is defined and the index is out of range.

◆ operator=() [1/4]

RWStringID & RWStringID::operator= ( const RWCString & s)
inline

Copies the data from string s. Returns a reference to self.

◆ operator=() [2/4]

RWStringID & RWStringID::operator= ( const RWStringID & sid)
inline

Assignment operator. Copies the data from string ID sid. Returns a reference to self.

◆ operator=() [3/4]

RWStringID & RWStringID::operator= ( RWCString && s)
inline

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

Condition:
This method is available only on platforms with rvalue reference support.

◆ operator=() [4/4]

RWStringID & RWStringID::operator= ( RWStringID && sid)
inline

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

Condition:
This method is available only on platforms with rvalue reference support.

◆ operator[]()

char RWStringID::operator[] ( size_t t) const
inline

Returns the tth byte in self. The index t must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ swap()

void RWStringID::swap ( RWStringID & rhs)
inline

Swaps the contents of rhs with self.

Friends And Related Symbol Documentation

◆ operator!= [1/3]

bool operator!= ( const char * lhs,
const RWStringID & rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator!= [2/3]

bool operator!= ( const RWStringID & lhs,
const char * rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator!= [3/3]

bool operator!= ( const RWStringID & lhs,
const RWStringID & rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator<

bool operator< ( const RWStringID & lhs,
const RWStringID & rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator<< [1/3]

RWFile & operator<< ( RWFile & file,
const RWStringID & sid )
friend

Saves string sid to an RWFile.

◆ operator<< [2/3]

RWvostream & operator<< ( RWvostream & vos,
const RWStringID & sid )
friend

Saves string sid to a virtual stream.

◆ operator<< [3/3]

std::ostream & operator<< ( std::ostream & os,
const RWStringID & sid )
friend

Output an RWStringID on ostream os.

◆ operator<=

bool operator<= ( const RWStringID & lhs,
const RWStringID & rhs )
friend

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member RWStringID::collate() for locale sensitivity. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator== [1/3]

bool operator== ( const char * lhs,
const RWStringID & rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator== [2/3]

bool operator== ( const RWStringID & lhs,
const char * rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator== [3/3]

bool operator== ( const RWStringID & lhs,
const RWStringID & rhs )
friend

Logical equality and inequality. Case sensitivity is exact. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator>

bool operator> ( const RWStringID & lhs,
const RWStringID & rhs )
friend

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member RWStringID::collate() for locale sensitivity. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator>=

bool operator>= ( const RWStringID & lhs,
const RWStringID & rhs )
friend

Comparisons are done lexicographically, byte by byte. Case sensitivity is exact. Use member RWStringID::collate() for locale sensitivity. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

◆ operator>> [1/3]

RWFile & operator>> ( RWFile & file,
RWStringID & sid )
friend

Restores a string into sid from an RWFile, replacing the previous contents of sid. If the file produce an error on extraction, the operator returns the original string contents unmodified. Be sure to check the file to determine if an extraction error occurred.

◆ operator>> [2/3]

RWvistream & operator>> ( RWvistream & vis,
RWStringID & sid )
friend

Restores a string into sid from a virtual stream, replacing the previous contents of sid. If the virtual stream produces an error on extraction, the operator returns the original string contents unmodified. Be sure to check the virtual stream to determine if an extraction error occurred.

◆ operator>> [3/3]

std::istream & operator>> ( std::istream & is,
RWStringID & sid )
friend

Calls RWCString::readToken(std::istream&). That is, a token is read from the input stream is. This function is incompatible with MBCS strings.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.