The IDBCSBuffer class implements the version of IString contents that supports mixed double-byte character set (DBCS) characters. This class also supports UNIX multiple-byte character set (MBCS) characters. This class ensures that multiple-byte characters are processed properly.
The use of this class is transparent to the user of class IString.
The constructor for this class is protected. Only IDBCSBuffer::allocate and IBuffer::initialize can call the constructor.
![]() |
protected:
~IDBCSBuffer()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
IDBCSBuffer(unsigned bufLength)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to reimplement the allocation members as public.
![]() |
public:
virtual IDBCSBuffer* allocate(unsigned newLen) const
Returns a new buffer of the specified length.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to compare the IDBCSBuffer's contents to some other character array.
![]() |
public:
virtual Comparison compare( const void* p, unsigned len ) const
Compares the buffer's contents to the contents of the specified character array.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to reimplement the following IString versions of IBuffer members. The following members are called by the corresponding IString members to edit the buffer's contents.
![]() |
public:
virtual IDBCSBuffer* center( unsigned newLen, char padCharacter )
Centers the receiver within a string of the specified length.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* change( const char* pSource, unsigned sourceLen, const char* pTarget, unsigned targetLen, unsigned startPos, unsigned numChanges )
Changes occurrences of a specified pattern to a specified replacement string. You can specify the number of changes to perform. The default is to change all occurrences of the pattern. You can also specify the position in the receiver at which to begin.
The parameters are the following:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* insert( const char* pInsert, unsigned insertLen, unsigned pos, char padCharacter )
Inserts the specified string after the specified location.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* leftJustify( unsigned newLen, char padCharacter )
Left-justifies the receiver in a string of the specified length. If the new length (length) is larger than the current length, the string is extended by the pad character (padCharacter). The default pad character is a blank.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* lowerCase()
Translates all uppercase letters in the receiver to lowercase.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* overlayWith( const char* overlay, unsigned len, unsigned pos, char padCharacter )
Replaces a specified portion of the receiver's contents with the specified string. If pos is beyond the end of the receiver's data, it is padded with the pad character (padCharacter).
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* remove( unsigned startPos, unsigned numChars )
Deletes the specified portion of the string (that is, the substring) from the receiver. You can use this function to truncate an IString object at a specific position. For example:
aString.remove(8);removes the substring beginning at index 8 and takes the rest of the string as a default.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* reverse()
Reverses the receiver's contents.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* rightJustify( unsigned newLen, char padCharacter )
Right-justifies the receiver in a string of the specified length. If the receiver's data is shorter than the requested length (length), it is padded on the left with the pad character (padCharacter). The default pad character is a blank.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Strips both the leading and trailing character or characters. You can specify the character or characters as the following:
public:
virtual IDBCSBuffer* strip( const char* pChars, unsigned len, IStringEnum::StripMode mode )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IDBCSBuffer* strip( const IStringTest& aTest, IStringEnum::StripMode mode )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* translate( const char* pInputChars, unsigned inputLen, const char* pOutputChars, unsigned outputLen, char padCharacter )
Converts all of the receiver's characters that are in the first specified string to the corresponding character in the second specified string.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IDBCSBuffer* upperCase()
Translates all lowercase letters in the receiver to uppercase.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to reimplement the following IString versions of IBuffer members. The corresponding IString members use these members to test the buffer's contents. These tests are character-set-specific.
![]() |
public:
virtual bool includesDBCS() const
If any characters are DBCS (double-byte character set), true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool includesMBCS() const
If any characters are MBCS (multiple-byte character set), true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool includesSBCS() const
If any characters are SBCS (single-byte character set), true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isDBCS() const
If all the characters are DBCS, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isMBCS() const
If all the characters are MBCS, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isSBCS() const
If all the characters are SBCS, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isValidDBCS() const
If no DBCS characters have a 0 second byte, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isValidMBCS() const
If no MBCS characters have a 0 second byte, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members help implement this class.
![]() |
Returns the number of bytes in the character beginning at the specified offset.
protected:
size_t charLength(unsigned pos) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
static size_t charLength(char const* pChar)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
static size_t charLength( char const* pChar, mbstate_t* pMBState )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
size_t charLength(unsigned pos, mbstate_t* pMBState) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
const char* className() const
Returns the name of the class (IDBCSBuffer).
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
static size_t maxCharLength()
Returns the maximum number of bytes in a multiple-byte character. This is a static function.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns the number of bytes in the preceding character to the one at the specified offset.
protected:
size_t prevCharLength( unsigned pos, mbstate_t* pMBState ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
size_t prevCharLength(unsigned pos) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members help implement this class.
![]() |
protected:
bool isCharValid( unsigned pos, const char* pValidChars, unsigned numValidChars ) const
If the character at the specified index is in the set of valid characters, true is returned.
The parameters are the following:
Attention:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
bool isDBCS1(unsigned pos) const
If the byte at the specified offset is the first byte of
DBCS, true is returned.
Note:
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
protected:
bool isPrevDBCS(unsigned pos) const
If the preceding character to the one at the specified offset is a DBCS character,
true is returned.
Note:
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
If the byte pointed to by the specified character is a single-byte character, true is returned. This is a static function.
protected:
static bool isSBC(char const* pChar, mbstate_t* pMBState)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
static bool isSBC(char const* pChar)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to reimplement the following IString versions of IBuffer members.
![]() |
public:
virtual IStringEnum::CharType charType( unsigned index ) const
Returns the type of a character at the specified index.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns a pointer to the next character, not the next byte, in the buffer.
public:
virtual const char* next(const char* prev) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual char* next(const char* prev)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members initialize search data.
![]() |
protected:
virtual unsigned startBackwardsSearch( unsigned startPos, unsigned searchLen ) const
Initializes a search of type IString::lastIndexOf following these criteria:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
virtual unsigned startSearch( unsigned startPos, unsigned searchLen ) const
Initializes a search of type IString::indexOf following these criteria:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to reimplement the following IString versions of IBuffer search members.
![]() |
Returns the byte index of the first occurrence of the specified string within the receiver. If there are no occurrences, 0 is returned.
public:
virtual unsigned indexOf( const IStringTest& aTest, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual unsigned indexOf( const char* pString, unsigned len, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns the index of the first character of the receiver that is not in the specified set of characters. If there are no characters, 0 is returned. Alternatively, this function returns the index of the first character that fails the test prescribed by a specified IStringTest object.
public:
virtual unsigned indexOfAnyBut( const char* pString, unsigned len, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual unsigned indexOfAnyBut( const IStringTest& aTest, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns the index of the first character of the receiver that is a character in the specified set of characters. If there are no characters, 0 is returned. Alternatively, this function returns the index of the first character that passes the test prescribed by a specified IStringTest object.
public:
virtual unsigned indexOfAnyOf( const char* pString, unsigned len, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual unsigned indexOfAnyOf( const IStringTest& aTest, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns the index of the last occurrence of the specified string or character. The search starts at the position specified by startPos (inclusive) and proceeds backward. The returned value is in the range 0 <= x <= startPos. The default of 0 starts the search at the end of the receiver's string. If the search target is not found, 0 is returned.
If you specify 0 or 1 for startPos, this function returns 0 indicating the search target was not found.
public:
virtual unsigned lastIndexOf( const IStringTest& aTest, unsigned startPos = 1 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual unsigned lastIndexOf( const char* pString, unsigned len, unsigned startPos = 0 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns the index of the last character not in the specified string or character. The search starts at the position specified by startPos (inclusive) and proceeds backward. The default of 0 starts the search at the end of the receiver's string. If the search target is not found, 0 is returned.
If you specify 0 for startPos, this function returns 0 indicating the search target was not found.
public:
virtual unsigned lastIndexOfAnyBut( const char* pString, unsigned len, unsigned startPos = 0 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual unsigned lastIndexOfAnyBut( const IStringTest& aTest, unsigned startPos = 0 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Returns the index of the last character in the specified string or character. The search starts at the position specified by startPos (inclusive) and proceeds backward. The default of 0 starts the search at the end of the receiver's string. If the search target is not found, 0 is returned.
If you specify 0 or 1 for startPos, this function returns 0 indicating the search target was not found.
public:
virtual unsigned lastIndexOfAnyOf( const char* pString, unsigned len, unsigned startPos = 0 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual unsigned lastIndexOfAnyOf( const IStringTest& aTest, unsigned startPos = 0 ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to reimplement the following IString versions of IBuffer subsetting members.
![]() |
Returns a new IBuffer, of the same type as the previous one, containing the specified subset of characters.
The parameters are the following:
public:
virtual IDBCSBuffer* subString(unsigned startPos) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
virtual IDBCSBuffer* subString( unsigned startPos, unsigned len, char padCharacter ) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Corresponding IString members use these members to test the buffer's contents.
On other platforms, IDBCSBuffer inherits the Testing functions from
the IBuffer class.
Note:
![]() |
public:
virtual bool isAlphabetic() const
If all the characters are in {'A'-'Z','a'-'z'}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isAlphanumeric() const
If all characters are in {'A'-'Z','a'-'z','0'-'9'}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isASCII() const
If all the characters are in {0x00-0x7F}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isControl() const
Returns true if all the characters are control characters.
Control characters are defined by the iswcntrl() C Library function as defined in the cntrl locale source file in the cntrl class of the LC_CTYPE category of the current locale. For example, on ASCII operating systems, control characters are those in the range {0x00-0x1F,0x7F}.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isDigits() const
If all the characters are in {'0'-'9'}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isGraphics() const
Returns true if all the characters are graphics characters.
Graphics characters are printable characters excluding the space character, as defined by the iswgraph() C Library function in the graph locale source file and in the graph class of the LC_CTYPE category of the current locale. For example, on ASCII operating systems, graphics characters are those in the range {0x21-0x7E}.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isHexDigits() const
If all the characters are in {'0'-'9','A'-'F','a'-'f'}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isLowerCase() const
If all the characters are in {'a'-'z'}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isPrintable() const
Returns true if all the characters are printable characters.
Printable characters are defined by the iswprint() C Library function as defined in the print locale source file and in the print class of the LC_CTYPE category of the current locale. For example, on ASCII systems, printable characters are those in the range {0x20-0x7E}.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isPunctuation() const
If none of the characters is white space, a control character, or an alphanumeric character, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isUpperCase() const
If all the characters are in {'A'-'Z'}, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual bool isWhiteSpace() const
Returns true if all the characters are white-space characters.
White-space characters are defined by the iswspace() C Library function as defined in the space locale source file and in the space class of the LC_CTYPE category of the current locale. For example, on ASCII systems, printable white-space characters are those in the range {0x09-0x0D,0x20}.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
void addRef()
unsigned long count() const
void removeRef()
virtual IString asDebugInfo() const
virtual IBuffer* center(unsigned newLen, char padCharacter)
virtual IBuffer* change( const char* pSource, unsigned sourceLen, const char* pTarget, unsigned targetLen, unsigned startPos, unsigned numChanges )
static unsigned checkAddition( unsigned addend1, unsigned addend2 )
static unsigned checkMultiplication( unsigned factor1, unsigned factor2 )
char* contents()
const char* contents() const
virtual IBuffer* copy(unsigned numCopies)
static IBuffer* defaultBuffer()
static IBuffer* fromContents(const char* pBuffer)
virtual IBuffer* insert( const char* pInsert, unsigned insertLen, unsigned pos, char padCharacter )
virtual unsigned lastIndexOf( const IStringTest& aTest, unsigned startPos = 0 ) const
virtual IBuffer* leftJustify( unsigned newLen, char padCharacter )
unsigned length() const
virtual IBuffer* lowerCase()
IBuffer* newBuffer( const void* p1, unsigned len1, const void* p2 = 0, unsigned len2 = 0, const void* p3 = 0, unsigned len3 = 0, char padChar = 0 ) const
IBuffer* null() const
static unsigned overflow()
virtual IBuffer* overlayWith( const char* overlay, unsigned len, unsigned pos, char padCharacter )
virtual IBuffer* remove( unsigned startPos, unsigned numChars )
virtual IBuffer* reverse()
virtual IBuffer* rightJustify( unsigned newLen, char padCharacter )
static void setDefaultBuffer(IBuffer* newDefaultBuffer)
virtual IBuffer* strip( const IStringTest& aTest, IStringEnum::StripMode mode )
virtual IBuffer* strip( const char* pChars, unsigned len, IStringEnum::StripMode mode )
virtual IBuffer* subString(unsigned startPos) const
virtual IBuffer* subString( unsigned startPos, unsigned len, char padCharacter ) const
virtual IBuffer* translate( const char* pInputChars, unsigned inputLen, const char* pOutputChars, unsigned outputLen, char padCharacter )
virtual IBuffer* upperCase()
unsigned useCount() const
virtual ~IBuffer()
virtual IBuffer* allocate(unsigned bufLength) const
virtual const char* className() const
IBuffer(unsigned newLen)
static IBuffer* initialize()
static bool isDBCSLead(char inByte)
void operator delete(void* p)
void operator delete( void* p, const char* filename, size_t linenum )
void* operator new(size_t t, unsigned bufLen)
void* operator new( size_t t, const char* filename, size_t linenum, unsigned bufLen )
virtual ~IMRefCounted()
IMRefCounted(const IMRefCounted&)
IMRefCounted()
IMRefCounted& operator =(const IMRefCounted&)