2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FLcl_CalendarImpl.h
20 * @brief This is the header file for the _CalendarImpl class.
22 * This header file contains the declarations of the _CalendarImpl class.
26 #ifndef _FLCL_INTERNAL_CALENDAR_IMPL_H_
27 #define _FLCL_INTERNAL_CALENDAR_IMPL_H_
29 #include <FLclCalendar.h>
31 namespace Tizen { namespace Locales
34 class _IcuCalendarImpl;
41 virtual ~_CalendarImpl();
43 virtual Calendar* CloneN(void) const;
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);
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);
58 result SetFirstDayOfWeekImpl(DayOfWeek dayOfWeek);
59 result SetLenientImpl(bool lenient);
60 result SetMinDaysInFirstWeekImpl(short value);
61 result SetTimeZoneImpl(const TimeZone& timeZone);
63 // Methods to clear/ adjust time-fields
64 result ClearImpl(void);
65 result ClearImpl(TimeField field);
67 result AddTimeField(TimeField field, int amount);
68 result RollImpl(TimeField field, int amount);
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;
76 int GetHashCode(void) const;
77 CalendarType GetType(void) const;
79 int GetTimeFieldImpl(TimeField field) const;
80 result GetTimeInMillisecImpl(long long& millisec) const;
81 Tizen::Base::DateTime GetTimeImpl(void) const;
83 int GetMinTimeField(TimeField field) const;
84 int GetActualMinTimeFieldImpl(TimeField field) const;
85 int GetGreatestMinTimeField(TimeField field) const;
87 int GetLeastMaxTimeField(TimeField field) const;
88 int GetActualMaxTimeFieldImpl(TimeField field) const;
89 int GetMaxTimeField(TimeField field) const;
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;
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;
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);
110 static const _IcuCalendarImpl* GetImpl(const Calendar& calendar);
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;
120 _CalendarImpl(const _CalendarImpl& orig);
121 _CalendarImpl& operator =(const _CalendarImpl& orig);
123 bool ValidateTimeField(TimeField field) const;
124 bool ValidateTimeFieldValue(TimeField field, int value) const;
125 bool ValidateDaysOfWeek(DayOfWeek dayOfWeek) const;
131 class _IcuCalendarImpl* __pCalendar;
137 #endif // _FLCL_INTERNAL_CALENDAR_IMPL_H_