CSmsAlphabetConverter Class Reference

class CSmsAlphabetConverter : public CBase

Utility to provide piecewise character set conversion to / from unpacked user data elements.

Inherits from

Public Member Functions
~CSmsAlphabetConverter ()
TSmsDataCodingScheme::TSmsAlphabet Alphabet ()
void ConfirmAlternativeEncoderL ( TSmsEncoding )
void ConversionPropertiesL ( TSmsAlphabetConversionProperties &)
IMPORT_C TPtrC8 ConvertFromNativeL (const TDesC &)
IMPORT_C TPtrC8 ConvertFromNativeL (const TDesC &, TSmsEncoding , TInt &, TInt &)
IMPORT_C TPtrC ConvertToNativeL (const TDesC8 &)
IMPORT_C TPtrC ConvertToNativeL (const TDesC8 &, TSmsEncoding )
TSmsEncoding FindBestAlternativeEncodingL (const TDesC &, TSmsEncoding )
TBool IsSupportedL ( TChar )
TBool IsSupportedL (const TDesC &, TInt &, TInt &)
TBool IsSupportedL ( TChar , TSmsEncoding , TBool &, TBool &)
TBool IsSupportedL (const TDesC &, TSmsEncoding , TInt &, TInt &, TInt &, TInt &)
IMPORT_C CSmsAlphabetConverter * NewLC ( CCnvCharacterSetConverter &, RFs &, TSmsDataCodingScheme::TSmsAlphabet , TBool )
void ResetUnconvertedNativeCharacters ()
void ResetUnconvertedUDElements ()
TPtrC UnconvertedNativeCharacters ()
TPtrC8 UnconvertedUDElements ()
Private Member Functions
CSmsAlphabetConverter ( CCnvCharacterSetConverter &, RFs &, TSmsDataCodingScheme::TSmsAlphabet , TBool )
TPtr16 CheckAllocBufferL ( HBufC16 **, TInt , TInt )
TPtr8 CheckAllocBufferL ( HBufC8 **, TInt , TInt )
void ConstructL ()
void GetAlternativeEncoderIDL ( TSmsEncoding , TUint &)
void PrepareForConversionFromNativeL ( TSmsEncoding )
void PrepareForConversionToNativeL ( TSmsEncoding )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TSmsAlphabetWidthConversion { ESmsAlphabetWidthConversionFixed , ESmsAlphabetWidthConversionVariable }
Private Member Enumerations
enum anonymous { KMaxSmsAlphabetConversionRetries  = 4 }
enum anonymous { KMinSmsAlphabetConversionAllocIncrement  = 4 }
enum anonymous { }
enum anonymous { }
Private Attributes
CCnvCharacterSetConverter & iCharacterSetConverter
HBufC * iConvertedNativeCharacters
HBufC8 * iConvertedUDElements
RFs & iFs
TBool iIsBinary
TSmsDataCodingScheme::TSmsAlphabet iSmsAlphabet
HBufC * iUnconvertedNativeCharacters
TPtr iUnconvertedNativeCharactersPtr
HBufC8 * iUnconvertedUDElements
TPtr8 iUnconvertedUDElementsPtr

Constructor & Destructor Documentation

CSmsAlphabetConverter(CCnvCharacterSetConverter &, RFs &, TSmsDataCodingScheme::TSmsAlphabet, TBool)

CSmsAlphabetConverter ( CCnvCharacterSetConverter & aCharacterSetConverter,
RFs & aFs,
TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,
TBool aIsBinary
) [private]

Parameters

CCnvCharacterSetConverter & aCharacterSetConverter
RFs & aFs
TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet
TBool aIsBinary

~CSmsAlphabetConverter()

IMPORT_C ~CSmsAlphabetConverter ( )
Destructor.
capability
None

Member Functions Documentation

Alphabet()

TSmsDataCodingScheme::TSmsAlphabet Alphabet ( ) const [inline]

Gets the coding scheme alphabet.

CheckAllocBufferL(HBufC16 **, TInt, TInt)

TPtr16 CheckAllocBufferL ( HBufC16 ** aBuffer,
TInt aMaxLength,
TInt aUsedLength
) [private]

Parameters

HBufC16 ** aBuffer
TInt aMaxLength
TInt aUsedLength

CheckAllocBufferL(HBufC8 **, TInt, TInt)

TPtr8 CheckAllocBufferL ( HBufC8 ** aBuffer,
TInt aMaxLength,
TInt aUsedLength
) [private]

Parameters

HBufC8 ** aBuffer
TInt aMaxLength
TInt aUsedLength

ConfirmAlternativeEncoderL(TSmsEncoding)

void ConfirmAlternativeEncoderL ( TSmsEncoding aEncoding ) const

Parameters

TSmsEncoding aEncoding

ConstructL()

void ConstructL ( ) [private]

ConversionPropertiesL(TSmsAlphabetConversionProperties &)

void ConversionPropertiesL ( TSmsAlphabetConversionProperties & aConversionProperties ) const

Parameters

TSmsAlphabetConversionProperties & aConversionProperties

ConvertFromNativeL(const TDesC &)

IMPORT_C TPtrC8 ConvertFromNativeL ( const TDesC & aNativeCharacters )

Converts from the native character set to unpacked user data elements of the desired character set.

The function stores the converted data internally.

capability
None

Parameters

const TDesC & aNativeCharacters The native character set data (Unicode only)

ConvertFromNativeL(const TDesC &, TSmsEncoding, TInt &, TInt &)

IMPORT_C TPtrC8 ConvertFromNativeL ( const TDesC & aNativeCharacters,
TSmsEncoding aEncoding,
TInt & aNumberOfUnconvertibleCharacters,
TInt & aNumberOfDowngradedCharacters
)

Converts from the native character set to unpacked user data elements of the desired character set.

The function stores the converted data internally.

capability
None

Parameters

const TDesC & aNativeCharacters The native character set data (Unicode only)
TSmsEncoding aEncoding Alternative 7bit encoding to used (if needed)
TInt & aNumberOfUnconvertibleCharacters Number of characters unconverted
TInt & aNumberOfDowngradedCharacters Number of characters downgraded

ConvertToNativeL(const TDesC8 &)

IMPORT_C TPtrC ConvertToNativeL ( const TDesC8 & aUDElements )

Converts the user data elements of the specified character set to the native character set.

capability
None

Parameters

const TDesC8 & aUDElements The converted character set data

ConvertToNativeL(const TDesC8 &, TSmsEncoding)

IMPORT_C TPtrC ConvertToNativeL ( const TDesC8 & aUDElements,
TSmsEncoding aEncoding
)

Parameters

const TDesC8 & aUDElements
TSmsEncoding aEncoding

FindBestAlternativeEncodingL(const TDesC &, TSmsEncoding)

TSmsEncoding FindBestAlternativeEncodingL ( const TDesC & aNativeCharacters,
TSmsEncoding aSuggestedEncoding
)

Given a piece of text and an alternative encoding, this function works out which encoding is best to use and returns the ID of that converter.

Parameters

const TDesC & aNativeCharacters Text to use as a sample.
TSmsEncoding aSuggestedEncoding

GetAlternativeEncoderIDL(TSmsEncoding, TUint &)

void GetAlternativeEncoderIDL ( TSmsEncoding aEncoding,
TUint & aEncoderID
) const [private]

This function returns the alternative encoding converters that are used incase the default GSM encoding cannot encode the message completely without data loss.

leave
KErrArgument if the encoding enum is invalid or

Parameters

TSmsEncoding aEncoding Encoding to obtain the converter for.
TUint & aEncoderID Returned converter UID if present.

IsSupportedL(TChar)

TBool IsSupportedL ( TChar aChar )

Tests if the character is supported by the current character set. This function can be used with 7bit and 8bit alphabets.

Note:

Since the function is based on the old behaviour (pre-PREQ2090) it does not accept a downgraded character or alternative encoding as being supported.

Parameters

TChar aChar Character to investigate.

IsSupportedL(const TDesC &, TInt &, TInt &)

TBool IsSupportedL ( const TDesC & aDes,
TInt & aNumberOfUnconvertibleCharacters,
TInt & aIndexOfFirstUnconvertibleCharacter
)

Tests if the descriptor text is supported by the current character set. This function can be used with 7bit and 8bit alphabets.

Parameters

const TDesC & aDes Text string to check.
TInt & aNumberOfUnconvertibleCharacters Exit param for the number of characters unconvertible.
TInt & aIndexOfFirstUnconvertibleCharacter Exit param for the first unconverted character.

IsSupportedL(TChar, TSmsEncoding, TBool &, TBool &)

TBool IsSupportedL ( TChar aChar,
TSmsEncoding aEncoding,
TBool & aIsDowngrade,
TBool & aRequiresAlternativeEncoding
)

Tests if the character is supported by the current character set. This function can be used with 7bit and 8bit alphabets.

Parameters

TChar aChar Character to investigate.
TSmsEncoding aEncoding Alternative 7bit encoding (if used).
TBool & aIsDowngrade Exit param set to ETrue if the character has to be downgraded.
TBool & aRequiresAlternativeEncoding Exit param set to ETrue if the alternative encoding has to be used to encode it.

IsSupportedL(const TDesC &, TSmsEncoding, TInt &, TInt &, TInt &, TInt &)

TBool IsSupportedL ( const TDesC & aDes,
TSmsEncoding aEncoding,
TInt & aNumberOfUnconvertibleCharacters,
TInt & aNumberOfDowngradedCharacters,
TInt & aNumberRequiringAlternativeEncoding,
TInt & aIndexOfFirstUnconvertibleCharacter
)

Tests if the descriptor text is supported by the current character set. This function can be used with 7bit and 8bit alphabets.

Parameters

const TDesC & aDes Text string to check.
TSmsEncoding aEncoding Alternative 7bit encoding (if used).
TInt & aNumberOfUnconvertibleCharacters Exit param for the number of characters unconvertible.
TInt & aNumberOfDowngradedCharacters Exit param for the number of downgraded characters.
TInt & aNumberRequiringAlternativeEncoding Exit param for the number of characters requiring use of the alternative encoder.
TInt & aIndexOfFirstUnconvertibleCharacter Exit param for the first unconverted character.

NewLC(CCnvCharacterSetConverter &, RFs &, TSmsDataCodingScheme::TSmsAlphabet, TBool)

IMPORT_C CSmsAlphabetConverter * NewLC ( CCnvCharacterSetConverter & aCharacterSetConverter,
RFs & aFs,
TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet,
TBool aIsBinary
) [static]

Allocates and creates a CSmsAlphabetConverter object, specifying an Alphabet Coding scheme and a Binary flag.

capability
None

Parameters

CCnvCharacterSetConverter & aCharacterSetConverter Pre-initialised character set converter
RFs & aFs File system handle
TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabet Data coding scheme alphabet
TBool aIsBinary Set to true for WAP or compressed data

PrepareForConversionFromNativeL(TSmsEncoding)

void PrepareForConversionFromNativeL ( TSmsEncoding aEncoding ) [private]

Prepares the converted for conversion from native charset. Character set specific preparation is performed here.

Parameters

TSmsEncoding aEncoding Alternative 7bit encoding to use if required.

PrepareForConversionToNativeL(TSmsEncoding)

void PrepareForConversionToNativeL ( TSmsEncoding aEncoding ) [private]

Prepares the converted for conversion to unicode. Character set specific preparation is performed here.

Parameters

TSmsEncoding aEncoding Alternative 7bit encoding to use if required.

ResetUnconvertedNativeCharacters()

void ResetUnconvertedNativeCharacters ( ) [inline]

Resets the unconverted native character buffer.

ResetUnconvertedUDElements()

void ResetUnconvertedUDElements ( ) [inline]

Resets the unconverted user data elements buffer.

UnconvertedNativeCharacters()

TPtrC UnconvertedNativeCharacters ( ) [inline]

Gets the unconverted native characters.

UnconvertedUDElements()

TPtrC8 UnconvertedUDElements ( ) [inline]

Gets the unconverted user data elements.

Member Enumerations Documentation

Enum anonymous

Enumerators

KMaxSmsAlphabetConversionRetries = 4

Enum anonymous

Enumerators

KMinSmsAlphabetConversionAllocIncrement = 4

Enum anonymous

Enumerators

Enum anonymous

Enumerators

Enum TSmsAlphabetWidthConversion

Indicates whether there is a fixed relationship between the number of characters and user data elements.

For example, Unicode characters always map to a single SMS UCS2 character, while a Unicode character might map to one, two or more SMS 7-bit User Data Elements (extended 7-bit characters).

Enumerators

ESmsAlphabetWidthConversionFixed

Fixed relationship.

ESmsAlphabetWidthConversionVariable

Variable relationship.

Member Data Documentation

CCnvCharacterSetConverter & iCharacterSetConverter

CCnvCharacterSetConverter & iCharacterSetConverter [private]

HBufC * iConvertedNativeCharacters

HBufC * iConvertedNativeCharacters [private]

HBufC8 * iConvertedUDElements

HBufC8 * iConvertedUDElements [private]

RFs & iFs

RFs & iFs [private]

TBool iIsBinary

TBool iIsBinary [private]

TSmsDataCodingScheme::TSmsAlphabet iSmsAlphabet

TSmsDataCodingScheme::TSmsAlphabet iSmsAlphabet [private]

HBufC * iUnconvertedNativeCharacters

HBufC * iUnconvertedNativeCharacters [private]

TPtr iUnconvertedNativeCharactersPtr

TPtr iUnconvertedNativeCharactersPtr [private]

HBufC8 * iUnconvertedUDElements

HBufC8 * iUnconvertedUDElements [private]

TPtr8 iUnconvertedUDElementsPtr

TPtr8 iUnconvertedUDElementsPtr [private]