epoc32/include/xml/plugins/charsetconverter.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2003-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 //
    15 
    16 #ifndef __CHARSETCONVERTER_H__
    17 #define __CHARSETCONVERTER_H__
    18 
    19 #include <f32file.h>
    20 
    21 class CCnvCharacterSetConverter;
    22 
    23 namespace Xml
    24 {
    25 
    26 /**
    27 The CCharSetConverter class supplies algorithms for character conversion
    28 between a chosen character set and unicode. Memory management
    29 needed to hold the converted data is also handled.
    30 
    31 @see CCnvCharacterSetConverter
    32 @see CnvUtfConverter
    33 @see MParser
    34 
    35 @publishedPartner
    36 @released
    37 */
    38 class CCharSetConverter : public CBase
    39 	{
    40 public:
    41 
    42 	static CCharSetConverter* NewL();
    43 	virtual ~CCharSetConverter();
    44 
    45 	IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, const TDesC8& aEncoding);
    46 	IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, TInt aMibEnum);
    47 
    48 	IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, 
    49 		                            HBufC16*& aUnicodeConversion);
    50 	IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, 
    51 		                              HBufC8*& aOutputBuffer);
    52 	IMPORT_C void PrepareToConvertToOrFromL(TUint32 aCharSetUid);
    53 	IMPORT_C TInt ConvertUcs4CharactersToEncodingL(TUint32* aUcs4Src, TInt aUcs4Count, 
    54 		                                           TUint32 aDestCharset, HBufC8*& aConversion);
    55 	IMPORT_C void ConvertCharacterSetIdentifierToStandardNameL(TUint32 aCharSetUid, HBufC8*& aCharSet);
    56 	
    57 	IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, TPtr16& aOutput);
    58 	IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, TPtr8& aOutput);
    59 		
    60 private:
    61 
    62 	CCharSetConverter();
    63 	CCharSetConverter(const CCharSetConverter& aOriginal);
    64 	CCharSetConverter& operator=(const CCharSetConverter& aRhs);
    65 	
    66 	void ConstructL();
    67 
    68 	TText16* Utf32ToUtf16(TText16* aUtf16Out, TUint32 aUtf32);
    69 
    70 private:
    71 
    72 /**
    73 The CharConv instance that we use to help in the character conversions.
    74 */
    75 	CCnvCharacterSetConverter* iCnvCharacterSetConverter;
    76 
    77 /**
    78 The File Server session handle.
    79 */
    80 	RFs iFs;
    81 	
    82 /**	
    83 The buffer used to store the unicode conversion output.
    84 */
    85 	TAny* iConversionBuffer;
    86 
    87 /**	
    88 The size of the unicode conversion buffer.
    89 */
    90 	TUint32 iConversionBufferSize;
    91 	};
    92 }
    93 
    94 
    95 #endif //__CHARSETCONVERTER_H__