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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __CHARSETCONVERTER_H__
17 #define __CHARSETCONVERTER_H__
21 class CCnvCharacterSetConverter;
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.
31 @see CCnvCharacterSetConverter
38 class CCharSetConverter : public CBase
42 static CCharSetConverter* NewL();
43 virtual ~CCharSetConverter();
45 IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, const TDesC8& aEncoding);
46 IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, TInt aMibEnum);
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);
57 IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, TPtr16& aOutput);
58 IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, TPtr8& aOutput);
63 CCharSetConverter(const CCharSetConverter& aOriginal);
64 CCharSetConverter& operator=(const CCharSetConverter& aRhs);
68 TText16* Utf32ToUtf16(TText16* aUtf16Out, TUint32 aUtf32);
73 The CharConv instance that we use to help in the character conversions.
75 CCnvCharacterSetConverter* iCnvCharacterSetConverter;
78 The File Server session handle.
83 The buffer used to store the unicode conversion output.
85 TAny* iConversionBuffer;
88 The size of the unicode conversion buffer.
90 TUint32 iConversionBufferSize;
95 #endif //__CHARSETCONVERTER_H__