»
Developer Library »
API Reference »
C++ API reference »
Internet Protocol Utilities »
EscapeUtils
Location:
EscapeUtils.h
Link against: InetProtUtil.lib
class EscapeUtils;
Support
Supported from 7.0
Description
A utility class that provides functionality to:
Defined in EscapeUtils:
ConvertFromUnicodeToUtf8L(), ConvertToUnicodeFromUtf8L(), EEscapeAuth, EEscapeNormal, EEscapePath, EEscapeQuery, EEscapeUrlEncoded, EscapeDecodeL(), EscapeDecodeL(), EscapeEncodeL(), EscapeEncodeL(), EscapeEncodeL(), EscapeEncodeL(), IsEscapeTriple(), IsEscapeTriple(), IsExcludedChar(), TEscapeMode
Member Functions
static HBufC8* EscapeEncodeL(const TDesC8& aData, TEscapeMode aMode);
Description
Escape-encodes excluded and reserved characters, as implied by
the specified escape mode, in the specified data, as escape triples.
Parameters
const
TDesC8& aData |
The data to be escaped-encoded. |
TEscapeMode aMode |
The escape mode. |
|
Return value
HBufC8* |
A pointer to an 8-bit heap descriptor containing the resulting
escape-encoded data. |
|
Leave codes
KErrNoMemory |
The function will attempt to allocate memory, and leaves if
there is insufficient. |
|
static HBufC16* EscapeEncodeL(const TDesC16& aData, TEscapeMode aMode);
Description
Escape-encodes the excluded and reserved characters, as implied
by the specified escape mode, in the specified data as escape triples.
Parameters
Return value
HBufC16* |
A pointer to a 16-bit heap descriptor containing the resulting
escape-encoded data. |
|
Leave codes
KErrNoMemory |
The function will attempt to allocate memory, and leaves if
there is insufficient. |
KUriUtilsErr16BitChar |
In release mode only, if any character cannot be represented
within 8 bits (i.e. has a value greater than 255). |
|
Panic codes
ESC-UTILS -5006 |
In debug mode only, if any character cannot be represented
within 8 bits (i.e. has a value greater than 255). |
|
static HBufC8* EscapeEncodeL(const TDesC8& aData, const TDesC8& aReservedChars);
Description
Escape-encodes the specified set of reserved characters in the
specified data as escape triples.
Parameters
const
TDesC8& aData |
The data to be escaped-encoded. |
const
TDesC8& aReservedChars |
The set of reserved characters. |
|
Return value
HBufC8* |
A pointer to an 8-bit heap descriptor containing the resulting
escape-encoded data. |
|
Leave codes
KErrNoMemory |
The function will attempt to allocate memory, and leaves if
there is insufficient. |
|
static HBufC16* EscapeEncodeL(const TDesC16& aData, const TDesC16& aReservedChars);
Description
Escape-encodes the specified set of reserved characters in the
specified data as escape triples.
Parameters
const
TDesC16& aData |
The data to be escaped-encoded. |
const
TDesC16& aReservedChars |
The set of reserved characters. |
|
Return value
HBufC16* |
A pointer to a 16-bit heap descriptor containing the resulting
escape-encoded data. |
|
Leave codes
KErrNoMemory |
The function will attempt to allocate memory, and leaves if
there is insufficient. |
KUriUtilsErr16BitChar |
In release mode only, if any character cannot be represented
within 8 bits (i.e. has a value greater than 255). |
|
Panic codes
ESC-UTILS -5006 |
In debug mode only, if any character cannot be represented
within 8 bits (i.e. has a value greater than 255). |
|
static HBufC8* EscapeDecodeL(const TDesC8& aData);
Description
Escape-decodes the specified data.
Parameters
const
TDesC8& aData |
The data to be escape-decoded. |
|
Return value
HBufC8* |
A pointer to an 8-bit heap descriptor containing the resulting
escape-decoded data. |
|
Leave codes
static HBufC16* EscapeDecodeL(const TDesC16& aData);
Description
Escape-decodes the specified data.
Parameters
const
TDesC16& aData |
The data to be escape-decoded. |
|
Return value
HBufC16* |
A pointer to a 16-bit heap descriptor containing the resulting
escape-decoded data. |
|
Leave codes
ConvertFromUnicodeToUtf8L()
static HBufC8* ConvertFromUnicodeToUtf8L(const TDesC& aData);
Description
Converts Unicode data into UTF8 format.
Parameters
const
TDesC& aData |
Unicode data to be converted. |
|
Return value
HBufC8* |
A pointer to an 8-bit heap descriptor containing the resulting
UTF8 data. |
|
Leave codes
ConvertToUnicodeFromUtf8L()
static HBufC* ConvertToUnicodeFromUtf8L(const TDesC8& aData);
Description
Converts UTF8 format data into Unicode.
Parameters
const
TDesC8& aData |
UTF8 format data to be converted. |
|
Return value
HBufC* |
A pointer to a heap descriptor containing the resulting Unicode
data. |
|
Leave codes
static TBool IsExcludedChar(TChar aChar);
Description
Tests whether the specified character is one of the excluded
characters.
Parameters
TChar aChar |
The character to be checked. |
|
Return value
TBool
|
True, if the character is one of the excluded characters;
false, otherwise. |
|
static TBool IsEscapeTriple(const TDesC8& aData, TInt& aHexValue);
Description
Tests whether the specified data contains an escape triple, and
gets its hexadecimal value.
Parameters
const
TDesC8& aData |
The data to be checked for an escape triple. |
TInt& aHexValue |
On return, contains the hexadecimal value of the first escape
triple found. If no valid escape triple is found, then this value remains
unchanged. |
|
Return value
TBool
|
True, if there is a valid escape triple; false
otherwise. |
|
static TBool IsEscapeTriple(const TDesC16& aData, TInt& aHexValue);
Description
Tests whether the specified data contains an escape triple, and
gets its hexadecimal value.
Parameters
const
TDesC16& aData |
The data to be checked for an escape triple. |
TInt& aHexValue |
On return, contains the hexadecimal value of the first escape
triple found. If no valid escape triple is found, then this value remains
unchanged. |
|
Return value
TBool
|
True, if there is a valid escape triple; false
otherwise. |
|
TEscapeMode
Description
The set of escape modes.
Each escape mode has a different set of reserved characters.
These are based on various URI components, as decribed in RFC2396.
Note that these reserved characters and the set of excluded
characters specified by RFC2396 form the entire set of excluded data.
EEscapeNormal |
Default mode, which has no reserved characters. |
EEscapeQuery |
Mode specifying the reserved characters in a URI query ;/?:@&=+$,[] |
EEscapePath |
Mode specifying the reserved characters in a URI path /;=?[] |
EEscapeAuth |
Mode specifying the reserved characters in a URI
authority /;:@?[] |
EEscapeUrlEncoded |
Mode specifying the reserved characters in a URL ;/?:@&=+$[]!\'()~ |
|