Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide

RWClassicCString

Module:  Essential Tools Module   Group:  String Processing


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/tools/nostl/cstring.h>
RWClassicCString a;

Description

RWClassicCString is an alternate implementation of RWCString, but does not depend on the C++ Standard Library. RWCString is a typedef for RWClassicCString if you define a non-Standard Library build.


NOTE -- Rogue Wave does not support non-Standard Library builds.

RWClassicCString is designed for use with multibyte character sequences. To manipulate wide character strings, use RWClassicWString.


NOTE -- Member function overloads with std::string or RWCConstSubString appear only when building on top of the Standard C++ Library

RWCString and Mutexes

This section only applies to the Essential Tools Module builds that do NOT use the standard library.

Class RWCString uses a single mutex to protect string reference counts. When run in a multithreaded, multiprocessor environment contention for RWCString's single mutex can cause performance issues.

To address RWCString-related performance issues that may occur in a multithreaded, multiprocessor environment, we have provided a macro, RW_CSTRING_MUTEX_COUNT. This macro lets you adjust RWCString to use any number of mutexes. You use the macro by creating a custom configuration in Rogue Wave Component Builder that defines the macro and sets it equal to the desired number of mutexes (-DRW_CSTRING_MUTEX_COUNT=X). You then build your Essential Tools Module library with the new configuration.

This feature should only be used in a multithreaded, multiprocessor environment when your code is RWCString intensive. In other circumstances, changing the number of mutexes available will negatively affect performance.

To help you determine the optimal number of mutexes, we provide a second macro, RW_CSTRING_MUTEX_COUNT_INFO, that makes available the function printStringMutexCount(). The new function prints a usage histogram for the pool of mutexes. By reviewing the histogram you can determine the best number of mutexes for your environment. To use the printStringMutexCount() function, update your custom configuration to include the macro definition -DRW_CSTRING_MUTEX_COUNT_INFO. You can remove the second macro definition from your library after determining the best number of mutexes.

Persistence

Simple

Example

Program output:

Enumerations

enum RWClassicCString::stripType    
{leading = 0x1, trailing = 0x2, both = 0x3};
enum RWClassicCString::caseCompare  
{exact, ignoreCase, ignoreCaseStrict};
enum RWClassicCString::scopeType  {one, all};

Public Constructors

RWCString();
RWClassicCString(const char* a);
RWClassicCString(const char* a, size_t N);
RWClassicCString(RWSize_T ic)
RWClassicCString(const RWClassicCString& str);
RWClassicCString(const RWClassicCSubString& ss);
RWClassicCString(char c);
RWClassicCString(char c, size_t N);

Type Conversion

operator
const char*() const;

Assignment Operators

RWClassicCString&
operator=(const char* cs);
RWClassicCString&
operator=(const RWClassicCString& str);
RWClassicCString&
operator+=(const char* cs);
RWClassicCString&
operator+=(const RWClassicCString& str);

Indexing Operators

char&
operator[](size_t i);
char
operator[](size_t i) const;
char&
operator()(size_t i);
char
operator()(size_t i) const;
RWClassicCSubString
operator()(size_t start, size_t len);
const RWClassicCSubString
operator()(size_t start, size_t len) const;
RWClassicCSubString
operator()(const RWCRExpr& re, size_t start=0);
const RWClassicCSubString
operator()(const RWCRExpr& re, size_t start=0) const;
RWClassicCSubString
operator()(const RWCRegexp& re, size_t start=0);
const RWClassicCSubString
operator()(const RWCRegexp& re, size_t start=0) const;

Public Member Functions

RWClassicCString&
append(const char* cs);
RWClassicCString&
append(const char* cs, size_t N);
RWClassicCString&
append(char c, size_t rep=1);
RWClassicCString&
append(const RWClassicCString& cstr);
RWClassicCString&
append(const RWClassicCString& cstr, size_t N);
size_t
binaryStoreSize() const;
size_t
capacity() const;
size_t
capacity(size_t N);
int
collate(const char* str) const;
int
collate(const RWClassicCString& str) const;
int
compareTo(const char* str, 
caseCompare = RWClassicCString::exact) const; int compareTo(const RWClassicCString& str, caseCompare = RWClassicCString::exact) const;
RWBoolean
contains(const char* str, 
caseCompare = RWClassicCString::exact) const; RWBoolean contains(const RWClassicCString& cs, caseCompare = RWClassicCString::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 N) const;
unsigned
hash(caseCompare = RWClassicCString::exact) const;
static unsigned   
hash(const RWClassicCString&);
size_t
index(const char* pat,size_t i=0, 
      caseCompare = RWClassicCString::exact) const;
size_t
index(const RWClassicCString& pat,size_t i=0, 
      caseCompare = RWClassicCString::exact) const;
size_t
index(const char* pat, size_t patlen,size_t i, 
      caseCompare cmp) const;
size_t
index(const RWClassicCString& pat, size_t patlen,size_t i,
      caseCompare cmp) const;
size_t
index(const RWCRExpr& re, size_t i=0) const;
size_t
index(const RWCRegexp& re, size_t i=0) const;
size_t
index(const RWCRExpr& re,size_t* ext,size_t i=0) const;
size_t
index(const RWCRegexp& re,size_t* ext,size_t i=0) const;
RWClassicCString&
insert(size_t pos, const char* cs);
RWClassicCString&
insert(size_t pos, const char* cs, size_t N);
RWClassicCString&
insert(size_t pos, const RWClassicCString& str);
RWClassicCString&
insert(size_t pos, const RWClassicCString& str, size_t N);
RWBoolean
isAscii() const;
RWBoolean
isNull() const;
size_t
last(char c) const;
size_t
last(char c, size_t N) const;
size_t
length() const;
RWClassicCSubString
match(const RWCRExpr& re);
const RWClassicCSubString
match(const RWCRExpr& re, size_t start=0) const;
size_t
mbLength() const;
RWClassicCString&
prepend(const char* cs);
RWClassicCString&
prepend(const char* cs, size_t N);
RWClassicCString&
prepend(char c, size_t rep=1);
RWClassicCString&
prepend(const RWClassicCString& str);
RWClassicCString&
prepend(const RWClassicCString& cstr, size_t N);
istream&
readFile(istream& s);
istream&
readLine(istream& s, RWBoolean skipWhite = TRUE);
istream&
readString(istream& s);
istream&
readToDelim(istream& s, char delim='\n');
istream&
readToken(istream& s);
RWClassicCString&
remove(size_t pos);
RWClassicCString&
remove(size_t pos, size_t N);
RWClassicCString&
replace(size_t pos, size_t N, const char* cs);
RWClassicCString&
replace(size_t pos, size_t N1,const char* cs, size_t N2);
RWClassicCString&
replace(size_t pos, size_t N, const RWClassicCString& str);
RWClassicCString&
replace(size_t pos, size_t N1,const RWClassicCString& str,
size_t N2);
replace(const RWCRExpr& pattern, const char* replacement, 
        scopeType scope=one);
replace(const RWCRExpr& pattern, 
        const RWClassicCString& replacement,
scopeType scope=one);
void
resize(size_t n);
RWClassicCSubString
strip(stripType s = RWClassicCString::trailing, char c = ' ');
RWClassicCSubString
subString(const char* cs, size_t start=0,
          caseCompare = RWClassicCString::exact);
RWClassicCSubString
subString(const char* size_t=0,
          caseCompare = RWClassicCString::exact) const;
void
toLower();
void
toUpper();

Static Public Member Functions

static unsigned
hash(const RWClassicCString& str); 
static size_t
initialCapacity(size_t ic = 15);
static size_t
maxWaste(size_t mw = 15);
static size_t
resizeIncrement(size_t ri = 16);

Related Global Operators

RWBoolean
operator==(const RWClassicCString&, const char*     );
RWBoolean
operator==(const char*,      const RWClassicCString&);
RWBoolean
operator==(const RWClassicCString&, const RWClassicCString&);
RWBoolean
operator!=(const RWClassicCString&, const char*     );
RWBoolean
operator!=(const char*,      const RWClassicCString&);
RWBoolean
operator!=(const RWClassicCString&, const RWClassicCString&);
RWBoolean
operator< (const RWClassicCString&, const char*     );
RWBoolean
operator< (const char*,      const RWClassicCString&);
RWBoolean
operator< (const RWClassicCString&, const RWClassicCString&);
RWBoolean
operator> (const RWClassicCString&, const char*     );
RWBoolean
operator> (const char*,      const RWClassicCString&);
RWBoolean
operator> (const RWClassicCString&, const RWClassicCString&);
RWBoolean
operator<=(const RWClassicCString&, const char*     );
RWBoolean
operator<=(const char*,      const RWClassicCString&);
RWBoolean
operator<=(const RWClassicCString&, const RWClassicCString&);
RWBoolean
operator>=(const RWClassicCString&, const char*     );
RWBoolean
operator>=(const char*,      const RWClassicCString&);
RWBoolean
operator>=(const RWClassicCString&, const RWClassicCString&);
RWClassicCString
operator+(const RWClassicCString&, const RWClassicCString&);
RWClassicCString
operator+(const char*,      const RWClassicCString&);
RWClassicCString
operator+(const RWClassicCString&, const char*     );
ostream&
operator<<(ostream& s, const RWClassicCString&);
istream&
operator>>(istream& s, RWClassicCString& str);
RWvostream&
operator<<(RWvostream&, const RWClassicCString& str);
RWFile&
operator<<(RWFile&,     const RWClassicCString& str);
RWvistream&
operator>>(RWvistream&, RWClassicCString& str);
RWFile&
operator>>(RWFile&,     RWClassicCString& str);

Related Global Functions

RWClassicCString
strXForm(const RWClassicCString&);
RWClassicCString
toLower(const RWClassicCString& str);
RWClassicCString
toUpper(const RWClassicCString& str);

Global Logical Operators

RWBoolean
operator==(const RWClassicCString&,    
           const RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCSubString&, 
           const RWClassicCString&   );
RWBoolean
operator!=(const RWClassicCString&,    
           const RWClassicCString&   );
RWBoolean
operator!=(const RWClassicCString&,    
           const RWClassicCSubString&);
RWBoolean
operator!=(const RWClassicCSubString&, 
           const RWClassicCString&   );
RWBoolean
operator!=(const char*,         
           const RWClassicCString&   );
RWBoolean
operator!=(const RWClassicCString&,    
           const char*               );


Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, 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.