Modified an api call flow
[platform/framework/native/appfw.git] / src / locales / FLcl_CalendarImpl.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_CalendarImpl.h
20  * @brief   This is the header file for the _CalendarImpl class.
21  *
22  * This header file contains the declarations of the _CalendarImpl class.
23  *
24  */
25
26 #ifndef _FLCL_INTERNAL_CALENDAR_IMPL_H_
27 #define _FLCL_INTERNAL_CALENDAR_IMPL_H_
28
29 #include <FLclCalendar.h>
30
31 namespace Tizen { namespace Locales
32 {
33
34 class _IcuCalendarImpl;
35
36 class _CalendarImpl
37         : public Calendar
38 {
39 public:
40         _CalendarImpl();
41         virtual ~_CalendarImpl();
42
43         virtual Calendar* CloneN(void) const;
44
45         // Construct methods
46         result Construct(CalendarType calendarType = CALENDAR_GREGORIAN);
47         result Construct(const TimeZone& timezone, CalendarType calendarType = CALENDAR_GREGORIAN);
48         result Construct(const Locale& locale, CalendarType calendarType = CALENDAR_GREGORIAN);
49         result Construct(const TimeZone& timezone, const Locale& locale, CalendarType calendarType = CALENDAR_GREGORIAN);
50         result Construct(const Calendar& otherCalendar);
51
52         // Set methods
53         result SetTimeFieldImpl(TimeField field, int value);
54         result SetTimeInMillisecImpl(long long millisec);
55         result SetTimeImpl(const Tizen::Base::DateTime& dateTime);
56         result SetTimeImpl(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0);
57
58         result SetFirstDayOfWeekImpl(DayOfWeek dayOfWeek);
59         result SetLenientImpl(bool lenient);
60         result SetMinDaysInFirstWeekImpl(short value);
61         result SetTimeZoneImpl(const TimeZone& timeZone);
62
63         // Methods to clear/ adjust time-fields
64         result ClearImpl(void);
65         result ClearImpl(TimeField field);
66
67         result AddTimeField(TimeField field, int amount);
68         result RollImpl(TimeField field, int amount);
69
70         // Methods to compare Calendars
71         result After(const _CalendarImpl& otherInstance, bool& after);
72         result Before(const _CalendarImpl& otherInstance, bool& before);
73         bool Equals(const _CalendarImpl& otherInstance) const;
74
75         // Get methods
76         int GetHashCode(void) const;
77         CalendarType GetType(void) const;
78
79         int GetTimeFieldImpl(TimeField field) const;
80         result GetTimeInMillisecImpl(long long& millisec) const;
81         Tizen::Base::DateTime GetTimeImpl(void) const;
82
83         int GetMinTimeField(TimeField field) const;
84         int GetActualMinTimeFieldImpl(TimeField field) const;
85         int GetGreatestMinTimeField(TimeField field) const;
86
87         int GetLeastMaxTimeField(TimeField field) const;
88         int GetActualMaxTimeFieldImpl(TimeField field) const;
89         int GetMaxTimeField(TimeField field) const;
90
91         int GetFirstDayOfWeekImpl(void) const;
92         int GetMinDaysInFirstWeekImpl(void) const;
93         result IsInDst(bool& isInDst) const;
94         bool IsLenientImpl(void) const;
95         bool IsSetImpl(TimeField field) const;
96         TimeZone GetTimeZoneImpl(void) const;
97
98         // methods for gregorian calendar
99         bool IsLeapYear(int year) const;
100         result SetGregorianChange(long long change);
101         long long GetGregorianChange(void) const;
102         result SetJulianDay(int julianDay);
103         int GetJulianDay(void) const;
104
105         static Calendar* CreateCalendarInstanceN(CalendarType calendarType);
106         static Calendar* CreateCalendarInstanceN(const TimeZone& timeZone, CalendarType calendarType);
107         static Calendar* CreateCalendarInstanceN(const Locale& locale, CalendarType calendarType);
108         static Calendar* CreateCalendarInstanceN(const TimeZone& timeZone, const Locale& locale, CalendarType calendarType);
109
110         static const _IcuCalendarImpl* GetImpl(const Calendar& calendar);
111
112         // added for backward compatibility
113         virtual result RollWithSingleUnit(TimeField field, bool up);
114         virtual result ComputeTimeFields(void);
115         virtual result ComputeTime(void);
116         virtual int GetMonthLength(int extendedYear, int month) const;
117         virtual int HandleGetLimit(TimeField field, CalendarLimitType limitType) const;
118
119 private:
120         _CalendarImpl(const _CalendarImpl& orig);
121         _CalendarImpl& operator =(const _CalendarImpl& orig);
122
123         bool ValidateTimeField(TimeField field) const;
124         bool ValidateTimeFieldValue(TimeField field, int value) const;
125         bool ValidateDaysOfWeek(DayOfWeek dayOfWeek) const;
126
127 private:
128         CalendarType __type;
129         Locale __locale;
130         TimeZone __timezone;
131         class _IcuCalendarImpl* __pCalendar;
132
133 };
134
135 }} // Tizen::Locales
136
137 #endif  // _FLCL_INTERNAL_CALENDAR_IMPL_H_