230a61c0baa61fe2f210124e8e59351f04d97ea1
[platform/framework/native/appfw.git] / src / base / inc / FBaseUtil_IcuConverter.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file                FBaseUtil_IcuConverter.h
19  * @brief               This is the header file for _ICUConverter.
20  */
21
22 #ifndef _FBASE_UTIL_ICU_CONVERTER_H_
23 #define _FBASE_UTIL_ICU_CONVERTER_H_
24
25 #include "unicode/ucnv.h"
26 #include "unicode/utypes.h"
27 #include <FBaseUtilTypes.h>
28 #include <FBaseString.h>
29
30
31 namespace Tizen { namespace Base { namespace Utility
32 {
33
34 class _ICUConverter
35 {
36         public:
37                 _ICUConverter();
38                 ~_ICUConverter();
39
40         private:
41                 result GetResultFromIcuErrorCode(UErrorCode& err);
42         public:
43                 bool OpenConverter(const Tizen::Base::String& encodingScheme);
44                 wchar_t* ConvertToUcharN(const char* src, int srcLength);
45                 char* ConvertFromUcharN(const wchar_t* pSrc, int srcLength, int& retLength);
46                 void CloseConverter(void);
47
48         private:
49                 UConverter* __pConverter;
50 }; // _ICUConverter
51
52 }}} // Tizen::Base::Utility
53
54 #endif // _FBASE_UTIL_ICU_CONVERTER_H_