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_TimeZoneImpl.h
19 * @brief This is the header file for the _TimeZoneImpl class.
21 * This header file contains declarations of the _TimeZoneImpl class.
25 #ifndef _FLCL_INTERNAL_TIME_ZONE_IMPL_H_
26 #define _FLCL_INTERNAL_TIME_ZONE_IMPL_H_
28 #include <unicode/simpletz.h>
30 #include <FBaseObject.h>
31 #include <FBaseString.h>
32 #include <FLclTimeRule.h>
33 #include <FLclTimeZone.h>
35 namespace Tizen { namespace Locales
39 : public Tizen::Base::Object
44 _TimeZoneImpl(int rawOffset, const Tizen::Base::String& id);
45 _TimeZoneImpl(int rawOffset, const Tizen::Base::String& id, const TimeRule& startRule, const TimeRule& endRule, int dstOffset);
46 _TimeZoneImpl(U_ICU_NAMESPACE::TimeZone& icuTimeZone);
47 _TimeZoneImpl(U_ICU_NAMESPACE::TimeZone& icuTimeZone, UDate icuDate);
49 _TimeZoneImpl(const _TimeZoneImpl& otherTimeZone);
51 virtual ~_TimeZoneImpl(void);
53 _TimeZoneImpl& operator =(const _TimeZoneImpl& otherTimeZone);
54 _TimeZoneImpl* CloneN(void);
56 bool operator ==(const _TimeZoneImpl& otherTimeZone) const;
57 bool operator !=(const _TimeZoneImpl& otherTimeZone) const;
58 virtual bool Equals(const Tizen::Base::Object& obj) const;
59 virtual int GetHashCode(void) const;
61 Tizen::Base::String GetId(void) const;
62 void SetId(const Tizen::Base::String& id);
64 int GetRawOffset(void) const;
65 void SetRawOffset(int rawOffset);
67 int GetDstStartingYear(void) const;
68 void SetDstStartingYear(int year);
70 int GetDstSavings(void) const;
71 void SetDstSavings(int dstSavings);
73 const TimeRule* GetDstStartingRule(void) const;
74 void SetDstStartingRule(const TimeRule& startRule);
76 const TimeRule* GetDstEndingRule(void) const;
77 void SetDstEndingRule(const TimeRule& endRule);
79 result SetDstRules(const TimeRule& startRule, const TimeRule& endRule, int dstSavings = 60);
81 result GetOffset(const Tizen::Base::DateTime& date, bool local, int& rawOffset, int& dstOffset) const;
82 result GetOffset(long long ticks, int& offset) const;
83 bool IsDstUsed(void) const;
85 U_ICU_NAMESPACE::SimpleTimeZone GetIcuTimeZone(void) const;
87 static const _TimeZoneImpl* GetTimeZoneImpl(const TimeZone& ospTimeZone);
88 static result GetTimeZone(const Tizen::Base::String& id, Tizen::Locales::TimeZone& timeZone);
89 static result GetTimeZone(const Tizen::Base::String& id, const Tizen::Base::DateTime& utcTime, Tizen::Locales::TimeZone& timeZone);
92 void GetIcuTimeRuleValue(const TimeRule& ospRule, int& month, int& dayOfWeekInMonth, int& dayOfWeek, int& time, int& mode);
93 result GetTimeRuleFromIcuDateTimeRule(const U_ICU_NAMESPACE::DateTimeRule* pIcuRule, TimeRule& ospRule);
96 static const int ONE_MIN_IN_MILLISEC = 60 * 1000;
97 static const int ONE_HOUR_IN_MILLISEC = 60 * ONE_MIN_IN_MILLISEC;
98 static const int ONE_DAY_IN_MILLISEC = 24 * ONE_HOUR_IN_MILLISEC;
99 static const int ONE_DAY_IN_MINUTE = 24 * 60;
102 U_ICU_NAMESPACE::SimpleTimeZone __icuTimeZone;
104 int __dstStartingYear;
105 TimeRule __startingRule;
106 TimeRule __endingRule;
108 static const int DAY_UNDEFINED = -1;
112 #endif //_FLCL_INTERNAL_TIME_ZONE_IMPL_H_