2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FText_IcuEncodingCore.h
19 * @brief This is the header file for the _IcuEncodingCore class.
22 #ifndef _FTEXT_INTERNAL_ICU_ENCODING_CORE_H_
23 #define _FTEXT_INTERNAL_ICU_ENCODING_CORE_H_
25 #include "unicode/utypes.h"
26 #include "unicode/ucnv.h"
28 #include "FText_EncodingCore.h"
30 typedef UChar IcuUChar;
31 typedef UConverter IcuUConverter;
33 namespace Tizen { namespace Text
36 class _IcuEncodingCore
37 : public _EncodingCore
40 _IcuEncodingCore(void);
41 virtual ~_IcuEncodingCore(void);
43 static _EncodingCore* GetEncodingCoreImplN(const Tizen::Base::String& encodingFrom, const Tizen::Base::String& encodingTo);
45 virtual result GetByteCount(const wchar_t* pSrc, int srcLength, int& retLength);
46 virtual result GetCharCount(const byte* pSrc, int srcLength, int& retLength);
48 virtual byte* EncodeN(const wchar_t* pSrc, int srcLength, int& retLength);
49 virtual wchar_t* DecodeN(const byte* pSrc, int srcLength, int& retLength);
51 virtual byte* EncodeExN(const wchar_t* pSrc, int srcLength, int& retLength, bool flush);
52 virtual wchar_t* DecodeExN(const byte* pSrc, int srcLength, int& retLength, bool flush);
54 virtual int GetMaxByteCount(int charCount) const;
55 virtual int GetMaxCharCount(int byteCount) const;
57 virtual Tizen::Base::String GetName(void);
60 result GetResultFromIcuErrorCode(UErrorCode& err);
61 IcuUChar* GetIcuUcharN(const Tizen::Base::String& ospString, result& r);
63 result __Encode(const wchar_t* pSrc, int srcLength, byte* pDst, int dstLength, int& retLength);
64 result __Decode(const byte* pSrc, int srcLength, wchar_t* pDst, int dstLength, int& retLength);
66 _IcuEncodingCore(const _IcuEncodingCore& icuEncodingCore);
67 _IcuEncodingCore& operator =(const _IcuEncodingCore& icuEncodingCore);
71 IcuUConverter* __pEncoder;
73 }; // _IcuEncodingCore
79 #endif //_FTEXT_INTERNAL_ICU_ENCODING_CORE_H_