EscapeUtils Class Reference

#include <escapeutils.h>

class EscapeUtils
Public Member Enumerations
enumTEscapeMode { EEscapeNormal, EEscapeQuery, EEscapePath, EEscapeAuth, EEscapeUrlEncoded }
Public Member Functions
IMPORT_C HBufC8 *ConvertFromUnicodeToUtf8L(const TDesC &)
IMPORT_C HBufC *ConvertToUnicodeFromUtf8L(const TDesC8 &)
IMPORT_C HBufC8 *EscapeDecodeL(const TDesC8 &)
IMPORT_C HBufC16 *EscapeDecodeL(const TDesC16 &)
IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &, TEscapeMode)
IMPORT_C HBufC16 *EscapeEncodeL(const TDesC16 &, TEscapeMode)
IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &, const TDesC8 &)
IMPORT_C HBufC16 *EscapeEncodeL(const TDesC16 &, const TDesC16 &)
IMPORT_C TBoolIsEscapeTriple(const TDesC8 &, TInt &)
IMPORT_C TBoolIsEscapeTriple(const TDesC16 &, TInt &)
IMPORT_C TBoolIsExcludedChar(TChar)
HBufC8 *ReEscapeEncodeL(const TDesC8 &)
IMPORT_C HBufC8 *SpecificEscapeEncodeL(const TDesC8 &, const TDesC8 &)

Detailed 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.
Since
6.0

Member Enumeration Documentation

Enum TEscapeMode

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.

EnumeratorValueDescription
EEscapeNormal0

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 ;/?:&=+$[]!\'()~

Member Function Documentation

ConvertFromUnicodeToUtf8L ( const TDesC & )

IMPORT_C HBufC8 *ConvertFromUnicodeToUtf8L(const TDesC &aData)[static]

Converts UNICODE data into UTF8 format.

Since
6.0
Parameters
aDataA descriptor with the data to convert.
Return Value
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 HBufC *ConvertToUnicodeFromUtf8L(const TDesC8 &aData)[static]

Converts UTF8 format into UNICODE data.

Since
6.0
Parameters
aDataA descriptor with the data to convert.
Return Value
A pointer to a 16-bit descriptor buffer which contains UNICODE data.
Leave Codes
KUriUtilsCannotConvert.When the input data cannot be converted.

EscapeDecodeL ( const TDesC8 & )

IMPORT_C HBufC8 *EscapeDecodeL(const TDesC8 &aData)[static]

Escape decodes the data.

Since
6.0
Parameters
aDataA descriptor with the data to decode.
Return Value
A pointer to a descriptor buffer which contains the escape decoded data.

EscapeDecodeL ( const TDesC16 & )

IMPORT_C HBufC16 *EscapeDecodeL(const TDesC16 &aData)[static]

Escape decodes the data.

Since
6.0
Parameters
aDataA descriptor with the data to decode.
Return Value
A pointer to a descriptor buffer which contains the escape decoded data.

EscapeEncodeL ( const TDesC8 &, TEscapeMode )

IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &aData,
TEscapeModeaMode
)[static]

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.

Since
6.0
Parameters
aDataA descriptor with the data to encode.
aModeAn enum specifying the escape mode.
Return Value
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 HBufC16 *EscapeEncodeL(const TDesC16 &aData,
TEscapeModeaMode
)[static]

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.

Since
6.0
Parameters
aDataA descriptor with the data to encode.
aModeAn enum specifying the escape mode.
Return Value
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 HBufC8 *EscapeEncodeL(const TDesC8 &aData,
const TDesC8 &aReservedChars
)[static]

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.

Since
6.0
Parameters
aDataA descriptor with the data to encode.
aReservedCharsA descriptor with the reserved characters.
Return Value
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 HBufC16 *EscapeEncodeL(const TDesC16 &aData,
const TDesC16 &aReservedChars
)[static]

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.

Since
6.0
Parameters
aDataA descriptor with the data to encode.
aReservedCharsA descriptor with the reserved characters.
Return Value
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.

IsEscapeTriple ( const TDesC8 &, TInt & )

IMPORT_C TBoolIsEscapeTriple(const TDesC8 &aData,
TInt &aHexValue
)[static]

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.

Since
6.0
Parameters
aDataThe descriptor to be checked for an escape triple.
aHexValueThe output argument with the value of the escape triple if it exists.
Return Value
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 TBoolIsEscapeTriple(const TDesC16 &aData,
TInt &aHexValue
)[static]

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.

Since
6.0
Parameters
aDataThe descriptor to be checked for an escape triple.
aHexValueThe output argument with the value of the escape triple if it exists.
Return Value
A boolean value of ETrue if there is an escape triple at the start of the input descriptor, EFalse otherwise.

IsExcludedChar ( TChar )

IMPORT_C TBoolIsExcludedChar(TCharaChar)[static]

Checks to see if the input argument is excluded.

Since
6.0
Parameters
aCharThe character to be checked.
Return Value
A boolean value of ETrue if the character is an excluded one, or EFalse if it is not.

ReEscapeEncodeL ( const TDesC8 & )

HBufC8 *ReEscapeEncodeL(const TDesC8 &aData)[static]

escape encode only those characters that cannot be in a URI. assume all hh are encoded already.

Parameters
aDataThe descriptor buffer to be escape encoded.
Return Value
A pointer to a descriptor buffer which contains the escape encoded data.

SpecificEscapeEncodeL ( const TDesC8 &, const TDesC8 & )

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

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
aDataThe descriptor to be checked against escaping set of characters.
aCharsToEscapeThe set of escape characters.
Return Value
A pointer to the escape encoded descriptor.