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 void AddEscapedString ( TDes &, const TDesC &, Versit::TVersitCharSet )
IMPORT_C void AddEscapedString ( TDes &, const TDesC &, TUint )
IMPORT_C CParserPropertyValue * AdditionalPropertyValueFromStorageL (const CParserProperty &)
IMPORT_C void AllocateAdditionalPropertyStorageL ( CVersitTlsData &, CParserProperty &, TPtr16 &, TUint )
IMPORT_C TUid CharConvCharSetUid ( Versit::TVersitCharSet )
Versit::TVersitCharSet CharSet ( TUint )
IMPORT_C TBool CheckAndIgnoreCustomErrorL ( TInt )
IMPORT_C void ConArcEncodeL ( RReadStream &, CBufBase &, TUid )
IMPORT_C TUid ConArcEncodingUid ( Versit::TVersitEncoding )
IMPORT_C TBool DescriptorContainsOnlySevenBitCharacters (const TDesC &)
IMPORT_C TBool EightBitEncoding ( Versit::TVersitCharSet )
IMPORT_C TBool EightBitEncoding ( TUint )
IMPORT_C void FreeAdditionalPropertyStorageL (const CParserProperty &)
IMPORT_C const TDesC8 & IANACharacterSetName ( Versit::TVersitCharSet )
IMPORT_C const TDesC8 & IANAEncodingName ( Versit::TVersitEncoding )
TBool IsBeginOrEnd ( TUid )
IMPORT_C TBool IsNoneWhiteSpaceChar (const TDesC8 &)
IMPORT_C TBool IsNoneWhiteSpaceWideChar (const TDesC16 &)
TBool IsWhiteSpace ( TUint )
IMPORT_C CDesCArray * ParseForArrayPropertiesL ( TPtr16 , TUint )
IMPORT_C void RemoveEscapeChars ( TPtr8 &)
IMPORT_C void RemoveEscapeChars ( HBufC16 &)
IMPORT_C void RemoveEscapeChars ( HBufC16 &, TUint )
IMPORT_C void RemoveEscapeChars ( TPtr16 &, TUint )
IMPORT_C TBool RequiresEncoding (const TDesC &)
IMPORT_C void StripWhiteSpace ( TPtr8 &)
IMPORT_C void StripWhiteSpace ( TPtr16 &)
IMPORT_C void UncodeToNarrowL (const TDesC &, TDes8 &, const Versit::TEncodingAndCharset &)
IMPORT_C void WrapLinesL ( CBufBase &, TInt )
Private Member Functions
void AddEscapedString ( TBool , TDes &, const TDesC &)
const TDesC & EscapeChar ( TBool )

Member Functions Documentation

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

IMPORT_C void AddEscapedString ( TDes & aDestination,
const TDesC & aTextToEscape,
Versit::TVersitCharSet aCharSet
) [static]

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

Parameters

TDes & aDestination On return, the escaped text.
const TDesC & aTextToEscape Text to be escaped.
Versit::TVersitCharSet aCharSet A Versit character set identifier.

AddEscapedString(TDes &, const TDesC &, TUint)

IMPORT_C void AddEscapedString ( TDes & aDestination,
const TDesC & aTextToEscape,
TUint aCharSetId
) [static]

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

Parameters

TDes & aDestination On return, the escaped text.
const TDesC & aTextToEscape Text to be escaped.
TUint aCharSetId A character set ID. These are defined in charconv.h.

AddEscapedString(TBool, TDes &, const TDesC &)

void AddEscapedString ( TBool aIsShiftJis,
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 & aProperty The property that may have additional associated data.

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

IMPORT_C void AllocateAdditionalPropertyStorageL ( CVersitTlsData & aTlsData,
CParserProperty & aProperty,
TPtr16 & aStringValue,
TUint aLineCharacterSetId
) [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 & aTlsData The CVersitParser::iStaticUtils member.
CParserProperty & aProperty A SOUND property.
TPtr16 & aStringValue A 16-bit raw property value string.
TUint aLineCharacterSetId The character set ID of the current line. This is required to identify the escape character.

CharConvCharSetUid(Versit::TVersitCharSet)

IMPORT_C TUid CharConvCharSetUid ( Versit::TVersitCharSet aVersitSet ) [static]

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

Parameters

Versit::TVersitCharSet aVersitSet A character set identifier.

CharSet(TUint)

Versit::TVersitCharSet CharSet ( TUint aCharConvCharSetUid ) [static]

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

Parameters

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

CheckAndIgnoreCustomErrorL(TInt)

IMPORT_C TBool CheckAndIgnoreCustomErrorL ( TInt aError ) [static]

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

Parameters

TInt aError Error code to test.

ConArcEncodeL(RReadStream &, CBufBase &, TUid)

IMPORT_C void ConArcEncodeL ( RReadStream & aSource,
CBufBase & aTarget,
TUid aConArcEncodingUid
) [static]

Encodes a buffer using the specified character set converter.

Parameters

RReadStream & aSource Buffer to be encoded.
CBufBase & aTarget On return, the encoded buffer.
TUid aConArcEncodingUid Converter UID, as returned by VersitUtils::ConArcEncodingUid().

ConArcEncodingUid(Versit::TVersitEncoding)

IMPORT_C TUid ConArcEncodingUid ( Versit::TVersitEncoding aEncoding ) [static]

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

CCnaConverterList::NewConverterL()

Parameters

Versit::TVersitEncoding aEncoding An encoding type.

DescriptorContainsOnlySevenBitCharacters(const TDesC &)

IMPORT_C TBool DescriptorContainsOnlySevenBitCharacters ( const TDesC & aText ) [static]

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

Parameters

const TDesC & aText Text to be tested.

EightBitEncoding(Versit::TVersitCharSet)

IMPORT_C TBool EightBitEncoding ( Versit::TVersitCharSet aCharSet ) [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 aCharSet A character set.

EightBitEncoding(TUint)

IMPORT_C TBool EightBitEncoding ( TUint aCharSetId ) [static]

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

Parameters

TUint aCharSetId A character set ID.

EscapeChar(TBool)

const TDesC & EscapeChar ( TBool aIsShiftJis ) [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 void FreeAdditionalPropertyStorageL ( 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 & aProperty The property which may have additional storage associated with it.

IANACharacterSetName(Versit::TVersitCharSet)

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

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

Parameters

Versit::TVersitCharSet aCharSet A character set.

IANAEncodingName(Versit::TVersitEncoding)

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

Returns the MIME encoding type corresponding to the specified encoding.

Parameters

Versit::TVersitEncoding aEncoding An encoding type.

IsBeginOrEnd(TUid)

TBool IsBeginOrEnd ( TUid aUid ) [static, inline]

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

Parameters

TUid aUid The UID to test.

IsNoneWhiteSpaceChar(const TDesC8 &)

IMPORT_C TBool IsNoneWhiteSpaceChar ( 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 & aString The string to test.

IsNoneWhiteSpaceWideChar(const TDesC16 &)

IMPORT_C TBool IsNoneWhiteSpaceWideChar ( 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 & aString The string to test.

IsWhiteSpace(TUint)

TBool IsWhiteSpace ( TUint aChar ) [static, inline]

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

Parameters

TUint aChar The character to test.

ParseForArrayPropertiesL(TPtr16, TUint)

IMPORT_C CDesCArray * ParseForArrayPropertiesL ( TPtr16 aStringValue,
TUint aLineCharacterSetId
) [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 aStringValue Compound property value string to parse for array elements.
TUint aLineCharacterSetId The character set of the current line. This is required in order to identify the escape character.

RemoveEscapeChars(TPtr8 &)

IMPORT_C void RemoveEscapeChars ( TPtr8 & aText ) [static]

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

Parameters

TPtr8 & aText A raw 8-bit string value.

RemoveEscapeChars(HBufC16 &)

IMPORT_C void RemoveEscapeChars ( HBufC16 & aText ) [static]

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

Parameters

HBufC16 & aText A raw 16-bit string value.

RemoveEscapeChars(HBufC16 &, TUint)

IMPORT_C void RemoveEscapeChars ( HBufC16 & aText,
TUint aCharSetUid
) [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 & aText A raw 16-bit string value.
TUint aCharSetUid The 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 void RemoveEscapeChars ( TPtr16 & aText,
TUint aCharSetUid
) [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 & aText A raw 16 bit string value.
TUint aCharSetUid The character set UID of the aText parameter. This is required to identify the escape character.

RequiresEncoding(const TDesC &)

IMPORT_C TBool RequiresEncoding ( const TDesC & aText ) [static]

Tests whether the specified text requires encoding.

Parameters

const TDesC & aText Text to be tested.

StripWhiteSpace(TPtr8 &)

IMPORT_C void StripWhiteSpace ( TPtr8 & aString ) [static]

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

Parameters

TPtr8 & aString A 8-bit string.

StripWhiteSpace(TPtr16 &)

IMPORT_C void StripWhiteSpace ( TPtr16 & aString ) [static]

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

Parameters

TPtr16 & aString A 16-bit string.

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

IMPORT_C void UncodeToNarrowL ( 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 & aUnicode The Unicode text to be converted.
TDes8 & aNarrow On return, the converted text.
const Versit::TEncodingAndCharset & aEncodingCharset Specifies the character set converter to use.

WrapLinesL(CBufBase &, TInt)

IMPORT_C void WrapLinesL ( CBufBase & aBuffer,
TInt aMaxLineLength
) [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 & aBuffer Buffer to be wrapped.
TInt aMaxLineLength The maximum line length.