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 FLclTimeRule.h
20 * @brief This is the header file for the %TimeRule class.
22 * This header file contains declarations of the %TimeRule class.
24 #ifndef _FLCL_TIME_RULE_H_
25 #define _FLCL_TIME_RULE_H_
27 #include <FBaseObject.h>
28 #include <FSysSystemTime.h>
30 namespace Tizen { namespace Locales
35 * @brief This class is for setting and getting the time rule.
39 * @final This class is not intended for extension.
41 * The %TimeRule class defines the time rule and provides methods for setting and getting it.
42 * This class does not execute any operation with its value and is mainly used when periodically repeated time rules are defined.
43 * For example, the daylight saving time rule.
45 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/locales/time_rules.htm">Time Rules</a>.
47 * @see Tizen::Locales::TimeZone
53 * Defines the months. @n
54 * The indexing is 1-based.
60 JANUARY = 1, /**< January */
61 FEBRUARY, /**< February */
67 AUGUST, /**< August */
68 SEPTEMBER, /**< September */
69 OCTOBER, /**< October */
70 NOVEMBER, /**< November */
71 DECEMBER, /**< December */
72 MONTH_UNDEFINED = -1 // Undefined
79 * Defines the days of the week. @n
80 * The indexing is 1-based.
86 SUNDAY = 1, /**< Sunday */
87 MONDAY, /**< Monday */
88 TUESDAY, /**< Tuesday */
89 WEDNESDAY, /**< Wednesday */
90 THURSDAY, /**< Thursday */
91 FRIDAY, /**< Friday */
92 SATURDAY, /**< Saturday */
93 DAY_OF_WEEK_UNDEFINED = -1 //*< Undefined */
105 FIRST_WEEK = 1, /**< The first week */
106 SECOND_WEEK = 2, /**< The second week */
107 THIRD_WEEK = 3, /**< The third week */
108 FOURTH_WEEK = 4, /**< The fourth week */
109 FIFTH_WEEK = 5, /**< The fifth week */
110 SIXTH_WEEK = 6, /**< The sixth week */
111 LAST_WEEK = -2, /**< The last week */
112 WEEK_UNDEFINED = -1 //*< Undefined */
115 class _OSP_EXPORT_ TimeRule
116 : public Tizen::Base::Object
120 * Initializes the current instance of %TimeRule with the values of the specified %TimeRule instance. @n
121 * Copying of objects using this copy constructor is allowed.
125 * @param[in] timeRule An instance of %TimeRule
127 TimeRule(const TimeRule& timeRule);
130 * Assigns the value of the specified instance to the current instance of %TimeRule. @n
131 * Copying of objects using this copy assignment operator is allowed.
135 * @param[in] timeRule An instance of %TimeRule
137 TimeRule& operator =(const TimeRule& timeRule);
140 * This is the destructor for this class. @n
141 * This destructor overrides Tizen::Base::Object::~Object().
145 virtual ~TimeRule(void);
148 * Initializes the current instance of %TimeRule with the specified @c month, @c day, @c hour,
149 * @c minute, and @c timeMode.
153 * @param[in] month The month
154 * @param[in] day The day
155 * @param[in] hour The hour
156 * @param[in] minute The minute
157 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, or TIME_MODE_WALL
159 TimeRule(Month month, int day, int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
162 * Initializes the current instance of %TimeRule with the specified @c month, @c week,
163 * @c dayOfWeek, @c hour, @c minute, and @c timeMode.
167 * @param[in] month The month
168 * @param[in] week The week
169 * @param[in] dayOfWeek The day of the week
170 * @param[in] hour The hour
171 * @param[in] minute The minute
172 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, or TIME_MODE_WALL
174 TimeRule(Month month, Week week, DayOfWeek dayOfWeek,
175 int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
178 * Initializes the current instance of %TimeRule with the specified @c month, @c day,
179 * @c dayOfWeek, @c onOrAfterDay setting, @c hour, @c minute, and @c timeMode.
183 * @param[in] month The month
184 * @param[in] day The day
185 * @param[in] dayOfWeek The day of the week
186 * @param[in] onOrAfterDay Set to @c true to select the first @c dayOfWeek
187 * @b on @b or @b after @c day, @n
188 * else @c false to select the last @c dayOfWeek
189 * @b on @b or @b before @c day
190 * @param[in] hour The hour
191 * @param[in] minute The minute
192 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, or TIME_MODE_WALL
194 TimeRule(Month month, int day, DayOfWeek dayOfWeek,
195 bool onOrAfterDay, int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
204 Month GetMonth(void) const;
211 * @return An integer value indicating the day, @n
212 * else @c -1 if the value of day is undefined
214 int GetDay(void) const;
221 * @return The week, @n
222 * else @c -1 if the value of week is undefined
224 Week GetWeek(void) const;
227 * Gets the day of the week.
231 * @return The day of the week, @n
232 * else @c -1 if the value of day of the week is undefined
234 DayOfWeek GetDayOfWeek(void) const;
241 * @return An integer value indicating the hour
243 int GetHour(void) const;
250 * @return An integer value indicating the minute
252 int GetMinute(void) const;
255 * Gets the time mode.
259 * @return An instance of Tizen::System::TimeMode
261 Tizen::System::TimeMode GetTimeMode(void) const;
264 * Gets the value of the @c onOrAfterDay field.
268 * @return A @c boolean value of the @c onOrAfterDay field
270 bool IsOnOrAfterDay(void) const;
273 * Checks whether the value of the specified instance is equal to that of the current instance.
277 * @return @c true if the value of the specified instance is equal to that of the current instance, @n
279 * @param[in] obj The object to compare with the current instance
281 virtual bool Equals(const Tizen::Base::Object& obj) const;
284 * Gets the hash value of the current instance.
288 * @return The hash value of the current instance
290 virtual int GetHashCode(void) const;
294 * Initializes a %TimeRule instance with given values.
296 * @return An error code
297 * @param[in] month The month
298 * @param[in] day The day
299 * @param[in] week The week
300 * @param[in] dayOfWeek The day of week
301 * @param[in] beforeAfter If @c after is ON_OR_AFTER_DAY, this rule selects the first @c dayOfWeek
302 * @b on @b or @b after @c day.
303 * If @c after is ON_OR_BEFORE_DAY, this rule selects the last @c dayOfWeek
304 * @b on @b or @b before @c day.
305 * @param[in] hour The hour
306 * @param[in] minute The minute
307 * @param[in] timeMode The time mode - TIME_MODE_UTC, TIME_MODE_STANDARD, TIME_MODE_WALL
309 void SetValue(Month month, int day, Week week,
310 DayOfWeek dayOfWeek, bool onOrAfterDay, int hour,
311 int minute, Tizen::System::TimeMode timeMode);
313 int GetRuleMode(void) const;
315 static const int DAY_UNDEFINED = -1;
320 DayOfWeek __dayOfWeek;
323 Tizen::System::TimeMode __timeMode;
327 friend class _TimeRuleImpl;
328 class _TimeRuleImpl* __pTimeRuleImpl;
330 friend class _TimeZoneImpl;
331 friend class _LocaleData;
335 #endif // _FLCL_TIME_RULE_H_