SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWDBMBString Class Reference

Represents a multibyte character string, ensuring that these get handled correctly by databases that differentiate between multibyte and single byte character strings. More...

#include <rw/db/mbstring.h>

Inheritance diagram for RWDBMBString:
RWCString

Public Member Functions

 RWDBMBString ()
 
 RWDBMBString (RWSize_T ic)
 
 RWDBMBString (const RWCString &S)
 
 RWDBMBString (const RWDBMBString &str)
 
 RWDBMBString (const char *a)
 
 RWDBMBString (const char *a, size_t N)
 
 RWDBMBString (char c)
 
 RWDBMBString (char c, size_t N)
 
 RWDBMBString (const RWCSubString &SS)
 
 RWDBMBString (unsigned char c)
 
 RWDBMBString (signed char c)
 
RWDBMBStringoperator= (const char *cs)
 
RWDBMBStringoperator= (const RWCString &str)
 
RWDBMBStringoperator= (const RWDBMBString &str)
 
- Public Member Functions inherited from RWCString
 RWCString ()
 
 RWCString (const RWCString &str)
 
 RWCString (RWCString &&str)
 
 RWCString (const SubString &str)
 
 RWCString (const ConstSubString &str)
 
 RWCString (const std::string &str)
 
 RWCString (const char *str)
 
 RWCString (const char *str, size_t len)
 
 RWCString (char c)
 
 RWCString (signed char c)
 
 RWCString (unsigned char c)
 
 RWCString (char c, size_t count)
 
 RWCString (RWSize_T cap)
 
RWCStringappend (const RWCString &str)
 
RWCStringappend (const SubString &str)
 
RWCStringappend (const ConstSubString &str)
 
RWCStringappend (const RWCString &str, size_t len)
 
RWCStringappend (const std::string &str)
 
RWCStringappend (const std::string &str, size_t len)
 
RWCStringappend (const char *str)
 
RWCStringappend (const char *str, size_t len)
 
RWCStringappend (char c, size_t count=1)
 
RWCStringassign (const RWCString &str)
 
RWCStringassign (const std::string &str)
 
RWCStringassign (const SubString &str)
 
RWCStringassign (const ConstSubString &str)
 
RWCStringassign (const char *str)
 
RWCStringassign (const char *str, size_t len)
 
RWCStringassign (char c, size_t count=1)
 
RWspace binaryStoreSize () const
 
size_t capacity () const
 
size_t capacity (size_t cap)
 
int collate (const RWCString &str) const
 
int collate (const std::string &str) const
 
int collate (const char *str) const
 
int compareTo (const RWCString &str, caseCompare cmp=exact) const
 
int compareTo (const SubString &str, 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 std::string &str, caseCompare cmp=exact) const
 
int compareTo (const std::string *str, caseCompare cmp=exact) const
 
int compareTo (const char *str, caseCompare cmp=exact) const
 
int compareTo (const char *str, size_t len, caseCompare cmp=exact) const
 
bool contains (const RWCString &str, caseCompare cmp=exact) const
 
bool contains (const SubString &str, caseCompare cmp=exact) const
 
bool contains (const ConstSubString &str, caseCompare cmp=exact) const
 
bool contains (const std::string &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
 
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=0) const
 
size_t firstNotOf (const char *str, size_t pos, size_t len) const
 
size_t firstNotOf (const RWCString &str, size_t pos=0) const
 
size_t firstNotOf (const SubString &str, size_t pos=0) const
 
size_t firstNotOf (const ConstSubString &str, size_t pos=0) const
 
size_t firstNotOf (const std::string &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=0) const
 
size_t firstOf (const char *str, size_t pos, size_t len) const
 
size_t firstOf (const RWCString &str, size_t pos=0) const
 
size_t firstOf (const SubString &str, size_t pos=0) const
 
size_t firstOf (const ConstSubString &str, size_t pos=0) const
 
size_t firstOf (const std::string &str, size_t pos=0) const
 
unsigned hash (caseCompare cmp=exact) const
 
size_t index (const RWCString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const SubString &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 RWCString &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 std::string &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 *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 RWCRegexp &re, size_t start=0) const
 
size_t index (const RWCRegexp &re, size_t *ext, size_t start=0) const
 
size_t index (const RWCRExpr &re, size_t start=0) const
 
size_t index (const RWCRExpr &re, size_t *ext, size_t start=0) const
 
size_t index (const char *re, size_t *ext, size_t start=0) const
 
RWCStringinsert (size_t pos, const RWCString &str)
 
RWCStringinsert (size_t pos, const SubString &str)
 
RWCStringinsert (size_t pos, const ConstSubString &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 char *str)
 
RWCStringinsert (size_t pos, const char *str, size_t len)
 
RWCStringinsert (size_t pos, char c, size_t count)
 
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=RW_NPOS) const
 
size_t lastNotOf (const char *str, size_t pos, size_t len) const
 
size_t lastNotOf (const RWCString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const SubString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const ConstSubString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const std::string &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=RW_NPOS) const
 
size_t lastOf (const char *str, size_t pos, size_t len) const
 
size_t lastOf (const RWCString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const SubString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const ConstSubString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const std::string &str, size_t pos=RW_NPOS) const
 
size_t length () const
 
SubString match (const RWCRExpr &re)
 
ConstSubString match (const RWCRExpr &) const
 
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
 
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
 
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
 
RWCStringoperator+= (const RWCString &str)
 
RWCStringoperator+= (const SubString &str)
 
RWCStringoperator+= (const ConstSubString &str)
 
RWCStringoperator+= (const std::string &str)
 
RWCStringoperator+= (const char *str)
 
RWCStringoperator+= (char c)
 
RWCStringoperator= (const RWCString &str)
 
RWCStringoperator= (RWCString &&str)
 
RWCStringoperator= (const SubString &str)
 
RWCStringoperator= (const ConstSubString &str)
 
RWCStringoperator= (const std::string &str)
 
RWCStringoperator= (const char *str)
 
RWCStringoperator= (char c)
 
char & operator[] (char i)
 
char operator[] (char i) const
 
char & operator[] (signed char i)
 
char operator[] (signed char i) const
 
char & operator[] (short i)
 
char operator[] (short 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[] (unsigned char i)
 
char operator[] (unsigned char i) const
 
char & operator[] (unsigned short i)
 
char operator[] (unsigned short 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
 
RWCStringprepend (const RWCString &str)
 
RWCStringprepend (const SubString &str)
 
RWCStringprepend (const ConstSubString &str)
 
RWCStringprepend (const RWCString &str, size_t len)
 
RWCStringprepend (const std::string &str)
 
RWCStringprepend (const std::string &str, size_t len)
 
RWCStringprepend (const char *str)
 
RWCStringprepend (const char *str, size_t len)
 
RWCStringprepend (char c, size_t count=1)
 
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 (size_t pos, size_t len, const RWCString &str)
 
RWCStringreplace (size_t pos, size_t len, const SubString &str)
 
RWCStringreplace (size_t pos, size_t len, const ConstSubString &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 char *str)
 
RWCStringreplace (size_t pos, size_t len, const char *str, size_t strLen)
 
RWCStringreplace (const RWCRExpr &re, const RWCString &str, scopeType scope=one)
 
RWCStringreplace (const RWCRExpr &re, const char *str, scopeType scope=one)
 
void resize (size_t len)
 
size_t rindex (const RWCString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const SubString &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 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 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
 
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 ()
 

Additional Inherited Members

- Public Types inherited from RWCString
enum  caseCompare { exact, ignoreCase, ignoreCaseStrict }
 
typedef RWCConstSubString ConstSubString
 
enum  scopeType { one, all }
 
enum  stripType { leading, trailing, both }
 
typedef RWCSubString SubString
 
- Static Public 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

Some databases require different handling of single byte character sets (SBCS), like US-ASCII or ISO Latin-1, and multibyte character sets (MBCS). Writing applications using class RWDBMBString for MBCS strings and class RWCString for SBCS strings allows the DB Interface Module to make the critical differentiation.

RWDBMBString derives publicly from RWCString, such that all the facilities and functions of RWCString are available. For a complete description of those functions, see the Essential Tools Module documentation for class RWCString.

We recommend that you do not derive from RWDBMBString.

Synopsis
#include <rw/db/mbstring.h>
Persistence
Simple
Example
#include <iostream.h>
#include <rw/db/mbstring.h>
void
outputTest(RWDBDatabase& aDB){
RWDBInserter ins = aDB.table("t1").inserter();
RWDBMBString mbstring("\x4E\x16\x75\x4C\x60\xA8\x59\x7D");
ins << mbstring;
cout << ins.asString() << endl;
}

Oracle treats multibyte and single byte strings differently. If aDB represents an Oracle database and the proper character set is loaded on the machine, the output is:

INSERT INTO T1 VALUES (N'<U+4E16><U+754C><U+60A8><U+597D>')

Sybase does not differentiate between multibyte and single byte strings. If aDB represents a Sybase database and the proper character set is loaded on the machine, the output is:

INSERT INTO T1 VALUES ('<U+4E16><U+754C><U+60A8><U+597D>')

Constructor & Destructor Documentation

RWDBMBString::RWDBMBString ( )
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( RWSize_T  ic)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( const RWCString S)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( const RWDBMBString str)
inline

Copy constructor. The created string copies str's data.

RWDBMBString::RWDBMBString ( const char *  a)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( const char *  a,
size_t  N 
)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( char  c)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( char  c,
size_t  N 
)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( const RWCSubString SS)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( unsigned char  c)
inline

Calls the corresponding constructor of RWCString.

RWDBMBString::RWDBMBString ( signed char  c)
inline

Calls the corresponding constructor of RWCString.

Member Function Documentation

RWDBMBString& RWDBMBString::operator= ( const char *  cs)
inline

Copies the null-terminated character string pointed to by cs into self. Returns a reference to self. This function is incompatible with cs strings with embedded nulls. This function may be incompatible with cs MBCS strings.

RWDBMBString& RWDBMBString::operator= ( const RWCString str)
inline

The string copies str's data. Returns a reference to self.

RWDBMBString& RWDBMBString::operator= ( const RWDBMBString str)
inline

The string copies str's data. Returns a reference to self.

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