Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / src / locales / FLcl_IcuCalendarImpl.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    FLcl_IcuCalendarImpl.h
19  * @brief   This is the header file for the _IcuCalendarImpl class.
20  *
21  * This header file contains the declarations of the _IcuCalendarImpl class.
22  *
23  */
24
25 #ifndef _FLCL_INTERNAL_ICU_CALENDAR_IMPL_H_
26 #define _FLCL_INTERNAL_ICU_CALENDAR_IMPL_H_
27
28 #include <unicode/uversion.h>
29
30 namespace U_ICU_NAMESPACE
31 {
32 class ErrorCode;
33 class Locale;
34 class SimpleTimeZone;
35 class Calendar;
36 }
37
38 namespace Tizen { namespace Locales
39 {
40
41 class _IcuCalendarImpl
42 {
43 public:
44         _IcuCalendarImpl();
45         virtual ~_IcuCalendarImpl();
46
47         virtual result Construct(const TimeZone& timeZone, const Locale& locale, int calendarType);
48         virtual _IcuCalendarImpl* CloneN(void);
49
50         // Date & Time Clear/ Get/ Set methods
51
52         virtual result Clear(void);
53         virtual result Clear(int field);
54
55         virtual result AddTimeField(int field, int amount);   // Affect all fields
56         virtual result Roll(int field, int amount);           // Does not affect higher fields
57         virtual result SetTime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0);
58
59         virtual int GetTimeField(int field) const;
60         virtual result SetTimeField(int field, int value);
61
62         virtual result GetTimeInMillisec(long long& millisec) const;
63         virtual result SetTimeInMillisec(long long millisec);
64
65         virtual int GetMaxTimeField(int field) const;
66         virtual int GetMinTimeField(int field) const;
67
68         // Comparison methods
69         virtual result After(const _IcuCalendarImpl& otherInstance, bool& after);
70         virtual result Before(const _IcuCalendarImpl& otherInstance, bool& before);
71         virtual bool Equals(const _IcuCalendarImpl& otherInstance);
72
73         // Methods to get properties
74         virtual int GetHashCode(void) const;
75
76         virtual int GetActualMinTimeField(int field) const;
77         virtual int GetGreatestMinTimeField(int field) const;
78         virtual int GetLeastMaxTimeField(int field) const;
79         virtual int GetActualMaxTimeField(int field) const;
80
81         virtual bool IsSet(int field) const;
82         virtual result IsInDst(bool& isInDst) const;
83         virtual bool IsLeapYear(int year) const;            // defined for GregorianCalendar
84
85         virtual bool IsLenient(void) const;
86         virtual result SetLenient(bool lenient);
87
88         virtual result SetFirstDayOfWeek(int dayOfWeek);
89         virtual int GetFirstDayOfWeek(void) const;
90
91         virtual int GetMinDaysInFirstWeek(void) const;
92         virtual result SetMinDaysInFirstWeek(short value);
93
94         virtual result SetTimeZone(const TimeZone& timeZone);
95
96         // For Gregorian Calendar
97         virtual long long GetGregorianChange(void) const;
98         virtual result SetGregorianChange(long long change);
99
100         virtual int GetJulianDay(void) const;
101         virtual result SetJulianDay(int julianDay);
102
103         U_ICU_NAMESPACE::Calendar* GetIcuCalendarCloneN(void) const;
104
105 private:
106         _IcuCalendarImpl(const _IcuCalendarImpl& orig);
107         _IcuCalendarImpl& operator =(const _IcuCalendarImpl& orig);
108
109         result GetOspException(U_ICU_NAMESPACE::ErrorCode icuException) const;
110
111         int GetIcuTimeField(int field) const;
112         int ConvertFromOspTimeFieldValue(int field, int value) const;
113         int ConvertToOspTimeFieldValue(int field, int value) const;
114
115         U_ICU_NAMESPACE::Locale GetIcuLocale(const Locale& ospLocale, int type) const;
116
117         void CheckInputFieldValueForOverFlow(int field, int value);
118         result ValidateFieldsForOverFlow(void) const;
119
120 private:
121         class U_ICU_NAMESPACE::Calendar* __pIcuCalendar;
122
123         bool __isEraFieldOverFlowed;
124 };
125
126 }} // Tizen::Locales
127
128 #endif  // _FLCL_INTERNAL_ICU_CALENDAR_IMPL_H_