sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * J5 charconv character converter sl@0: * sl@0: */ sl@0: sl@0: sl@0: #if !defined(__J5_H__) sl@0: #define __J5_H__ sl@0: sl@0: /** sl@0: J5 charconv character converter which supports automatic conversion for the following sl@0: character sets: sl@0: SHIFT-JIS (Windows-31J Microsoft code page 932), sl@0: ISO-2022-JP-1 (JIS-JP) sl@0: EUC_JP sl@0: UTF8 sl@0: UCS2 sl@0: @internalTechnology sl@0: @released 9.1 sl@0: */ sl@0: class CJ5Converter : public CCharacterSetConverterPluginInterface sl@0: { sl@0: sl@0: public: sl@0: enum TJ5Encoding sl@0: { sl@0: EShiftjis = 1, sl@0: EIso2022jp1, sl@0: EEucjp, sl@0: EUtf8, sl@0: EUcs2, sl@0: EUnknown sl@0: }; sl@0: sl@0: virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters(); sl@0: sl@0: virtual TInt ConvertFromUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, sl@0: TDes8& aForeign, sl@0: const TDesC16& aUnicode, sl@0: CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters); sl@0: sl@0: virtual TInt ConvertToUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: TDes16& aUnicode, sl@0: const TDesC8& aForeign, sl@0: TInt& aState, sl@0: TInt& aNumberOfUnconvertibleCharacters, sl@0: TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter); sl@0: sl@0: virtual TBool IsInThisCharacterSetL( sl@0: TBool& aSetToTrue, sl@0: TInt& aConfidenceLevel, sl@0: const TDesC8& aSample); sl@0: sl@0: static CJ5Converter* NewL(); sl@0: virtual ~CJ5Converter(); sl@0: sl@0: private: sl@0: CJ5Converter(); sl@0: void ConstructL(); sl@0: sl@0: enum TDectectCharacterSet sl@0: { sl@0: EIsCharacterSet = 1, sl@0: EIsNotCharacterSet, sl@0: EMaybeCharacterSet sl@0: }; sl@0: sl@0: enum TJ5Encoding DetectEncoding( sl@0: CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters, sl@0: const TDesC8& aForeign ); sl@0: sl@0: TBool DetectUcs2( const TDesC8& aForeign, sl@0: CCnvCharacterSetConverter::TEndianness& aTEndianness ); sl@0: sl@0: enum TDectectCharacterSet DetectShiftJis( const TDesC8& aForeign, sl@0: TInt &aNumberOfBytesConverted ); sl@0: sl@0: enum TDectectCharacterSet DetectUtf8( const TDesC8& aForeign ); sl@0: sl@0: enum TDectectCharacterSet DetectEucJp( const TDesC8& aForeign, sl@0: TInt &aNumberOfBytesConverted ); sl@0: sl@0: enum TDectectCharacterSet DetectIso2022( const TDesC8& aForeign ); sl@0: sl@0: TInt ConvertEEucjpToUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: TDes16& aUnicode, sl@0: const TDesC8& aForeign, sl@0: TInt& aState, sl@0: TInt& aNumberOfUnconvertibleCharacters, sl@0: TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter); sl@0: sl@0: TInt ConvertUcs2ToUnicode(CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters, sl@0: TDes16& aUnicode, sl@0: const TDesC8& aForeign, sl@0: TInt& aNumberOfUnconvertibleCharacters, sl@0: TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter); sl@0: sl@0: }; sl@0: sl@0: sl@0: sl@0: // EucJp conversion methods sl@0: void DummyConvertToIntermediateBufferInPlace(TDes8&); sl@0: void ConvertToJisX0212FromEucJpPackedInPlace(TDes8& aDescriptor); sl@0: void ConvertToJisX0208FromEucJpPackedInPlace(TDes8& aDescriptor); sl@0: void ConvertToHalfWidthKatakana8FromEucJpPackedInPlace(TDes8& aDescriptor); sl@0: TInt NumberOfBytesAbleToConvertToJisRoman(const TDesC8& aDescriptor); sl@0: TInt NumberOfBytesAbleToConvertToJisX0208(const TDesC8& aDescriptor); sl@0: TInt NumberOfBytesAbleToConvertToHalfWidthKatakana8(const TDesC8& aDescriptor); sl@0: TInt NumberOfBytesAbleToConvertToJisX0212(const TDesC8& aDescriptor); sl@0: sl@0: #endif sl@0: