|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef StreamingTextCodecSymbian_H |
|
20 #define StreamingTextCodecSymbian_H |
|
21 |
|
22 #include "TextDecoder.h" |
|
23 #include "CharsetDataSymbian.h" |
|
24 #include <wtf/OwnPtr.h> |
|
25 |
|
26 namespace WebCore { |
|
27 |
|
28 class TextCodecSymbian : public TextCodec { |
|
29 public: |
|
30 static void registerEncodingNames(EncodingNameRegistrar); |
|
31 static void registerCodecs(TextCodecRegistrar); |
|
32 |
|
33 explicit TextCodecSymbian(TUint aEncoding); |
|
34 virtual ~TextCodecSymbian(); |
|
35 |
|
36 virtual String decode(const char*, size_t length, bool flush = false); |
|
37 virtual CString encode(const UChar*, size_t length, bool allowEntities = false); |
|
38 |
|
39 private: |
|
40 bool initializeConverter(); |
|
41 void checkSupportedEncoding(); |
|
42 |
|
43 CCnvCharacterSetConverter* m_converter; |
|
44 TInt m_state; |
|
45 TUint m_encoding; |
|
46 TBool m_firstChunkDecoded; |
|
47 unsigned m_numBufferedBytes; |
|
48 unsigned char m_bufferedBytes[16]; // bigger than any single multi-byte character |
|
49 OwnPtr<TextCodec> m_fallbackCodec; |
|
50 |
|
51 // static data shared by all converters |
|
52 static CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* s_availableCharsets; |
|
53 }; |
|
54 } |
|
55 |
|
56 #endif |