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