Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <EscapeUtils.h>
Link against: inetprotutil.lib

Class EscapeUtils

class EscapeUtils;

Description

Comments : Provides an API to allow data to be escape encoded and decoded. Also provide an API for converting a UNICODE data (16-bit descriptor) into UTF8 data (8-bit descriptor) and vice-verse.

Members

Defined in EscapeUtils:


Member functions


EscapeEncodeL(const TDesC8 &,TEscapeMode)

IMPORT_C static HBufC8* EscapeEncodeL(const TDesC8 &aData, TEscapeMode aMode);

Description

Escape encodes excluded and reserved characters in the data as escape triples. The reserved characters are defined by the escape mode. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Parameters

const TDesC8 &aData

A descriptor with the data to encode.

EscapeUtils::TEscapeMode aMode

An enum specifying the escape mode.

Return value

HBufC8 *

A pointer to a descriptor buffer which contains the escape encoded data.

Leave codes

KUriUtilsErr16BitChar.

A 16-Bit character was found in the data to be escape encoded.


EscapeEncodeL(const TDesC16 &,TEscapeMode)

IMPORT_C static HBufC16* EscapeEncodeL(const TDesC16 &aData, TEscapeMode aMode);

Description

Escape encodes excluded and reserved characters in the data as escape triples. The reserved characters are defined by the escape mode. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Parameters

const TDesC16 &aData

A descriptor with the data to encode.

EscapeUtils::TEscapeMode aMode

An enum specifying the escape mode.

Return value

HBufC16 *

A pointer to a descriptor buffer which contains the escape encoded data.

Leave codes

KUriUtilsErr16BitChar.

A 16-Bit character was found in the data to be escape encoded.


EscapeEncodeL(const TDesC8 &,const TDesC8 &)

IMPORT_C static HBufC8* EscapeEncodeL(const TDesC8 &aData, const TDesC8 &aReservedChars);

Description

Escape encodes excluded and reserved characters in the data as escape triples. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Parameters

const TDesC8 &aData

A descriptor with the data to encode.

const TDesC8 &aReservedChars

A descriptor with the reserved characters.

Return value

HBufC8 *

A pointer to a descriptor buffer which contains the escape encoded data.

Leave codes

KUriUtilsErr16BitChar.

A 16-Bit character was found in the data to be escape encoded.


EscapeEncodeL(const TDesC16 &,const TDesC16 &)

IMPORT_C static HBufC16* EscapeEncodeL(const TDesC16 &aData, const TDesC16 &aReservedChars);

Description

Escape encodes excluded and reserved characters in the data as escape triples. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Parameters

const TDesC16 &aData

A descriptor with the data to encode.

const TDesC16 &aReservedChars

A descriptor with the reserved characters.

Return value

HBufC16 *

A pointer to a descriptor buffer which contains the escape encoded data.

Leave codes

KUriUtilsErr16BitChar.

A 16-Bit character was found in the data to be escape encoded.


EscapeDecodeL(const TDesC8 &)

IMPORT_C static HBufC8* EscapeDecodeL(const TDesC8 &aData);

Description

Escape decodes the data.

Parameters

const TDesC8 &aData

A descriptor with the data to decode.

Return value

HBufC8 *

A pointer to a descriptor buffer which contains the escape decoded data.


EscapeDecodeL(const TDesC16 &)

IMPORT_C static HBufC16* EscapeDecodeL(const TDesC16 &aData);

Description

Escape decodes the data.

Parameters

const TDesC16 &aData

A descriptor with the data to decode.

Return value

HBufC16 *

A pointer to a descriptor buffer which contains the escape decoded data.


ConvertFromUnicodeToUtf8L(const TDesC &)

IMPORT_C static HBufC8* ConvertFromUnicodeToUtf8L(const TDesC &aData);

Description

Converts UNICODE data into UTF8 format.

Parameters

const TDesC16 &aData

A descriptor with the data to convert.

Return value

HBufC8 *

A pointer to an 8-bit descriptor buffer which contains UTF8 data.

Leave codes

KUriUtilsCannotConvert.

When the input data cannot be converted.


ConvertToUnicodeFromUtf8L(const TDesC8 &)

IMPORT_C static HBufC* ConvertToUnicodeFromUtf8L(const TDesC8 &aData);

Description

Converts UTF8 format into UNICODE data.

Parameters

const TDesC8 &aData

A descriptor with the data to convert.

Return value

HBufC16 *

A pointer to a 16-bit descriptor buffer which contains UNICODE data.

Leave codes

KUriUtilsCannotConvert.

When the input data cannot be converted.


IsExcludedChar(TChar)

IMPORT_C static TBool IsExcludedChar(TChar aChar);

Description

Checks to see if the input argument is excluded.

Parameters

TChar aChar

The character to be checked.

Return value

TBool

A boolean value of ETrue if the character is an excluded one, or EFalse if it is not.


IsEscapeTriple(const TDesC8 &,TInt &)

IMPORT_C static TBool IsEscapeTriple(const TDesC8 &aData, TInt &aHexValue);

Description

Checks for an escape triple at the start of the input descriptor. If there is a triple its value is calculated and returned through the output argument aHexValue. If there is no escape triple then this argument is left unchanged.

Parameters

const TDesC8 &aData

The descriptor to be checked for an escape triple.

TInt &aHexValue

The output argument with the value of the escape triple if it exists.

Return value

TBool

A boolean value of ETrue if there is an escape triple at the start of the input descriptor, EFalse otherwise.


IsEscapeTriple(const TDesC16 &,TInt &)

IMPORT_C static TBool IsEscapeTriple(const TDesC16 &aData, TInt &aHexValue);

Description

Checks for an escape triple at the start of the input descriptor. If there is a triple its value is calculated and returned through the output argument aHexValue. If there is no escape triple then this argument is left unchanged.

Parameters

const TDesC16 &aData

The descriptor to be checked for an escape triple.

TInt &aHexValue

The output argument with the value of the escape triple if it exists.

Return value

TBool

A boolean value of ETrue if there is an escape triple at the start of the input descriptor, EFalse otherwise.


SpecificEscapeEncodeL(const TDesC8 &,const TDesC8 &)

IMPORT_C static HBufC8* SpecificEscapeEncodeL(const TDesC8 &aData, const TDesC8 &aCharsToEscape);

Description

returns the escape encoded descriptor output. This checks the every character of aData against aCharsToEscape and if it exist then it escape encodes that character.

Parameters

const TDesC8 &aData

The descriptor to be checked against escaping set of characters.

const TDesC8 &aCharsToEscape

The set of escape characters.

Return value

HBufC8 *

A pointer to the escape encoded descriptor.

[Top]


Member enumerations


Enum TEscapeMode

TEscapeMode

Description

enum TEscapeMode Enum defining escaping modes. Each mode has a different set of reserved characters. These are based on various uri components, as decribed in RFC2396.

EEscapeNormal

Default mode, which has no reserved characters

EEscapeQuery

Mode specifying reserved characters in a uri query - ;/?:&=+$,[]

EEscapePath

Mode specifying reserved characters in a uri path - /;=?[]

EEscapeAuth

Mode specifying reserved characters in a uri authority - /;:@?[]

EEscapeUrlEncoded

Mode specifying reserved characters in a URL ;/?:&=+$[]!\'()~