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 FLclTimeRule.h
19 * @brief This is the header file for the %TimeRule class.
21 * This header file contains declarations of the %TimeRule class.
23 #ifndef _FLCL_TIME_RULE_H_
24 #define _FLCL_TIME_RULE_H_
26 #include <FBaseObject.h>
27 #include <FSysSystemTime.h>
29 namespace Tizen { namespace Locales
34 * @brief This class is for setting and getting the time rule.
38 * @final This class is not intended for extension.
40 * The %TimeRule class defines the time rule and provides methods for setting and getting it.
41 * This class does not execute any operation with its value and is mainly used when periodically repeated time rules are defined.
42 * For example, the daylight saving time rule.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/locales/time_rules.htm">Time Rules</a>.
46 * @see Tizen::Locales::TimeZone
52 * Defines the months. @n
53 * The indexing is 1-based.
59 JANUARY = 1, /**< January */
60 FEBRUARY, /**< February */
66 AUGUST, /**< August */
67 SEPTEMBER, /**< September */
68 OCTOBER, /**< October */
69 NOVEMBER, /**< November */
70 DECEMBER, /**< December */
71 MONTH_UNDEFINED = -1 // Undefined
78 * Defines the days of the week. @n
79 * The indexing is 1-based.
85 SUNDAY = 1, /**< Sunday */
86 MONDAY, /**< Monday */
87 TUESDAY, /**< Tuesday */
88 WEDNESDAY, /**< Wednesday */
89 THURSDAY, /**< Thursday */
90 FRIDAY, /**< Friday */
91 SATURDAY, /**< Saturday */
92 DAY_OF_WEEK_UNDEFINED = -1 //*< Undefined */
104 FIRST_WEEK = 1, /**< The first week */
105 SECOND_WEEK = 2, /**< The second week */
106 THIRD_WEEK = 3, /**< The third week */
107 FOURTH_WEEK = 4, /**< The fourth week */
108 FIFTH_WEEK = 5, /**< The fifth week */
109 SIXTH_WEEK = 6, /**< The sixth week */
110 LAST_WEEK = -2, /**< The last week */
111 WEEK_UNDEFINED = -1 //*< Undefined */
114 class _OSP_EXPORT_ TimeRule
115 : public Tizen::Base::Object
119 * Initializes the current instance of %TimeRule with the values of the specified %TimeRule instance. @n
120 * Copying of objects using this copy constructor is allowed.
124 * @param[in] timeRule An instance of %TimeRule
126 TimeRule(const TimeRule& timeRule);
129 * Assigns the value of the specified instance to the current instance of %TimeRule. @n
130 * Copying of objects using this copy assignment operator is allowed.
134 * @param[in] timeRule An instance of %TimeRule
136 TimeRule& operator =(const TimeRule& timeRule);
139 * This is the destructor for this class. @n
140 * This destructor overrides Tizen::Base::Object::~Object().
144 virtual ~TimeRule(void);
147 * Initializes the current instance of %TimeRule with the specified @c month, @c day, @c hour,
148 * @c minute, and @c timeMode.
152 * @param[in] month The month
153 * @param[in] day The day
154 * @param[in] hour The hour
155 * @param[in] minute The minute
156 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, or TIME_MODE_WALL
158 TimeRule(Month month, int day, int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
161 * Initializes the current instance of %TimeRule with the specified @c month, @c week,
162 * @c dayOfWeek, @c hour, @c minute, and @c timeMode.
166 * @param[in] month The month
167 * @param[in] week The week
168 * @param[in] dayOfWeek The day of the week
169 * @param[in] hour The hour
170 * @param[in] minute The minute
171 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, or TIME_MODE_WALL
173 TimeRule(Month month, Week week, DayOfWeek dayOfWeek,
174 int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
177 * Initializes the current instance of %TimeRule with the specified @c month, @c day,
178 * @c dayOfWeek, @c onOrAfterDay setting, @c hour, @c minute, and @c timeMode.
182 * @param[in] month The month
183 * @param[in] day The day
184 * @param[in] dayOfWeek The day of the week
185 * @param[in] onOrAfterDay Set to @c true to select the first @c dayOfWeek
186 * @b on @b or @b after @c day, @n
187 * else @c false to select the last @c dayOfWeek
188 * @b on @b or @b before @c day
189 * @param[in] hour The hour
190 * @param[in] minute The minute
191 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, or TIME_MODE_WALL
193 TimeRule(Month month, int day, DayOfWeek dayOfWeek,
194 bool onOrAfterDay, int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
203 Month GetMonth(void) const;
210 * @return An integer value indicating the day, @n
211 * else @c -1 if the value of day is undefined
213 int GetDay(void) const;
220 * @return The week, @n
221 * else @c -1 if the value of week is undefined
223 Week GetWeek(void) const;
226 * Gets the day of the week.
230 * @return The day of the week, @n
231 * else @c -1 if the value of day of the week is undefined
233 DayOfWeek GetDayOfWeek(void) const;
240 * @return An integer value indicating the hour
242 int GetHour(void) const;
249 * @return An integer value indicating the minute
251 int GetMinute(void) const;
254 * Gets the time mode.
258 * @return An instance of Tizen::System::TimeMode
260 Tizen::System::TimeMode GetTimeMode(void) const;
263 * Gets the value of the @c onOrAfterDay field.
267 * @return A @c boolean value of the @c onOrAfterDay field
269 bool IsOnOrAfterDay(void) const;
272 * Checks whether the value of the specified instance is equal to that of the current instance.
276 * @return @c true if the value of the specified instance is equal to that of the current instance, @n
278 * @param[in] obj The object to compare with the current instance
280 virtual bool Equals(const Tizen::Base::Object& obj) const;
283 * Gets the hash value of the current instance.
287 * @return The hash value of the current instance
289 virtual int GetHashCode(void) const;
293 * Initializes a %TimeRule instance with given values.
295 * @return An error code
296 * @param[in] month The month
297 * @param[in] day The day
298 * @param[in] week The week
299 * @param[in] dayOfWeek The day of week
300 * @param[in] beforeAfter If @c after is ON_OR_AFTER_DAY, this rule selects the first @c dayOfWeek
301 * @b on @b or @b after @c day.
302 * If @c after is ON_OR_BEFORE_DAY, this rule selects the last @c dayOfWeek
303 * @b on @b or @b before @c day.
304 * @param[in] hour The hour
305 * @param[in] minute The minute
306 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, TIME_MODE_WALL
308 void SetValue(Month month, int day, Week week,
309 DayOfWeek dayOfWeek, bool onOrAfterDay, int hour,
310 int minute, Tizen::System::TimeMode timeMode);
312 int GetRuleMode(void) const;
314 static const int DAY_UNDEFINED = -1;
319 DayOfWeek __dayOfWeek;
322 Tizen::System::TimeMode __timeMode;
326 friend class _TimeRuleImpl;
327 class _TimeRuleImpl* __pTimeRuleImpl;
329 friend class _TimeZoneImpl;
330 friend class _LocaleData;
334 #endif // _FLCL_TIME_RULE_H_