VersitUtils Class Reference

class VersitUtils

A utility class which provides functions for handling character set conversions, and for the parsing of character strings.

Public Member Functions
IMPORT_C voidAddEscapedString(TDes &, const TDesC &, Versit::TVersitCharSet)
IMPORT_C voidAddEscapedString(TDes &, const TDesC &, TUint)
IMPORT_C CParserPropertyValue *AdditionalPropertyValueFromStorageL(const CParserProperty &)
IMPORT_C voidAllocateAdditionalPropertyStorageL(CVersitTlsData &, CParserProperty &, TPtr16 &, TUint)
IMPORT_C TUidCharConvCharSetUid(Versit::TVersitCharSet)
Versit::TVersitCharSet CharSet(TUint)
IMPORT_C TBoolCheckAndIgnoreCustomErrorL(TInt)
IMPORT_C voidConArcEncodeL(RReadStream &, CBufBase &, TUid)
IMPORT_C TUidConArcEncodingUid(Versit::TVersitEncoding)
IMPORT_C TBoolDescriptorContainsOnlySevenBitCharacters(const TDesC &)
IMPORT_C TBoolEightBitEncoding(Versit::TVersitCharSet)
IMPORT_C TBoolEightBitEncoding(TUint)
IMPORT_C voidFreeAdditionalPropertyStorageL(const CParserProperty &)
IMPORT_C const TDesC8 &IANACharacterSetName(Versit::TVersitCharSet)
IMPORT_C const TDesC8 &IANAEncodingName(Versit::TVersitEncoding)
TBool IsBeginOrEnd(TUid)
IMPORT_C TBoolIsNoneWhiteSpaceChar(const TDesC8 &)
IMPORT_C TBoolIsNoneWhiteSpaceWideChar(const TDesC16 &)
TBool IsWhiteSpace(TUint)
IMPORT_C CDesCArray *ParseForArrayPropertiesL(TPtr16, TUint)
IMPORT_C voidRemoveEscapeChars(TPtr8 &)
IMPORT_C voidRemoveEscapeChars(HBufC16 &)
IMPORT_C voidRemoveEscapeChars(HBufC16 &, TUint)
IMPORT_C voidRemoveEscapeChars(TPtr16 &, TUint)
IMPORT_C TBoolRequiresEncoding(const TDesC &)
IMPORT_C voidStripWhiteSpace(TPtr8 &)
IMPORT_C voidStripWhiteSpace(TPtr16 &)
IMPORT_C voidUncodeToNarrowL(const TDesC &, TDes8 &, const Versit::TEncodingAndCharset &)
IMPORT_C voidWrapLinesL(CBufBase &, TInt)
Private Member Functions
voidAddEscapedString(TBool, TDes &, const TDesC &)
const TDesC &EscapeChar(TBool)

Member Functions Documentation

AddEscapedString(TDes &, const TDesC &, Versit::TVersitCharSet)

IMPORT_C voidAddEscapedString(TDes &aDestination,
const TDesC &aTextToEscape,
Versit::TVersitCharSetaCharSet
)[static]

Adds an escape character before the semi-colons in a given text string.

Parameters

TDes & aDestinationOn return, the escaped text.
const TDesC & aTextToEscapeText to be escaped.
Versit::TVersitCharSet aCharSetA Versit character set identifier.

AddEscapedString(TDes &, const TDesC &, TUint)

IMPORT_C voidAddEscapedString(TDes &aDestination,
const TDesC &aTextToEscape,
TUintaCharSetId
)[static]

Adds an escape character before the semi-colons in a given text string.

Parameters

TDes & aDestinationOn return, the escaped text.
const TDesC & aTextToEscapeText to be escaped.
TUint aCharSetIdA character set ID. These are defined in charconv.h.

AddEscapedString(TBool, TDes &, const TDesC &)

voidAddEscapedString(TBoolaIsShiftJis,
TDes &aDestination,
const TDesC &aTextToEscape
)[private, static]

Parameters

TBool aIsShiftJis
TDes & aDestination
const TDesC & aTextToEscape

AdditionalPropertyValueFromStorageL(const CParserProperty &)

IMPORT_C CParserPropertyValue *AdditionalPropertyValueFromStorageL(const CParserProperty &aProperty)[static]

Retrieves any additional storage property value associated with the specified property.

VersitUtils::AllocateAdditionalPropertyStorageL()

Parameters

const CParserProperty & aPropertyThe property that may have additional associated data.

AllocateAdditionalPropertyStorageL(CVersitTlsData &, CParserProperty &, TPtr16 &, TUint)

IMPORT_C voidAllocateAdditionalPropertyStorageL(CVersitTlsData &aTlsData,
CParserProperty &aProperty,
TPtr16 &aStringValue,
TUintaLineCharacterSetId
)[static]

Allocates an additional property value object for certain CParserProperty objects.

This is needed to support the parsing and storage of Japanese pronunciation SOUND properties. Due to the existing Symbian Versit architecture, it was not possible to change the underlying storage type of the SOUND property to an array data type. Therefore, this method provides a means of storing the array-based value which can be retrieved when necessary.

It is called by CParserVCard::MakePropertyValueSoundL().

Parameters

CVersitTlsData & aTlsDataThe CVersitParser::iStaticUtils member.
CParserProperty & aPropertyA SOUND property.
TPtr16 & aStringValueA 16-bit raw property value string.
TUint aLineCharacterSetIdThe character set ID of the current line. This is required to identify the escape character.

CharConvCharSetUid(Versit::TVersitCharSet)

IMPORT_C TUidCharConvCharSetUid(Versit::TVersitCharSetaVersitSet)[static]

Returns the character converter UID associated with the specified Versit character set identifier.

Parameters

Versit::TVersitCharSet aVersitSetA character set identifier.

CharSet(TUint)

Versit::TVersitCharSet CharSet(TUintaCharConvCharSetUid)[static]

Returns the Versit character set identifier associated with the specified character converter UID.

Parameters

TUint aCharConvCharSetUidA character converter UID. These UIDs are defined in charconv.h.

CheckAndIgnoreCustomErrorL(TInt)

IMPORT_C TBoolCheckAndIgnoreCustomErrorL(TIntaError)[static]

Tests whether an error code is Versit-specific or not and leaves (with that error code) if it is not.

Parameters

TInt aErrorError code to test.

ConArcEncodeL(RReadStream &, CBufBase &, TUid)

IMPORT_C voidConArcEncodeL(RReadStream &aSource,
CBufBase &aTarget,
TUidaConArcEncodingUid
)[static]

Encodes a buffer using the specified character set converter.

Parameters

RReadStream & aSourceBuffer to be encoded.
CBufBase & aTargetOn return, the encoded buffer.
TUid aConArcEncodingUidConverter UID, as returned by VersitUtils::ConArcEncodingUid().

ConArcEncodingUid(Versit::TVersitEncoding)

IMPORT_C TUidConArcEncodingUid(Versit::TVersitEncodingaEncoding)[static]

Returns the UID of a character set converter suitable for the specified encoding.

CCnaConverterList::NewConverterL()

Parameters

Versit::TVersitEncoding aEncodingAn encoding type.

DescriptorContainsOnlySevenBitCharacters(const TDesC &)

IMPORT_C TBoolDescriptorContainsOnlySevenBitCharacters(const TDesC &aText)[static]

Tests whether all of the characters in the specified text can be represented in 7-bit ASCII.

Parameters

const TDesC & aTextText to be tested.

EightBitEncoding(Versit::TVersitCharSet)

IMPORT_C TBoolEightBitEncoding(Versit::TVersitCharSetaCharSet)[static]

Tests whether the specified character set is encoded using 8 bits or not. For instance ASCII is 7-bit; ISO-8859-1 is 8-bit.

Parameters

Versit::TVersitCharSet aCharSetA character set.

EightBitEncoding(TUint)

IMPORT_C TBoolEightBitEncoding(TUintaCharSetId)[static]

Tests whether the character set identified by the specified ID is encoded using 8 bits or not.

Parameters

TUint aCharSetIdA character set ID.

EscapeChar(TBool)

const TDesC &EscapeChar(TBoolaIsShiftJis)[private, static]

If using shifjis charset return shiftjis charset as generated by relevant charconv plugin else return standard unicode escape charcter \

Parameters

TBool aIsShiftJis

FreeAdditionalPropertyStorageL(const CParserProperty &)

IMPORT_C voidFreeAdditionalPropertyStorageL(const CParserProperty &aProperty)[static]

Frees any additional storage associated with the specified property.

Additional storage may have previously been allocated using AllocateAdditionalPropertyStorageL().

This is called by CParserProperty's destructor.

VersitUtils::AllocateAdditionalPropertyStorageL()

Parameters

const CParserProperty & aPropertyThe property which may have additional storage associated with it.

IANACharacterSetName(Versit::TVersitCharSet)

IMPORT_C const TDesC8 &IANACharacterSetName(Versit::TVersitCharSetaCharSet)[static]

Returns the IANA character set name corresponding to the specified character set identifier.

Parameters

Versit::TVersitCharSet aCharSetA character set.

IANAEncodingName(Versit::TVersitEncoding)

IMPORT_C const TDesC8 &IANAEncodingName(Versit::TVersitEncodingaEncoding)[static]

Returns the MIME encoding type corresponding to the specified encoding.

Parameters

Versit::TVersitEncoding aEncodingAn encoding type.

IsBeginOrEnd(TUid)

TBool IsBeginOrEnd(TUidaUid)[static, inline]

Tests whether the specified UID is the Versit Begin or End UID (KVersitTokenBeginUid or KVersitTokenEndUid).

Parameters

TUid aUidThe UID to test.

IsNoneWhiteSpaceChar(const TDesC8 &)

IMPORT_C TBoolIsNoneWhiteSpaceChar(const TDesC8 &aString)[static]

Tests whether the specified 8 bit string contains no white spaces.

Any CR/LF pair at the end of the string is disregarded.

Parameters

const TDesC8 & aStringThe string to test.

IsNoneWhiteSpaceWideChar(const TDesC16 &)

IMPORT_C TBoolIsNoneWhiteSpaceWideChar(const TDesC16 &aString)[static]

Tests whether the specified 16 bit string contains no white spaces.

Any CR/LF pair at the end of the string is disregarded.

Parameters

const TDesC16 & aStringThe string to test.

IsWhiteSpace(TUint)

TBool IsWhiteSpace(TUintaChar)[static, inline]

Tests whether the specified character is white space (either a tab or a space character).

Parameters

TUint aCharThe character to test.

ParseForArrayPropertiesL(TPtr16, TUint)

IMPORT_C CDesCArray *ParseForArrayPropertiesL(TPtr16aStringValue,
TUintaLineCharacterSetId
)[static]

Parses a compound property value string.

The sub-values found are appended to an array, after removal of escape characters. The array is returned, and ownership is transferred to the caller.

Parameters

TPtr16 aStringValueCompound property value string to parse for array elements.
TUint aLineCharacterSetIdThe character set of the current line. This is required in order to identify the escape character.

RemoveEscapeChars(TPtr8 &)

IMPORT_C voidRemoveEscapeChars(TPtr8 &aText)[static]

Removes escape characters (backslashes) from the specified 8-bit string.

Parameters

TPtr8 & aTextA raw 8-bit string value.

RemoveEscapeChars(HBufC16 &)

IMPORT_C voidRemoveEscapeChars(HBufC16 &aText)[static]

Removes escape characters (backslashes) from the specified 16-bit string.

Parameters

HBufC16 & aTextA raw 16-bit string value.

RemoveEscapeChars(HBufC16 &, TUint)

IMPORT_C voidRemoveEscapeChars(HBufC16 &aText,
TUintaCharSetUid
)[static]

Removes escape characters (backslashes or for the Shift-JIS character set, Yen-symbols/backslashes, Shift-JIS behaviour is platform dependent) from the specified 16-bit string.

Parameters

HBufC16 & aTextA raw 16-bit string value.
TUint aCharSetUidThe character set UID of the given 16-bit string; these are defined in charconv.h. This is needed to identify whether or not the character set is Shift-JIS.

RemoveEscapeChars(TPtr16 &, TUint)

IMPORT_C voidRemoveEscapeChars(TPtr16 &aText,
TUintaCharSetUid
)[static]

Removes escape characters (backslashes or for the Shift-JIS character set, Yen-symbols/backslashes, Shift-JIS behaviour is platform dependent) from the specified 16-bit string.

Parameters

TPtr16 & aTextA raw 16 bit string value.
TUint aCharSetUidThe character set UID of the aText parameter. This is required to identify the escape character.

RequiresEncoding(const TDesC &)

IMPORT_C TBoolRequiresEncoding(const TDesC &aText)[static]

Tests whether the specified text requires encoding.

Parameters

const TDesC & aTextText to be tested.

StripWhiteSpace(TPtr8 &)

IMPORT_C voidStripWhiteSpace(TPtr8 &aString)[static]

Strips white space from the beginning and end of the specified 8-bit string.

Parameters

TPtr8 & aStringA 8-bit string.

StripWhiteSpace(TPtr16 &)

IMPORT_C voidStripWhiteSpace(TPtr16 &aString)[static]

Strips white space from the beginning and end of the specified 16-bit string.

Parameters

TPtr16 & aStringA 16-bit string.

UncodeToNarrowL(const TDesC &, TDes8 &, const Versit::TEncodingAndCharset &)

IMPORT_C voidUncodeToNarrowL(const TDesC &aUnicode,
TDes8 &aNarrow,
const Versit::TEncodingAndCharset &aEncodingCharset
)[static]

Converts Unicode text to 8-bit, using the specified character set converter.

Parameters

const TDesC & aUnicodeThe Unicode text to be converted.
TDes8 & aNarrowOn return, the converted text.
const Versit::TEncodingAndCharset & aEncodingCharsetSpecifies the character set converter to use.

WrapLinesL(CBufBase &, TInt)

IMPORT_C voidWrapLinesL(CBufBase &aBuffer,
TIntaMaxLineLength
)[static]

Ensures that a buffer doesn't contain any lines longer than the specified length.

Any lines longer than the specified length are wrapped.

Parameters

CBufBase & aBufferBuffer to be wrapped.
TInt aMaxLineLengthThe maximum line length.