core/src/character_converter.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // character_converter.h
       
     2 // 
       
     3 // Copyright (c) 2005 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef __CHARACTER_CONVERTER_H__
       
    14 #define __CHARACTER_CONVERTER_H__
       
    15 
       
    16 #include <e32std.h>
       
    17 #include <f32file.h>
       
    18 #include <charconv.h>
       
    19 
       
    20 
       
    21 class CCharacterConverter : public CBase
       
    22 	{
       
    23 public:
       
    24 	enum TChunkType
       
    25 		{
       
    26 		EFirst,
       
    27 		EMiddle,
       
    28 		ELast
       
    29 		};
       
    30 public:
       
    31 	static CCharacterConverter* NewL(TInt aMaxBlockSize, RFs& aFs, TUint aCharset=0); // 0 means autodetect
       
    32 	~CCharacterConverter();
       
    33 	const TDesC& ConvertChunkL(const TDesC8& aNarrowBuf, TChunkType aType);
       
    34 private:
       
    35 	CCharacterConverter(TInt aMaxBlockSize, RFs& aFs, TUint aCharset);
       
    36 	void ConstructL();
       
    37 private:
       
    38 	RFs& iFs;
       
    39 	TInt iCharConvState;
       
    40 	TInt iNumUnconvertibleChars;
       
    41 	const TInt iMaxBlockSize;
       
    42 	HBufC8* iNarrowBuf;
       
    43 	HBufC16* iWideBuf;
       
    44 	TPtr8 iNarrowPtr;
       
    45 	TPtr16 iWidePtr;
       
    46 	CCnvCharacterSetConverter* iConverter;
       
    47 	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iCharSets;
       
    48 	TUint iCharset;
       
    49 	};
       
    50 
       
    51 
       
    52 #endif // __CHARACTER_CONVERTER_H__