VersitUtils Class Reference

#include <app/vstaticutils.h>

Link against: versit.lib

class VersitUtils
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)

Detailed Description

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

Member Function 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.

ParameterDescription
aDestinationOn return, the escaped text.
aTextToEscapeText to be escaped.
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.

ParameterDescription
aDestinationOn return, the escaped text.
aTextToEscapeText to be escaped.
aCharSetIdA character set ID. These are defined in charconv.h.

AdditionalPropertyValueFromStorageL ( const CParserProperty & )

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

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

See also: VersitUtils::AllocateAdditionalPropertyStorageL()

ParameterDescription
aPropertyThe property that may have additional associated data.

Returns: Additional storage property value associated with the specified property.

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().

ParameterDescription
aTlsDataThe CVersitParser::iStaticUtils member.
aPropertyA SOUND property.
aStringValueA 16-bit raw property value string.
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.

ParameterDescription
aVersitSetA character set identifier.

Returns: The character converter UID associated with the specified Versit character set identifier. These UIDs are defined in charconv.h.

CharSet ( TUint )

Versit::TVersitCharSet CharSet(TUintaCharConvCharSetUid)[static]

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

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

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

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.

ParameterDescription
aErrorError code to test.

Returns: ETrue if the error code is Versit-specific.

ConArcEncodeL ( RReadStream &, CBufBase &, TUid )

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

Encodes a buffer using the specified character set converter.

ParameterDescription
aSourceBuffer to be encoded.
aTargetOn return, the encoded buffer.
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.

See also: CCnaConverterList::NewConverterL()

ParameterDescription
aEncodingAn encoding type.

Returns: The UID of a character set converter.

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.

ParameterDescription
aTextText to be tested.

Returns: ETrue if all of the characters in the specified text can be represented in 7 bit ASCII, otherwise EFalse.

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.

ParameterDescription
aCharSetA character set.

Returns: ETrue if the character set uses 8 bits; EFalse if it uses 7 bits.

EightBitEncoding ( TUint )

IMPORT_C TBoolEightBitEncoding(TUintaCharSetId)[static]

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

ParameterDescription
aCharSetIdA character set ID.

Returns: ETrue if the character set uses 8 bits; EFalse if it uses 7 bits.

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.

See also: VersitUtils::AllocateAdditionalPropertyStorageL()

ParameterDescription
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.

ParameterDescription
aCharSetA character set.

Returns: An IANA character set name.

IANAEncodingName ( Versit::TVersitEncoding )

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

Returns the MIME encoding type corresponding to the specified encoding.

ParameterDescription
aEncodingAn encoding type.

Returns: The MIME encoding type corresponding to the specified encoding.

IsBeginOrEnd ( TUid )

TBool IsBeginOrEnd(TUidaUid)[static, inline]

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

ParameterDescription
aUidThe UID to test.

Returns: ETrue if the UID is the Begin or End UID, otherwise EFalse.

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.

ParameterDescription
aStringThe string to test.

Returns: ETrue if the string contains no white spaces, otherwise EFalse.

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.

ParameterDescription
aStringThe string to test.

Returns: ETrue if the string contains no white spaces, otherwise EFalse.

IsWhiteSpace ( TUint )

TBool IsWhiteSpace(TUintaChar)[static, inline]

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

ParameterDescription
aCharThe character to test.

Returns: ETrue if the character is white space, otherwise EFalse.

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.

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

Returns: Array of property values found in the string.

RemoveEscapeChars ( TPtr8 & )

IMPORT_C voidRemoveEscapeChars(TPtr8 &aText)[static]

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

ParameterDescription
aTextA raw 8-bit string value.

RemoveEscapeChars ( HBufC16 & )

IMPORT_C voidRemoveEscapeChars(HBufC16 &aText)[static]

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

ParameterDescription
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.

ParameterDescription
aTextA raw 16-bit string value.
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.

ParameterDescription
aTextA raw 16 bit string value.
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.

ParameterDescription
aTextText to be tested.

Returns: ETrue if the specified text needs encoding, otherwise EFalse.

StripWhiteSpace ( TPtr8 & )

IMPORT_C voidStripWhiteSpace(TPtr8 &aString)[static]

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

ParameterDescription
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.

ParameterDescription
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.

ParameterDescription
aUnicodeThe Unicode text to be converted.
aNarrowOn return, the converted text.
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.

ParameterDescription
aBufferBuffer to be wrapped.
aMaxLineLengthThe maximum line length.