home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IDBCSBUF.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
11KB
|
209 lines
#ifndef _IDBCSBUF_
#define _IDBCSBUF_
/*******************************************************************************
* FILE NAME: idbcsbuf.hpp *
* *
* DESCRIPTION: *
* This file contains the declaration(s) of the class(es): *
* IDBCSBuffer - DBCS buffer class *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IBUFFER_
#include <ibuffer.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IDBCSBuffer : public IBuffer {
/*******************************************************************************
* The IDBCSBuffer class implements the version of IString contents that *
* supports mixed OS/2 double-byte character set (DBCS) characters. This *
* class ensures that DBCS multi-byte characters are processed properly. *
* *
* The use of this class is transparent to the user of class IString. *
*******************************************************************************/
public:
/*-------------------------------- Overrides -----------------------------------
| This class re-implements the following IBuffer functions as public: |
| subString - See IBuffer::subString. |
| charType - See IBuffer::charType. |
| allocate - See IBuffer::allocate. |
| next - See IBuffer::next. |
| |
| This class re-implements the following IString version of IBuffer functions: |
| isDBCS - See IString::isDBCS. |
| isSBCS - See IString::isDBCS. |
| isValidDBCS - See IString::isValidDBCS. |
| includesDBCS - See IString::includesDBCS. |
| includesSBCS - See IString::includesSBCS. |
| indexOf - See IString::indexOf. |
| indexOfAnyBut - See IString::indexOfAnyBut. |
| indexOfAnyOf - See IString::indexOfAnyOf. |
| lastIndexOf - See IString::lastIndexOf. |
| lastIndexOfAnyBut - See IString::lastIndexOfAnyBut. |
| lastIndexOfAnyOf - See IString::lastIndexOfAnyOf. |
| center - See IString::center. |
| insert - See IString::insert. |
| leftJustify - See IString::leftJustify. |
| lowerCase - See IString::lowerCase. |
| overlayWith - See IString::overlayWith. |
| remove - See IString::remove. |
| reverse - See IString::reverse. |
| rightJustify - See IString::rightJustify. |
| strip - See IString::strip. |
| translate - See IString::translate. |
| upperCase - See IString::upperCase. |
| className - Returns "IDBCSBuffer". |
------------------------------------------------------------------------------*/
IBuffer
*subString ( unsigned startPos,
unsigned len,
char padCharacter ) const;
Boolean
isDBCS ( ) const,
isSBCS ( ) const,
isValidDBCS ( ) const,
includesDBCS ( ) const,
includesSBCS ( ) const;
IStringEnum::CharType
charType ( unsigned index ) const;
unsigned
indexOf ( const IStringTest &aTest,
unsigned startPos = 1 ) const,
indexOf ( const char *pString,
unsigned len,
unsigned startPos = 1 ) const,
indexOfAnyBut ( const char *pString,
unsigned len,
unsigned startPos = 1 ) const,
indexOfAnyBut ( const IStringTest &aTest,
unsigned startPos = 1 ) const,
indexOfAnyOf ( const char *pString,
unsigned len,
unsigned startPos = 1 ) const,
indexOfAnyOf ( const IStringTest &aTest,
unsigned startPos = 1 ) const,
lastIndexOf ( const IStringTest &aTest,
unsigned startPos = 1 ) const,
lastIndexOf ( const char *pString,
unsigned len,
unsigned startPos = 0 ) const,
lastIndexOfAnyBut ( const char *pString,
unsigned len,
unsigned startPos = 0 ) const,
lastIndexOfAnyBut ( const IStringTest &aTest,
unsigned startPos = 0 ) const,
lastIndexOfAnyOf ( const char *pString,
unsigned len,
unsigned startPos = 0 ) const,
lastIndexOfAnyOf ( const IStringTest &aTest,
unsigned startPos = 0 ) const;
IBuffer
*center ( unsigned newLen,
char padCharacter ),
*insert ( const char *pInsert,
unsigned insertLen,
unsigned pos,
char padCharacter ),
*leftJustify ( unsigned newLen,
char padCharacter ),
*lowerCase ( ),
*overlayWith ( const char *overlay,
unsigned len,
unsigned pos,
char padCharacter ),
*remove ( unsigned startPos,
unsigned numChars ),
*reverse ( ),
*rightJustify ( unsigned newLen,
char padCharacter ),
*strip ( const char *pChars,
unsigned len,
IStringEnum::StripMode mode ),
*strip ( const IStringTest &aTest,
IStringEnum::StripMode mode ),
*translate ( const char *pInputChars,
unsigned inputLen,
const char *pOutputChars,
unsigned outputLen,
char padCharacter ),
*upperCase ( );
IBuffer
*allocate ( unsigned newLen ) const;
char
*next ( const char *prev );
const char
*next ( const char *prev ) const;
protected:
/*---------------------- Protected Overrides -----------------------------------
| This class re-implements the following IBuffer functions as protected: |
| |
| startSearch - See IBuffer::startSearch. |
| startBackwardsSearch - See IBuffer::startBackwardsSearch. |
| className - Returns "IDBCSBuffer". |
------------------------------------------------------------------------------*/
unsigned
startSearch ( unsigned startPos,
unsigned searchLen ) const,
startBackwardsSearch ( unsigned startPos,
unsigned searchLen ) const;
const char
*className ( ) const;
/*------------------------------ Implementation --------------------------------
| These functions provide services used to implement this class: |
| isCharValid - Returns true if and only if the character at the given |
| index is in the set of valid characters. |
| isDBCS1 - Returns true if and only if the byte at the given offset |
| is the first byte of DBCS. |
| isPrevDBCS - Returns true if and only if the preceding character to the |
| one at the given offset is a DBCS character. |
------------------------------------------------------------------------------*/
Boolean
isCharValid ( unsigned pos,
const char *pValidChars,
unsigned numValidChars ) const,
isDBCS1 ( unsigned pos ) const,
isPrevDBCS ( unsigned pos ) const;
friend class IBuffer;
/*------------------------------- Constructor ----------------------------------
| The constructor for this class is protected. It is only called from the |
| member function allocate and the static member function IBuffer::initialize. |
------------------------------------------------------------------------------*/
IDBCSBuffer ( unsigned bufLength );
~IDBCSBuffer ( );
}; // class IDBCSBuffer
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#ifndef I_NO_INLINES
#include <idbcsbuf.inl>
#endif
#endif // _IDBCSBUF_