CnvUtilities Class Reference

class CnvUtilities

Provides static character conversion utilities for complex encodings. Its functions may be called from a plug-in DLL's implementation of ConvertFromUnicode() and ConvertToUnicode().

These utility functions are provided for use when converting to/from complex character set encodings, including modal encodings. Modal encodings are those where the interpretation of a given byte of data is dependent on the current mode; mode changing is performed by escape sequences which occur in the byte stream. A non-modal complex encoding is one in which characters are encoded using variable numbers of bytes. The number of bytes used to encode a character depends on the value of the initial byte.

Public Member Functions
IMPORT_C voidConvertFromIntermediateBufferInPlace(TInt, TDes8 &, TInt &, const TDesC8 &, TInt)
IMPORT_C TIntConvertFromUnicode(CCnvCharacterSetConverter::TEndianness, const TDesC8 &, TDes8 &, const TDesC16 &, CCnvCharacterSetConverter::TArrayOfAscendingIndices &, const TArray< SCharacterSet > &)
IMPORT_C TIntConvertFromUnicode(CCnvCharacterSetConverter::TEndianness, const TDesC8 &, TDes8 &, const TDesC16 &, CCnvCharacterSetConverter::TArrayOfAscendingIndices &, const TArray< SCharacterSet > &, TUint &, TUint)
IMPORT_C TIntConvertToUnicodeFromHeterogeneousForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, const TArray< SMethod > &)
IMPORT_C TIntConvertToUnicodeFromHeterogeneousForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, const TArray< SMethod > &, TUint &, TUint)
IMPORT_C TIntConvertToUnicodeFromModalForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, TInt &, const TArray< SState > &)
IMPORT_C TIntConvertToUnicodeFromModalForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, TInt &, const TArray< SState > &, TUint &, TUint)
Private Member Functions
voidCheckArrayOfCharacterSets(const TArray< SCharacterSet > &)
voidCheckArrayOfMethods(const TArray< SMethod > &)
voidCheckArrayOfStates(const TArray< SState > &)
TBool IsStartOf(const TDesC8 &, const TDesC8 &)
TInt LengthOfUnicodeCharacter(const TDesC16 &, TInt)
TBool MatchesEscapeSequence(TInt &, TPtrC8 &, TPtrC8 &, const TDesC8 &)
TBool NextHomogeneousForeignRun(const SCnvConversionData *&, TInt &, TPtrC8 &, TPtrC8 &, const TArray< SState > &, TUint &)
TInt ReduceToNearestMultipleOf(TInt, TInt)
Public Member Type Definitions
typedefvoid(* FConvertFromIntermediateBufferInPlace
typedefvoid(* FConvertToIntermediateBufferInPlace
typedef TInt(* FNumberOfBytesAbleToConvert

Member Functions Documentation

CheckArrayOfCharacterSets(const TArray< SCharacterSet > &)

voidCheckArrayOfCharacterSets(const TArray< SCharacterSet > &aArrayOfCharacterSets)[private, static]

Parameters

const TArray< SCharacterSet > & aArrayOfCharacterSets

CheckArrayOfMethods(const TArray< SMethod > &)

voidCheckArrayOfMethods(const TArray< SMethod > &aArrayOfMethods)[private, static]

Parameters

const TArray< SMethod > & aArrayOfMethods

CheckArrayOfStates(const TArray< SState > &)

voidCheckArrayOfStates(const TArray< SState > &aArrayOfStates)[private, static]

Parameters

const TArray< SState > & aArrayOfStates

ConvertFromIntermediateBufferInPlace(TInt, TDes8 &, TInt &, const TDesC8 &, TInt)

IMPORT_C voidConvertFromIntermediateBufferInPlace(TIntaStartPositionInDescriptor,
TDes8 &aDescriptor,
TInt &aNumberOfCharactersThatDroppedOut,
const TDesC8 &aEscapeSequence,
TIntaNumberOfBytesPerCharacter
)[static]

Parameters

TInt aStartPositionInDescriptor
TDes8 & aDescriptor
TInt & aNumberOfCharactersThatDroppedOut
const TDesC8 & aEscapeSequence
TInt aNumberOfBytesPerCharacter

ConvertFromUnicode(CCnvCharacterSetConverter::TEndianness, const TDesC8 &, TDes8 &, const TDesC16 &, CCnvCharacterSetConverter::TArrayOfAscendingIndices &, const TArray< SCharacterSet > &)

IMPORT_C TIntConvertFromUnicode(CCnvCharacterSetConverter::TEndiannessaDefaultEndiannessOfForeignCharacters,
const TDesC8 &aReplacementForUnconvertibleUnicodeCharacters,
TDes8 &aForeign,
const TDesC16 &aUnicode,
CCnvCharacterSetConverter::TArrayOfAscendingIndices &aIndicesOfUnconvertibleCharacters,
const TArray< SCharacterSet > &aArrayOfCharacterSets
)[static]

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters
const TDesC8 & aReplacementForUnconvertibleUnicodeCharacters
TDes8 & aForeign
const TDesC16 & aUnicode
CCnvCharacterSetConverter::TArrayOfAscendingIndices & aIndicesOfUnconvertibleCharacters
const TArray< SCharacterSet > & aArrayOfCharacterSets

ConvertFromUnicode(CCnvCharacterSetConverter::TEndianness, const TDesC8 &, TDes8 &, const TDesC16 &, CCnvCharacterSetConverter::TArrayOfAscendingIndices &, const TArray< SCharacterSet > &, TUint &, TUint)

IMPORT_C TIntConvertFromUnicode(CCnvCharacterSetConverter::TEndiannessaDefaultEndiannessOfForeignCharacters,
const TDesC8 &aReplacementForUnconvertibleUnicodeCharacters,
TDes8 &aForeign,
const TDesC16 &aUnicode,
CCnvCharacterSetConverter::TArrayOfAscendingIndices &aIndicesOfUnconvertibleCharacters,
const TArray< SCharacterSet > &aArrayOfCharacterSets,
TUint &aOutputConversionFlags,
TUintaInputConversionFlags
)[static]

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters
const TDesC8 & aReplacementForUnconvertibleUnicodeCharacters
TDes8 & aForeign
const TDesC16 & aUnicode
CCnvCharacterSetConverter::TArrayOfAscendingIndices & aIndicesOfUnconvertibleCharacters
const TArray< SCharacterSet > & aArrayOfCharacterSets
TUint & aOutputConversionFlags
TUint aInputConversionFlags

ConvertToUnicodeFromHeterogeneousForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, const TArray< SMethod > &)

IMPORT_C TIntConvertToUnicodeFromHeterogeneousForeign(CCnvCharacterSetConverter::TEndiannessaDefaultEndiannessOfForeignCharacters,
TDes16 &aUnicode,
const TDesC8 &aForeign,
TInt &aNumberOfUnconvertibleCharacters,
TInt &aIndexOfFirstByteOfFirstUnconvertibleCharacter,
const TArray< SMethod > &aArrayOfMethods
)[static]

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters
TDes16 & aUnicode
const TDesC8 & aForeign
TInt & aNumberOfUnconvertibleCharacters
TInt & aIndexOfFirstByteOfFirstUnconvertibleCharacter
const TArray< SMethod > & aArrayOfMethods

ConvertToUnicodeFromHeterogeneousForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, const TArray< SMethod > &, TUint &, TUint)

IMPORT_C TIntConvertToUnicodeFromHeterogeneousForeign(CCnvCharacterSetConverter::TEndiannessaDefaultEndiannessOfForeignCharacters,
TDes16 &aUnicode,
const TDesC8 &aForeign,
TInt &aNumberOfUnconvertibleCharacters,
TInt &aIndexOfFirstByteOfFirstUnconvertibleCharacter,
const TArray< SMethod > &aArrayOfMethods,
TUint &aOutputConversionFlags,
TUintaInputConversionFlags
)[static]

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters
TDes16 & aUnicode
const TDesC8 & aForeign
TInt & aNumberOfUnconvertibleCharacters
TInt & aIndexOfFirstByteOfFirstUnconvertibleCharacter
const TArray< SMethod > & aArrayOfMethods
TUint & aOutputConversionFlags
TUint aInputConversionFlags

ConvertToUnicodeFromModalForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, TInt &, const TArray< SState > &)

IMPORT_C TIntConvertToUnicodeFromModalForeign(CCnvCharacterSetConverter::TEndiannessaDefaultEndiannessOfForeignCharacters,
TDes16 &aUnicode,
const TDesC8 &aForeign,
TInt &aState,
TInt &aNumberOfUnconvertibleCharacters,
TInt &aIndexOfFirstByteOfFirstUnconvertibleCharacter,
const TArray< SState > &aArrayOfStates
)[static]

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters
TDes16 & aUnicode
const TDesC8 & aForeign
TInt & aState
TInt & aNumberOfUnconvertibleCharacters
TInt & aIndexOfFirstByteOfFirstUnconvertibleCharacter
const TArray< SState > & aArrayOfStates

ConvertToUnicodeFromModalForeign(CCnvCharacterSetConverter::TEndianness, TDes16 &, const TDesC8 &, TInt &, TInt &, TInt &, const TArray< SState > &, TUint &, TUint)

IMPORT_C TIntConvertToUnicodeFromModalForeign(CCnvCharacterSetConverter::TEndiannessaDefaultEndiannessOfForeignCharacters,
TDes16 &aUnicode,
const TDesC8 &aForeign,
TInt &aState,
TInt &aNumberOfUnconvertibleCharacters,
TInt &aIndexOfFirstByteOfFirstUnconvertibleCharacter,
const TArray< SState > &aArrayOfStates,
TUint &aOutputConversionFlags,
TUintaInputConversionFlags
)[static]

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters
TDes16 & aUnicode
const TDesC8 & aForeign
TInt & aState
TInt & aNumberOfUnconvertibleCharacters
TInt & aIndexOfFirstByteOfFirstUnconvertibleCharacter
const TArray< SState > & aArrayOfStates
TUint & aOutputConversionFlags
TUint aInputConversionFlags

IsStartOf(const TDesC8 &, const TDesC8 &)

TBool IsStartOf(const TDesC8 &aStart,
const TDesC8 &aPotentiallyLongerDescriptor
)[private, static]

Parameters

const TDesC8 & aStart
const TDesC8 & aPotentiallyLongerDescriptor

LengthOfUnicodeCharacter(const TDesC16 &, TInt)

TInt LengthOfUnicodeCharacter(const TDesC16 &aUnicode,
TIntaIndex
)[private, static]

Parameters

const TDesC16 & aUnicode
TInt aIndex

MatchesEscapeSequence(TInt &, TPtrC8 &, TPtrC8 &, const TDesC8 &)

TBool MatchesEscapeSequence(TInt &aNumberOfForeignBytesConsumed,
TPtrC8 &aHomogeneousRun,
TPtrC8 &aRemainderOfForeign,
const TDesC8 &aEscapeSequence
)[private, static]

Parameters

TInt & aNumberOfForeignBytesConsumed
TPtrC8 & aHomogeneousRun
TPtrC8 & aRemainderOfForeign
const TDesC8 & aEscapeSequence

NextHomogeneousForeignRun(const SCnvConversionData *&, TInt &, TPtrC8 &, TPtrC8 &, const TArray< SState > &, TUint &)

TBool NextHomogeneousForeignRun(const SCnvConversionData *&aConversionData,
TInt &aNumberOfForeignBytesConsumed,
TPtrC8 &aHomogeneousRun,
TPtrC8 &aRemainderOfForeign,
const TArray< SState > &aArrayOfStates,
TUint &aOutputConversionFlags
)[private, static]

Parameters

const SCnvConversionData *& aConversionData
TInt & aNumberOfForeignBytesConsumed
TPtrC8 & aHomogeneousRun
TPtrC8 & aRemainderOfForeign
const TArray< SState > & aArrayOfStates
TUint & aOutputConversionFlags

ReduceToNearestMultipleOf(TInt, TInt)

TInt ReduceToNearestMultipleOf(TIntaNumber1,
TIntaNumber2
)[private, static, inline]

Parameters

TInt aNumber1
TInt aNumber2

Member Type Definitions Documentation

Typedef FConvertFromIntermediateBufferInPlace

typedef void(*FConvertFromIntermediateBufferInPlace

A pointer to a function which "mangles" text when converting from Unicode into a complex modal or non-modal foreign character set encoding.

It might insert a shifting character, escape sequence, or other special characters.If the target character set encoding is modal, the implementation of this function may call the CnvUtilities::ConvertFromIntermediateBufferInPlace() utility function which is provided because many modal character sets require an identical implementation of this function.

" convutils.lib "

Typedef FConvertToIntermediateBufferInPlace

typedef void(*FConvertToIntermediateBufferInPlace

A pointer to a function which prepares the text for conversion into Unicode.

For instance it might remove any shifting or other special characters. Called when converting from a non-modal complex character set encoding into Unicode.

" convutils.lib "

Typedef FNumberOfBytesAbleToConvert

typedef TInt(*FNumberOfBytesAbleToConvert

A pointer to a function which calculates the number of consecutive bytes in the remainder of the foreign descriptor which can be converted using the current character set's conversion data.

Called when converting from a non-modal complex character set encoding into Unicode. It may return a negative CCnvCharacterSetConverter::TError value to indicate an error in the encoding.

" convutils.lib "