CSmsAlphabetConverter Class Reference

class CSmsAlphabetConverter : public CBase

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

Inherits from

  • CSmsAlphabetConverter
Public Member Functions
~CSmsAlphabetConverter()
TSmsDataCodingScheme::TSmsAlphabet Alphabet()
voidConfirmAlternativeEncoderL(TSmsEncoding)
voidConversionPropertiesL(TSmsAlphabetConversionProperties &)
IMPORT_C TPtrC8ConvertFromNativeL(const TDesC &)
IMPORT_C TPtrC8ConvertFromNativeL(const TDesC &, TSmsEncoding, TInt &, TInt &)
IMPORT_C TPtrCConvertToNativeL(const TDesC8 &)
IMPORT_C TPtrCConvertToNativeL(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)
voidResetUnconvertedNativeCharacters()
voidResetUnconvertedUDElements()
TPtrC UnconvertedNativeCharacters()
TPtrC8 UnconvertedUDElements()
Private Member Functions
CSmsAlphabetConverter(CCnvCharacterSetConverter &, RFs &, TSmsDataCodingScheme::TSmsAlphabet, TBool)
TPtr16 CheckAllocBufferL(HBufC16 **, TInt, TInt)
TPtr8 CheckAllocBufferL(HBufC8 **, TInt, TInt)
voidConstructL()
voidGetAlternativeEncoderIDL(TSmsEncoding, TUint &)
voidPrepareForConversionFromNativeL(TSmsEncoding)
voidPrepareForConversionToNativeL(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
enumTSmsAlphabetWidthConversion { ESmsAlphabetWidthConversionFixed, ESmsAlphabetWidthConversionVariable }
Private Member Enumerations
enumanonymous { KMaxSmsAlphabetConversionRetries = 4 }
enumanonymous { KMinSmsAlphabetConversionAllocIncrement = 4 }
enumanonymous { }
enumanonymous { }
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::TSmsAlphabetaSmsAlphabet,
TBoolaIsBinary
)[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,
TIntaMaxLength,
TIntaUsedLength
)[private]

Parameters

HBufC16 ** aBuffer
TInt aMaxLength
TInt aUsedLength

CheckAllocBufferL(HBufC8 **, TInt, TInt)

TPtr8 CheckAllocBufferL(HBufC8 **aBuffer,
TIntaMaxLength,
TIntaUsedLength
)[private]

Parameters

HBufC8 ** aBuffer
TInt aMaxLength
TInt aUsedLength

ConfirmAlternativeEncoderL(TSmsEncoding)

voidConfirmAlternativeEncoderL(TSmsEncodingaEncoding)const

Parameters

TSmsEncoding aEncoding

ConstructL()

voidConstructL()[private]

ConversionPropertiesL(TSmsAlphabetConversionProperties &)

voidConversionPropertiesL(TSmsAlphabetConversionProperties &aConversionProperties)const

Parameters

TSmsAlphabetConversionProperties & aConversionProperties

ConvertFromNativeL(const TDesC &)

IMPORT_C TPtrC8ConvertFromNativeL(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 & aNativeCharactersThe native character set data (Unicode only)

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

IMPORT_C TPtrC8ConvertFromNativeL(const TDesC &aNativeCharacters,
TSmsEncodingaEncoding,
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 & aNativeCharactersThe native character set data (Unicode only)
TSmsEncoding aEncodingAlternative 7bit encoding to used (if needed)
TInt & aNumberOfUnconvertibleCharactersNumber of characters unconverted
TInt & aNumberOfDowngradedCharactersNumber of characters downgraded

ConvertToNativeL(const TDesC8 &)

IMPORT_C TPtrCConvertToNativeL(const TDesC8 &aUDElements)

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

capability
None

Parameters

const TDesC8 & aUDElementsThe converted character set data

ConvertToNativeL(const TDesC8 &, TSmsEncoding)

IMPORT_C TPtrCConvertToNativeL(const TDesC8 &aUDElements,
TSmsEncodingaEncoding
)

Parameters

const TDesC8 & aUDElements
TSmsEncoding aEncoding

FindBestAlternativeEncodingL(const TDesC &, TSmsEncoding)

TSmsEncoding FindBestAlternativeEncodingL(const TDesC &aNativeCharacters,
TSmsEncodingaSuggestedEncoding
)

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 & aNativeCharactersText to use as a sample.
TSmsEncoding aSuggestedEncoding

GetAlternativeEncoderIDL(TSmsEncoding, TUint &)

voidGetAlternativeEncoderIDL(TSmsEncodingaEncoding,
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 aEncodingEncoding to obtain the converter for.
TUint & aEncoderIDReturned converter UID if present.

IsSupportedL(TChar)

TBool IsSupportedL(TCharaChar)

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 aCharCharacter 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 & aDesText string to check.
TInt & aNumberOfUnconvertibleCharactersExit param for the number of characters unconvertible.
TInt & aIndexOfFirstUnconvertibleCharacterExit param for the first unconverted character.

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

TBool IsSupportedL(TCharaChar,
TSmsEncodingaEncoding,
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 aCharCharacter to investigate.
TSmsEncoding aEncodingAlternative 7bit encoding (if used).
TBool & aIsDowngradeExit param set to ETrue if the character has to be downgraded.
TBool & aRequiresAlternativeEncodingExit 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,
TSmsEncodingaEncoding,
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 & aDesText string to check.
TSmsEncoding aEncodingAlternative 7bit encoding (if used).
TInt & aNumberOfUnconvertibleCharactersExit param for the number of characters unconvertible.
TInt & aNumberOfDowngradedCharactersExit param for the number of downgraded characters.
TInt & aNumberRequiringAlternativeEncodingExit param for the number of characters requiring use of the alternative encoder.
TInt & aIndexOfFirstUnconvertibleCharacterExit param for the first unconverted character.

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

IMPORT_C CSmsAlphabetConverter *NewLC(CCnvCharacterSetConverter &aCharacterSetConverter,
RFs &aFs,
TSmsDataCodingScheme::TSmsAlphabetaSmsAlphabet,
TBoolaIsBinary
)[static]

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

capability
None

Parameters

CCnvCharacterSetConverter & aCharacterSetConverterPre-initialised character set converter
RFs & aFsFile system handle
TSmsDataCodingScheme::TSmsAlphabet aSmsAlphabetData coding scheme alphabet
TBool aIsBinarySet to true for WAP or compressed data

PrepareForConversionFromNativeL(TSmsEncoding)

voidPrepareForConversionFromNativeL(TSmsEncodingaEncoding)[private]

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

Parameters

TSmsEncoding aEncodingAlternative 7bit encoding to use if required.

PrepareForConversionToNativeL(TSmsEncoding)

voidPrepareForConversionToNativeL(TSmsEncodingaEncoding)[private]

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

Parameters

TSmsEncoding aEncodingAlternative 7bit encoding to use if required.

ResetUnconvertedNativeCharacters()

voidResetUnconvertedNativeCharacters()[inline]

Resets the unconverted native character buffer.

ResetUnconvertedUDElements()

voidResetUnconvertedUDElements()[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]