sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* J5 charconv character converter
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#if !defined(__J5_H__)
|
sl@0
|
21 |
#define __J5_H__
|
sl@0
|
22 |
|
sl@0
|
23 |
/**
|
sl@0
|
24 |
J5 charconv character converter which supports automatic conversion for the following
|
sl@0
|
25 |
character sets:
|
sl@0
|
26 |
SHIFT-JIS (Windows-31J Microsoft code page 932),
|
sl@0
|
27 |
ISO-2022-JP-1 (JIS-JP)
|
sl@0
|
28 |
EUC_JP
|
sl@0
|
29 |
UTF8
|
sl@0
|
30 |
UCS2
|
sl@0
|
31 |
@internalTechnology
|
sl@0
|
32 |
@released 9.1
|
sl@0
|
33 |
*/
|
sl@0
|
34 |
class CJ5Converter : public CCharacterSetConverterPluginInterface
|
sl@0
|
35 |
{
|
sl@0
|
36 |
|
sl@0
|
37 |
public:
|
sl@0
|
38 |
enum TJ5Encoding
|
sl@0
|
39 |
{
|
sl@0
|
40 |
EShiftjis = 1,
|
sl@0
|
41 |
EIso2022jp1,
|
sl@0
|
42 |
EEucjp,
|
sl@0
|
43 |
EUtf8,
|
sl@0
|
44 |
EUcs2,
|
sl@0
|
45 |
EUnknown
|
sl@0
|
46 |
};
|
sl@0
|
47 |
|
sl@0
|
48 |
virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
|
sl@0
|
49 |
|
sl@0
|
50 |
virtual TInt ConvertFromUnicode(
|
sl@0
|
51 |
CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
|
sl@0
|
52 |
const TDesC8& aReplacementForUnconvertibleUnicodeCharacters,
|
sl@0
|
53 |
TDes8& aForeign,
|
sl@0
|
54 |
const TDesC16& aUnicode,
|
sl@0
|
55 |
CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);
|
sl@0
|
56 |
|
sl@0
|
57 |
virtual TInt ConvertToUnicode(
|
sl@0
|
58 |
CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
|
sl@0
|
59 |
TDes16& aUnicode,
|
sl@0
|
60 |
const TDesC8& aForeign,
|
sl@0
|
61 |
TInt& aState,
|
sl@0
|
62 |
TInt& aNumberOfUnconvertibleCharacters,
|
sl@0
|
63 |
TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
|
sl@0
|
64 |
|
sl@0
|
65 |
virtual TBool IsInThisCharacterSetL(
|
sl@0
|
66 |
TBool& aSetToTrue,
|
sl@0
|
67 |
TInt& aConfidenceLevel,
|
sl@0
|
68 |
const TDesC8& aSample);
|
sl@0
|
69 |
|
sl@0
|
70 |
static CJ5Converter* NewL();
|
sl@0
|
71 |
virtual ~CJ5Converter();
|
sl@0
|
72 |
|
sl@0
|
73 |
private:
|
sl@0
|
74 |
CJ5Converter();
|
sl@0
|
75 |
void ConstructL();
|
sl@0
|
76 |
|
sl@0
|
77 |
enum TDectectCharacterSet
|
sl@0
|
78 |
{
|
sl@0
|
79 |
EIsCharacterSet = 1,
|
sl@0
|
80 |
EIsNotCharacterSet,
|
sl@0
|
81 |
EMaybeCharacterSet
|
sl@0
|
82 |
};
|
sl@0
|
83 |
|
sl@0
|
84 |
enum TJ5Encoding DetectEncoding(
|
sl@0
|
85 |
CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters,
|
sl@0
|
86 |
const TDesC8& aForeign );
|
sl@0
|
87 |
|
sl@0
|
88 |
TBool DetectUcs2( const TDesC8& aForeign,
|
sl@0
|
89 |
CCnvCharacterSetConverter::TEndianness& aTEndianness );
|
sl@0
|
90 |
|
sl@0
|
91 |
enum TDectectCharacterSet DetectShiftJis( const TDesC8& aForeign,
|
sl@0
|
92 |
TInt &aNumberOfBytesConverted );
|
sl@0
|
93 |
|
sl@0
|
94 |
enum TDectectCharacterSet DetectUtf8( const TDesC8& aForeign );
|
sl@0
|
95 |
|
sl@0
|
96 |
enum TDectectCharacterSet DetectEucJp( const TDesC8& aForeign,
|
sl@0
|
97 |
TInt &aNumberOfBytesConverted );
|
sl@0
|
98 |
|
sl@0
|
99 |
enum TDectectCharacterSet DetectIso2022( const TDesC8& aForeign );
|
sl@0
|
100 |
|
sl@0
|
101 |
TInt ConvertEEucjpToUnicode(
|
sl@0
|
102 |
CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
|
sl@0
|
103 |
TDes16& aUnicode,
|
sl@0
|
104 |
const TDesC8& aForeign,
|
sl@0
|
105 |
TInt& aState,
|
sl@0
|
106 |
TInt& aNumberOfUnconvertibleCharacters,
|
sl@0
|
107 |
TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
|
sl@0
|
108 |
|
sl@0
|
109 |
TInt ConvertUcs2ToUnicode(CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters,
|
sl@0
|
110 |
TDes16& aUnicode,
|
sl@0
|
111 |
const TDesC8& aForeign,
|
sl@0
|
112 |
TInt& aNumberOfUnconvertibleCharacters,
|
sl@0
|
113 |
TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
|
sl@0
|
114 |
|
sl@0
|
115 |
};
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
|
sl@0
|
119 |
// EucJp conversion methods
|
sl@0
|
120 |
void DummyConvertToIntermediateBufferInPlace(TDes8&);
|
sl@0
|
121 |
void ConvertToJisX0212FromEucJpPackedInPlace(TDes8& aDescriptor);
|
sl@0
|
122 |
void ConvertToJisX0208FromEucJpPackedInPlace(TDes8& aDescriptor);
|
sl@0
|
123 |
void ConvertToHalfWidthKatakana8FromEucJpPackedInPlace(TDes8& aDescriptor);
|
sl@0
|
124 |
TInt NumberOfBytesAbleToConvertToJisRoman(const TDesC8& aDescriptor);
|
sl@0
|
125 |
TInt NumberOfBytesAbleToConvertToJisX0208(const TDesC8& aDescriptor);
|
sl@0
|
126 |
TInt NumberOfBytesAbleToConvertToHalfWidthKatakana8(const TDesC8& aDescriptor);
|
sl@0
|
127 |
TInt NumberOfBytesAbleToConvertToJisX0212(const TDesC8& aDescriptor);
|
sl@0
|
128 |
|
sl@0
|
129 |
#endif
|
sl@0
|
130 |
|