epoc32/include/xml/plugins/charsetconverter.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/xml/plugins/charsetconverter.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,95 @@
     1.4 +// Copyright (c) 2003-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 +//
    1.18 +
    1.19 +#ifndef __CHARSETCONVERTER_H__
    1.20 +#define __CHARSETCONVERTER_H__
    1.21 +
    1.22 +#include <f32file.h>
    1.23 +
    1.24 +class CCnvCharacterSetConverter;
    1.25 +
    1.26 +namespace Xml
    1.27 +{
    1.28 +
    1.29 +/**
    1.30 +The CCharSetConverter class supplies algorithms for character conversion
    1.31 +between a chosen character set and unicode. Memory management
    1.32 +needed to hold the converted data is also handled.
    1.33 +
    1.34 +@see CCnvCharacterSetConverter
    1.35 +@see CnvUtfConverter
    1.36 +@see MParser
    1.37 +
    1.38 +@publishedPartner
    1.39 +@released
    1.40 +*/
    1.41 +class CCharSetConverter : public CBase
    1.42 +	{
    1.43 +public:
    1.44 +
    1.45 +	static CCharSetConverter* NewL();
    1.46 +	virtual ~CCharSetConverter();
    1.47 +
    1.48 +	IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, const TDesC8& aEncoding);
    1.49 +	IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, TInt aMibEnum);
    1.50 +
    1.51 +	IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, 
    1.52 +		                            HBufC16*& aUnicodeConversion);
    1.53 +	IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, 
    1.54 +		                              HBufC8*& aOutputBuffer);
    1.55 +	IMPORT_C void PrepareToConvertToOrFromL(TUint32 aCharSetUid);
    1.56 +	IMPORT_C TInt ConvertUcs4CharactersToEncodingL(TUint32* aUcs4Src, TInt aUcs4Count, 
    1.57 +		                                           TUint32 aDestCharset, HBufC8*& aConversion);
    1.58 +	IMPORT_C void ConvertCharacterSetIdentifierToStandardNameL(TUint32 aCharSetUid, HBufC8*& aCharSet);
    1.59 +	
    1.60 +	IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, TPtr16& aOutput);
    1.61 +	IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, TPtr8& aOutput);
    1.62 +		
    1.63 +private:
    1.64 +
    1.65 +	CCharSetConverter();
    1.66 +	CCharSetConverter(const CCharSetConverter& aOriginal);
    1.67 +	CCharSetConverter& operator=(const CCharSetConverter& aRhs);
    1.68 +	
    1.69 +	void ConstructL();
    1.70 +
    1.71 +	TText16* Utf32ToUtf16(TText16* aUtf16Out, TUint32 aUtf32);
    1.72 +
    1.73 +private:
    1.74 +
    1.75 +/**
    1.76 +The CharConv instance that we use to help in the character conversions.
    1.77 +*/
    1.78 +	CCnvCharacterSetConverter* iCnvCharacterSetConverter;
    1.79 +
    1.80 +/**
    1.81 +The File Server session handle.
    1.82 +*/
    1.83 +	RFs iFs;
    1.84 +	
    1.85 +/**	
    1.86 +The buffer used to store the unicode conversion output.
    1.87 +*/
    1.88 +	TAny* iConversionBuffer;
    1.89 +
    1.90 +/**	
    1.91 +The size of the unicode conversion buffer.
    1.92 +*/
    1.93 +	TUint32 iConversionBufferSize;
    1.94 +	};
    1.95 +}
    1.96 +
    1.97 +
    1.98 +#endif //__CHARSETCONVERTER_H__