Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: vstaticutils.h
Link against: versit.lib

Class VersitUtils

class VersitUtils;

Description

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

Members

Defined in VersitUtils:
AddEscapedString(), AddEscapedString(), AdditionalPropertyValueFromStorageL(), AllocateAdditionalPropertyStorageL(), CharConvCharSetUid(), CheckAndIgnoreCustomErrorL(), ConArcEncodeL(), ConArcEncodingUid(), DescriptorContainsOnlySevenBitCharacters(), EightBitEncoding(), EightBitEncoding(), FreeAdditionalPropertyStorageL(), IANACharacterSetName(), IANAEncodingName(), IsBeginOrEnd(), IsNoneWhiteSpaceChar(), IsNoneWhiteSpaceWideChar(), IsWhiteSpace(), ParseForArrayPropertiesL(), RemoveEscapeChars(), RemoveEscapeChars(), RemoveEscapeChars(), RemoveEscapeChars(), RequiresEncoding(), StripWhiteSpace(), StripWhiteSpace(), UncodeToNarrowL(), WrapLinesL()


Member functions


EightBitEncoding()

static IMPORT_C TBool EightBitEncoding(Versit::TVersitCharSet aCharSet);

Description

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.

Return value

TBool

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


EightBitEncoding()

static IMPORT_C TBool EightBitEncoding(TUint aCharSetId);

Description

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

Parameters

TUint aCharSetId

A character set ID.

Return value

TBool

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


ConArcEncodingUid()

static IMPORT_C TUid ConArcEncodingUid(Versit::TVersitEncoding aEncoding);

Description

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

Parameters

Versit::TVersitEncoding aEncoding

An encoding type.

Return value

TUid

The UID of a character set converter.

See also:


IANACharacterSetName()

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

Description

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

Parameters

Versit::TVersitCharSet aCharSet

A character set.

Return value

const TDesC8 &

An IANA character set name.


IANAEncodingName()

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

Description

Returns the MIME encoding type corresponding to the specified encoding.

Parameters

Versit::TVersitEncoding aEncoding

An encoding type.

Return value

const TDesC8 &

The MIME encoding type corresponding to the specified encoding.


CharConvCharSetUid()

static IMPORT_C TUid CharConvCharSetUid(Versit::TVersitCharSet aVersitSet);

Description

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

Parameters

Versit::TVersitCharSet aVersitSet

A character set identifier.

Return value

TUid

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


DescriptorContainsOnlySevenBitCharacters()

static IMPORT_C TBool DescriptorContainsOnlySevenBitCharacters(const TDesC &aText);

Description

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.

Return value

TBool

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


RequiresEncoding()

static IMPORT_C TBool RequiresEncoding(const TDesC &aText);

Description

Tests whether the specified text requires encoding.

Parameters

const TDesC &aText

Text to be tested.

Return value

TBool

ETrue if the specified text needs encoding, otherwise EFalse.


UncodeToNarrowL()

static IMPORT_C void UncodeToNarrowL(const TDesC &aUnicode, TDes8 &aNarrow, const Versit::TEncodingAndCharset &aEncodingCharset);

Description

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.


AddEscapedString()

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

Description

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

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

Description

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.


ConArcEncodeL()

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

Description

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


WrapLinesL()

static IMPORT_C void WrapLinesL(CBufBase &aBuffer, TInt aMaxLineLength);

Description

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.


CheckAndIgnoreCustomErrorL()

static IMPORT_C TBool CheckAndIgnoreCustomErrorL(TInt aError);

Description

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.

Return value

TBool

ETrue if the error code is Versit-specific.


RemoveEscapeChars()

static IMPORT_C void RemoveEscapeChars(TPtr8 &aText);

Description

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

Parameters

TPtr8 &aText

A raw 8-bit string value.


RemoveEscapeChars()

static IMPORT_C void RemoveEscapeChars(HBufC16 &aText);

Description

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

Parameters

HBufC16 &aText

A raw 16-bit string value.


RemoveEscapeChars()

static IMPORT_C void RemoveEscapeChars(HBufC16 &aText, TUint aCharSetUid);

Description

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

static IMPORT_C void RemoveEscapeChars(TPtr16 &aText, TUint aCharSetUid);

Description

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.


IsNoneWhiteSpaceChar()

static IMPORT_C TBool IsNoneWhiteSpaceChar(const TDesC8 &aString);

Description

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.

Return value

TBool

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


StripWhiteSpace()

static IMPORT_C void StripWhiteSpace(TPtr8 &aString);

Description

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

Parameters

TPtr8 &aString

A 8-bit string.


StripWhiteSpace()

static IMPORT_C void StripWhiteSpace(TPtr16 &aString);

Description

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

Parameters

TPtr16 &aString

A 16-bit string.


IsWhiteSpace()

static inline TBool IsWhiteSpace(TUint aChar);

Description

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

Parameters

TUint aChar

The character to test.

Return value

TBool

ETrue if the character is white space, otherwise EFalse.


IsBeginOrEnd()

static inline TBool IsBeginOrEnd(TUid aUid);

Description

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

Parameters

TUid aUid

The UID to test.

Return value

TBool

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


IsNoneWhiteSpaceWideChar()

static IMPORT_C TBool IsNoneWhiteSpaceWideChar(const TDesC16 &aString);

Description

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.

Return value

TBool

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


ParseForArrayPropertiesL()

static IMPORT_C CDesCArray *ParseForArrayPropertiesL(TPtr16 aStringValue, TUint aLineCharacterSetId);

Description

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.

Return value

CDesCArray *

Array of property values found in the string.


AllocateAdditionalPropertyStorageL()

static IMPORT_C void AllocateAdditionalPropertyStorageL(CVersitTlsData &aTlsData, CParserProperty &aProperty, TPtr16 &aStringValue, TUint aLineCharacterSetId);

Description

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.


FreeAdditionalPropertyStorageL()

static IMPORT_C void FreeAdditionalPropertyStorageL(const CParserProperty &aProperty);

Description

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.

Parameters

const CParserProperty &aProperty

The property which may have additional storage associated with it.

See also:


AdditionalPropertyValueFromStorageL()

static IMPORT_C CParserPropertyValue *AdditionalPropertyValueFromStorageL(const CParserProperty &aProperty);

Description

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

Parameters

const CParserProperty &aProperty

The property that may have additional associated data.

Return value

CParserPropertyValue *

Additional storage property value associated with the specified property.

See also: