sl@0
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// This file contains the API definition for escape enoding functionality
|
sl@0
|
15 |
// and UNICODE/UTF8 conversion. Escape encoding is performed as specified
|
sl@0
|
16 |
// by RFC2396.
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file EscapeUtils.h
|
sl@0
|
22 |
@publishedAll
|
sl@0
|
23 |
@released
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
#ifndef __ESCAPEUTILS_H__
|
sl@0
|
27 |
#define __ESCAPEUTILS_H__
|
sl@0
|
28 |
|
sl@0
|
29 |
// System includes
|
sl@0
|
30 |
//
|
sl@0
|
31 |
#include <e32base.h>
|
sl@0
|
32 |
#include <uriutilscommon.h>
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
/**
|
sl@0
|
36 |
Comments : Provides an API to allow data to be escape encoded and decoded.
|
sl@0
|
37 |
Also provide an API for converting a UNICODE data (16-bit descriptor) into
|
sl@0
|
38 |
UTF8 data (8-bit descriptor) and vice-verse.
|
sl@0
|
39 |
@publishedAll
|
sl@0
|
40 |
@released
|
sl@0
|
41 |
@since 6.0
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
class EscapeUtils
|
sl@0
|
44 |
{
|
sl@0
|
45 |
public: // Enums
|
sl@0
|
46 |
|
sl@0
|
47 |
/**
|
sl@0
|
48 |
enum TEscapeMode
|
sl@0
|
49 |
Enum defining escaping modes. Each mode has a different set of reserved characters.
|
sl@0
|
50 |
These are based on various uri components, as decribed in RFC2396.
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
enum TEscapeMode
|
sl@0
|
53 |
{
|
sl@0
|
54 |
/** Default mode, which has no reserved characters */
|
sl@0
|
55 |
EEscapeNormal = 0,
|
sl@0
|
56 |
/** Mode specifying reserved characters in a uri query - ;/?:@&=+$,[] */
|
sl@0
|
57 |
EEscapeQuery,
|
sl@0
|
58 |
/** Mode specifying reserved characters in a uri path - /;=?[] */
|
sl@0
|
59 |
EEscapePath,
|
sl@0
|
60 |
/** Mode specifying reserved characters in a uri authority - /;:@?[] */
|
sl@0
|
61 |
EEscapeAuth,
|
sl@0
|
62 |
/** Mode specifying reserved characters in a URL ;/?:@&=+$[]!\'()~ */
|
sl@0
|
63 |
EEscapeUrlEncoded
|
sl@0
|
64 |
};
|
sl@0
|
65 |
|
sl@0
|
66 |
public: // Methods
|
sl@0
|
67 |
|
sl@0
|
68 |
IMPORT_C static HBufC8* EscapeEncodeL(const TDesC8& aData, TEscapeMode aMode);
|
sl@0
|
69 |
|
sl@0
|
70 |
IMPORT_C static HBufC16* EscapeEncodeL(const TDesC16& aData, TEscapeMode aMode);
|
sl@0
|
71 |
|
sl@0
|
72 |
IMPORT_C static HBufC8* EscapeEncodeL(const TDesC8& aData, const TDesC8& aReservedChars);
|
sl@0
|
73 |
|
sl@0
|
74 |
IMPORT_C static HBufC16* EscapeEncodeL(const TDesC16& aData, const TDesC16& aReservedChars);
|
sl@0
|
75 |
|
sl@0
|
76 |
IMPORT_C static HBufC8* EscapeDecodeL(const TDesC8& aData);
|
sl@0
|
77 |
|
sl@0
|
78 |
IMPORT_C static HBufC16* EscapeDecodeL(const TDesC16& aData);
|
sl@0
|
79 |
|
sl@0
|
80 |
IMPORT_C static HBufC8* ConvertFromUnicodeToUtf8L(const TDesC& aData);
|
sl@0
|
81 |
|
sl@0
|
82 |
IMPORT_C static HBufC* ConvertToUnicodeFromUtf8L(const TDesC8& aData);
|
sl@0
|
83 |
|
sl@0
|
84 |
IMPORT_C static TBool IsExcludedChar(TChar aChar);
|
sl@0
|
85 |
|
sl@0
|
86 |
IMPORT_C static TBool IsEscapeTriple(const TDesC8& aData, TInt& aHexValue);
|
sl@0
|
87 |
|
sl@0
|
88 |
IMPORT_C static TBool IsEscapeTriple(const TDesC16& aData, TInt& aHexValue);
|
sl@0
|
89 |
|
sl@0
|
90 |
IMPORT_C static HBufC8* SpecificEscapeEncodeL ( const TDesC8& aData, const TDesC8& aCharsToEscape );
|
sl@0
|
91 |
|
sl@0
|
92 |
static HBufC8* ReEscapeEncodeL(const TDesC8& aData);
|
sl@0
|
93 |
|
sl@0
|
94 |
private: // Dummy Method
|
sl@0
|
95 |
|
sl@0
|
96 |
IMPORT_C static HBufC8* DummyForwardingFunctionForCompatibility( const TDesC8& aData, const TDesC8& aCharsToEscape );
|
sl@0
|
97 |
|
sl@0
|
98 |
};
|
sl@0
|
99 |
|
sl@0
|
100 |
#endif // __ESCAPEUTILS_H__
|