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 FLcl_CalendarImpl.h
19 * @brief This is the header file for the _CalendarImpl class.
21 * This header file contains the declarations of the _CalendarImpl class.
25 #ifndef _FLCL_INTERNAL_CALENDAR_IMPL_H_
26 #define _FLCL_INTERNAL_CALENDAR_IMPL_H_
28 #include <FLclCalendar.h>
30 namespace Tizen { namespace Locales
33 class _IcuCalendarImpl;
40 virtual ~_CalendarImpl();
42 virtual Calendar* CloneN(void) const;
45 result Construct(CalendarType calendarType = CALENDAR_GREGORIAN);
46 result Construct(const TimeZone& timezone, CalendarType calendarType = CALENDAR_GREGORIAN);
47 result Construct(const Locale& locale, CalendarType calendarType = CALENDAR_GREGORIAN);
48 result Construct(const TimeZone& timezone, const Locale& locale, CalendarType calendarType = CALENDAR_GREGORIAN);
49 result Construct(const Calendar& otherCalendar);
52 result SetTimeFieldImpl(TimeField field, int value);
53 result SetTimeInMillisecImpl(long long millisec);
54 result SetTimeImpl(const Tizen::Base::DateTime& dateTime);
55 result SetTimeImpl(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0);
57 result SetFirstDayOfWeekImpl(DayOfWeek dayOfWeek);
58 result SetLenientImpl(bool lenient);
59 result SetMinDaysInFirstWeekImpl(short value);
60 result SetTimeZoneImpl(const TimeZone& timeZone);
62 // Methods to clear/ adjust time-fields
63 result ClearImpl(void);
64 result ClearImpl(TimeField field);
66 result AddTimeField(TimeField field, int amount);
67 result RollImpl(TimeField field, int amount);
69 // Methods to compare Calendars
70 result AfterImpl(const _CalendarImpl& otherInstance, bool& after);
71 result BeforeImpl(const _CalendarImpl& otherInstance, bool& before);
72 bool EqualsImpl(const _CalendarImpl& otherInstance) const;
75 int GetHashCodeImpl(void) const;
76 CalendarType GetType(void) const;
78 int GetTimeFieldImpl(TimeField field) const;
79 result GetTimeInMillisecImpl(long long& millisec) const;
80 Tizen::Base::DateTime GetTimeImpl(void) const;
82 int GetMinTimeFieldImpl(TimeField field) const;
83 int GetActualMinTimeFieldImpl(TimeField field) const;
84 int GetGreatestMinTimeFieldImpl(TimeField field) const;
86 int GetLeastMaxTimeFieldImpl(TimeField field) const;
87 int GetActualMaxTimeFieldImpl(TimeField field) const;
88 int GetMaxTimeFieldImpl(TimeField field) const;
90 int GetFirstDayOfWeekImpl(void) const;
91 int GetMinDaysInFirstWeekImpl(void) const;
92 result IsInDst(bool& isInDst) const;
93 bool IsLenientImpl(void) const;
94 bool IsSetImpl(TimeField field) const;
95 TimeZone GetTimeZoneImpl(void) const;
97 // methods for gregorian calendar
98 bool IsLeapYear(int year) const;
99 result SetGregorianChange(long long change);
100 long long GetGregorianChange(void) const;
101 result SetJulianDay(int julianDay);
102 int GetJulianDay(void) const;
104 static Calendar* CreateCalendarInstanceN(CalendarType calendarType);
105 static Calendar* CreateCalendarInstanceN(const TimeZone& timeZone, CalendarType calendarType);
106 static Calendar* CreateCalendarInstanceN(const Locale& locale, CalendarType calendarType);
107 static Calendar* CreateCalendarInstanceN(const TimeZone& timeZone, const Locale& locale, CalendarType calendarType);
109 static const _IcuCalendarImpl* GetImpl(const Calendar& calendar);
111 // added for backward compatibility
112 virtual result RollWithSingleUnit(TimeField field, bool up);
113 virtual result ComputeTimeFields(void);
114 virtual result ComputeTime(void);
115 virtual int GetMonthLength(int extendedYear, int month) const;
116 virtual int HandleGetLimit(TimeField field, CalendarLimitType limitType) const;
119 _CalendarImpl(const _CalendarImpl& orig);
120 _CalendarImpl& operator =(const _CalendarImpl& orig);
122 bool ValidateTimeField(TimeField field) const;
123 bool ValidateTimeFieldValue(TimeField field, int value) const;
124 bool ValidateDaysOfWeek(DayOfWeek dayOfWeek) const;
130 class _IcuCalendarImpl* __pCalendar;
136 #endif // _FLCL_INTERNAL_CALENDAR_IMPL_H_