ba4f9a2ef3fcd1e380dad4e61a6449fb90b051c0
[platform/framework/native/appfw.git] / src / locales / FLcl_LocaleImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FLcl_LocaleImpl.h
20  * @brief       This is the header file for the _LocaleImpl class.
21  *
22  * This header file contains declarations of the _LocaleImpl class.
23  *
24  */
25
26 #ifndef _FLCL_INTERNAL_LOCALE_IMPL_H_
27 #define _FLCL_INTERNAL_LOCALE_IMPL_H_
28
29 #include <unicode/locid.h>
30 #include <FBaseObject.h>
31
32 using namespace Tizen::Base;
33
34 namespace Tizen { namespace Locales
35 {
36
37 class Locale;
38
39 class _LocaleImpl
40         : public Tizen::Base::Object
41 {
42 public:
43         _LocaleImpl(void);
44         _LocaleImpl(const char* pLocaleCode);
45         _LocaleImpl(const char* pLanguage, const char* pCountry, const char* pVariant = null);
46         _LocaleImpl(const U_ICU_NAMESPACE::Locale& icuLocale);
47
48         _LocaleImpl* CloneN(void);
49
50         virtual ~_LocaleImpl(void);
51
52         bool operator ==(const _LocaleImpl& otherLocale) const;
53         bool operator !=(const _LocaleImpl& otherLocale) const;
54         virtual bool Equals(const Tizen::Base::Object& obj) const;
55         virtual int GetHashCode(void) const;
56
57         String GetLanguageCodeString(bool isTwoLetter);
58
59         result GetLanguageName(Tizen::Base::String& languageName) const;
60         result GetLanguageName(const _LocaleImpl& otherLocale, Tizen::Base::String& languageName) const;
61
62         const char* Get2LetterCountryCodeString(void) const;
63         const char* Get3LetterCountryCodeString(void) const;
64         result GetCountryName(Tizen::Base::String& countryName) const;
65         result GetCountryName(const _LocaleImpl& otherLocale, Tizen::Base::String& countryName) const;
66
67         const char* GetVariantCodeString(void) const;
68         void SetVariantCodeString(const char* pVariantCode = null);
69
70         const char* GetLocaleCodeString(void) const;
71
72         bool IsSupported(void) const;
73
74         U_ICU_NAMESPACE::Locale GetIcuLocale (void) const;
75         Locale GetOspLocale(void);
76
77         static bool IsSupported(const Locale& ospLocale);
78         static const _LocaleImpl* GetLocaleImpl(const Locale& ospLocale);
79
80         static String Get2LetterLanguageCodeString(const char* pLanguageCodeString);
81         static String Get3LetterLanguageCodeString(const char* pLanguageCodeString);
82
83         static const char* Get2LetterCountryCodeString(const char* pCountryCodeString);
84         static const char* Get3LetterCountryCodeString(const char* pCountryCodeString);
85
86 private:
87         U_ICU_NAMESPACE::Locale __icuLocale;
88 }; // _LocaleImpl
89
90 }} // Tizen::Locales
91
92 #endif //_FLCL_INTERNAL_LOCALE_IMPL_H_