os/textandloc/charconvfw/charconvplugins/src/plugins/j5.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/charconvplugins/src/plugins/j5.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,130 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* J5 charconv character converter
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#if !defined(__J5_H__)
    1.24 +#define __J5_H__
    1.25 +
    1.26 +/**
    1.27 +J5 charconv character converter which supports automatic conversion for the following
    1.28 +character sets:
    1.29 +	SHIFT-JIS (Windows-31J Microsoft code page 932), 
    1.30 +	ISO-2022-JP-1 (JIS-JP) 
    1.31 +	EUC_JP 
    1.32 +	UTF8 
    1.33 +	UCS2
    1.34 +@internalTechnology 
    1.35 +@released 9.1
    1.36 +*/
    1.37 +class CJ5Converter : public CCharacterSetConverterPluginInterface
    1.38 +	{
    1.39 +
    1.40 +public:
    1.41 +	enum TJ5Encoding
    1.42 +		{
    1.43 +		EShiftjis = 1,
    1.44 +		EIso2022jp1, 
    1.45 +		EEucjp, 
    1.46 +		EUtf8, 
    1.47 +		EUcs2,
    1.48 +		EUnknown
    1.49 +		};
    1.50 +
    1.51 +	virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
    1.52 +
    1.53 +	virtual TInt ConvertFromUnicode(
    1.54 +		CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    1.55 +		const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
    1.56 +		TDes8& aForeign, 
    1.57 +		const TDesC16& aUnicode, 
    1.58 +		CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);
    1.59 +
    1.60 +	virtual TInt ConvertToUnicode(
    1.61 +		CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    1.62 +		TDes16& aUnicode, 
    1.63 +		const TDesC8& aForeign, 
    1.64 +		TInt& aState, 
    1.65 +		TInt& aNumberOfUnconvertibleCharacters, 
    1.66 +		TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
    1.67 +
    1.68 +	virtual TBool IsInThisCharacterSetL(
    1.69 +		TBool& aSetToTrue, 
    1.70 +		TInt& aConfidenceLevel, 
    1.71 +		const TDesC8& aSample);
    1.72 +
    1.73 +	static CJ5Converter* NewL();
    1.74 +	virtual ~CJ5Converter();
    1.75 +
    1.76 +private:
    1.77 +	CJ5Converter();
    1.78 +	void ConstructL();
    1.79 +	
    1.80 +	enum TDectectCharacterSet
    1.81 +		{
    1.82 +		EIsCharacterSet = 1,
    1.83 +		EIsNotCharacterSet,
    1.84 +		EMaybeCharacterSet
    1.85 +		};
    1.86 +			
    1.87 +	enum TJ5Encoding DetectEncoding(
    1.88 +		CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters, 
    1.89 +		const TDesC8& aForeign );
    1.90 +
    1.91 +	TBool DetectUcs2( const TDesC8& aForeign,
    1.92 +		CCnvCharacterSetConverter::TEndianness& aTEndianness );
    1.93 +		
    1.94 +	enum TDectectCharacterSet DetectShiftJis( const TDesC8& aForeign,
    1.95 +		TInt &aNumberOfBytesConverted );
    1.96 +	
    1.97 +	enum TDectectCharacterSet DetectUtf8( const TDesC8& aForeign );
    1.98 +
    1.99 +	enum TDectectCharacterSet DetectEucJp( const TDesC8& aForeign,
   1.100 +		TInt &aNumberOfBytesConverted );
   1.101 +
   1.102 +	enum TDectectCharacterSet DetectIso2022( const TDesC8& aForeign );
   1.103 +		
   1.104 +	TInt ConvertEEucjpToUnicode(
   1.105 +		CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
   1.106 +		TDes16& aUnicode, 
   1.107 +		const TDesC8& aForeign, 
   1.108 +		TInt& aState, 
   1.109 +		TInt& aNumberOfUnconvertibleCharacters, 
   1.110 +		TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
   1.111 +	
   1.112 +	TInt ConvertUcs2ToUnicode(CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters, 
   1.113 +						   TDes16& aUnicode,		
   1.114 +						   const TDesC8& aForeign,	
   1.115 +						   TInt& aNumberOfUnconvertibleCharacters,   
   1.116 +						   TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter); 
   1.117 +									  
   1.118 +	};
   1.119 +
   1.120 +	
   1.121 +							  
   1.122 +// EucJp conversion methods	
   1.123 +void DummyConvertToIntermediateBufferInPlace(TDes8&);
   1.124 +void ConvertToJisX0212FromEucJpPackedInPlace(TDes8& aDescriptor);
   1.125 +void ConvertToJisX0208FromEucJpPackedInPlace(TDes8& aDescriptor);
   1.126 +void ConvertToHalfWidthKatakana8FromEucJpPackedInPlace(TDes8& aDescriptor);
   1.127 +TInt NumberOfBytesAbleToConvertToJisRoman(const TDesC8& aDescriptor);
   1.128 +TInt NumberOfBytesAbleToConvertToJisX0208(const TDesC8& aDescriptor);
   1.129 +TInt NumberOfBytesAbleToConvertToHalfWidthKatakana8(const TDesC8& aDescriptor);
   1.130 +TInt NumberOfBytesAbleToConvertToJisX0212(const TDesC8& aDescriptor);
   1.131 +
   1.132 +#endif
   1.133 +