1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericservices/httputils/inc/EscapeUtils.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,100 @@
1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// This file contains the API definition for escape enoding functionality
1.18 +// and UNICODE/UTF8 conversion. Escape encoding is performed as specified
1.19 +// by RFC2396.
1.20 +//
1.21 +//
1.22 +
1.23 +/**
1.24 + @file EscapeUtils.h
1.25 + @publishedAll
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef __ESCAPEUTILS_H__
1.30 +#define __ESCAPEUTILS_H__
1.31 +
1.32 +// System includes
1.33 +//
1.34 +#include <e32base.h>
1.35 +#include <uriutilscommon.h>
1.36 +
1.37 +
1.38 +/**
1.39 +Comments : Provides an API to allow data to be escape encoded and decoded.
1.40 +Also provide an API for converting a UNICODE data (16-bit descriptor) into
1.41 +UTF8 data (8-bit descriptor) and vice-verse.
1.42 +@publishedAll
1.43 +@released
1.44 +@since 6.0
1.45 +*/
1.46 +class EscapeUtils
1.47 + {
1.48 +public: // Enums
1.49 +
1.50 +/**
1.51 + enum TEscapeMode
1.52 + Enum defining escaping modes. Each mode has a different set of reserved characters.
1.53 + These are based on various uri components, as decribed in RFC2396.
1.54 + */
1.55 + enum TEscapeMode
1.56 + {
1.57 + /** Default mode, which has no reserved characters */
1.58 + EEscapeNormal = 0,
1.59 + /** Mode specifying reserved characters in a uri query - ;/?:@&=+$,[] */
1.60 + EEscapeQuery,
1.61 + /** Mode specifying reserved characters in a uri path - /;=?[] */
1.62 + EEscapePath,
1.63 + /** Mode specifying reserved characters in a uri authority - /;:@?[] */
1.64 + EEscapeAuth,
1.65 + /** Mode specifying reserved characters in a URL ;/?:@&=+$[]!\'()~ */
1.66 + EEscapeUrlEncoded
1.67 + };
1.68 +
1.69 +public: // Methods
1.70 +
1.71 + IMPORT_C static HBufC8* EscapeEncodeL(const TDesC8& aData, TEscapeMode aMode);
1.72 +
1.73 + IMPORT_C static HBufC16* EscapeEncodeL(const TDesC16& aData, TEscapeMode aMode);
1.74 +
1.75 + IMPORT_C static HBufC8* EscapeEncodeL(const TDesC8& aData, const TDesC8& aReservedChars);
1.76 +
1.77 + IMPORT_C static HBufC16* EscapeEncodeL(const TDesC16& aData, const TDesC16& aReservedChars);
1.78 +
1.79 + IMPORT_C static HBufC8* EscapeDecodeL(const TDesC8& aData);
1.80 +
1.81 + IMPORT_C static HBufC16* EscapeDecodeL(const TDesC16& aData);
1.82 +
1.83 + IMPORT_C static HBufC8* ConvertFromUnicodeToUtf8L(const TDesC& aData);
1.84 +
1.85 + IMPORT_C static HBufC* ConvertToUnicodeFromUtf8L(const TDesC8& aData);
1.86 +
1.87 + IMPORT_C static TBool IsExcludedChar(TChar aChar);
1.88 +
1.89 + IMPORT_C static TBool IsEscapeTriple(const TDesC8& aData, TInt& aHexValue);
1.90 +
1.91 + IMPORT_C static TBool IsEscapeTriple(const TDesC16& aData, TInt& aHexValue);
1.92 +
1.93 + IMPORT_C static HBufC8* SpecificEscapeEncodeL ( const TDesC8& aData, const TDesC8& aCharsToEscape );
1.94 +
1.95 + static HBufC8* ReEscapeEncodeL(const TDesC8& aData);
1.96 +
1.97 +private: // Dummy Method
1.98 +
1.99 + IMPORT_C static HBufC8* DummyForwardingFunctionForCompatibility( const TDesC8& aData, const TDesC8& aCharsToEscape );
1.100 +
1.101 + };
1.102 +
1.103 +#endif // __ESCAPEUTILS_H__