Update doxygen for privilege
[platform/framework/native/appfw.git] / inc / FLclTimeRule.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FLclTimeRule.h
20  * @brief               This is the header file for the %TimeRule class.
21  *
22  * This header file contains declarations of the %TimeRule class.
23  */
24 #ifndef _FLCL_TIME_RULE_H_
25 #define _FLCL_TIME_RULE_H_
26
27 #include <FBaseObject.h>
28 #include <FSysSystemTime.h>
29
30 namespace Tizen { namespace Locales
31 {
32
33 /**
34  * @class               TimeRule
35  * @brief               This class is for setting and getting the time rule.
36  *
37  * @since               2.0
38  *
39  * @final       This class is not intended for extension.
40  *
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.
44  *
45  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/locales/time_rules.htm">Time Rules</a>.
46  *
47  * @see         Tizen::Locales::TimeZone
48  */
49
50 /**
51 * @enum Month
52 *
53 * Defines the months. @n
54 * The indexing is 1-based.
55 *
56 * @since                2.0
57 */
58 enum Month
59 {
60         JANUARY = 1,    /**< January    */
61         FEBRUARY,       /**< February   */
62         MARCH,          /**< March              */
63         APRIL,          /**< April              */
64         MAY,            /**< May                */
65         JUNE,           /**< June               */
66         JULY,           /**< July               */
67         AUGUST,         /**< August             */
68         SEPTEMBER,      /**< September  */
69         OCTOBER,        /**< October    */
70         NOVEMBER,       /**< November   */
71         DECEMBER,       /**< December   */
72         MONTH_UNDEFINED = -1    // Undefined
73 };
74
75
76 /**
77 * @enum DayOfWeek
78 *
79 * Defines the days of the week. @n
80 * The indexing is 1-based.
81 *
82 * @since                2.0
83 */
84 enum DayOfWeek
85 {
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 */
94 };
95
96 /**
97  * @enum Week
98  *
99  * Defines the week.
100  *
101  * @since               2.0
102  */
103 enum Week
104 {
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 */
113 };
114
115 class _OSP_EXPORT_ TimeRule
116         : public Tizen::Base::Object
117 {
118 public:
119         /**
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.
122          *
123          * @since                       2.0
124          *
125          * @param[in]           timeRule                        An instance of %TimeRule
126          */
127         TimeRule(const TimeRule& timeRule);
128
129         /**
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.
132          *
133          * @since                       2.0
134          *
135          * @param[in]           timeRule                        An instance of %TimeRule
136          */
137         TimeRule& operator =(const TimeRule& timeRule);
138
139         /**
140          * This is the destructor for this class. @n
141          * This destructor overrides Tizen::Base::Object::~Object().
142          *
143          * @since               2.0
144          */
145         virtual ~TimeRule(void);
146
147         /**
148          * Initializes the current instance of %TimeRule with the specified @c month, @c day, @c hour,
149          * @c minute, and @c timeMode.
150          *
151          * @since                       2.0
152          *
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
158          */
159         TimeRule(Month month, int day, int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
160
161         /**
162          * Initializes the current instance of %TimeRule with the specified @c month, @c week,
163          * @c dayOfWeek, @c hour, @c minute, and @c timeMode.
164          *
165          * @since                       2.0
166          *
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
173          */
174         TimeRule(Month month, Week week, DayOfWeek dayOfWeek,
175                 int hour = 0, int minute = 0, Tizen::System::TimeMode timeMode = Tizen::System::TIME_MODE_WALL);
176
177         /**
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.
180          *
181          * @since                       2.0
182          *
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
193          */
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);
196
197         /**
198          * Gets the month.
199          *
200          * @since                       2.0
201          *
202          * @return                      The month
203          */
204         Month GetMonth(void) const;
205
206         /**
207          * Gets the day.
208          *
209          * @since                       2.0
210          *
211          * @return                      An integer value indicating the day, @n
212          *                                        else @c -1 if the value of day is undefined
213          */
214         int GetDay(void) const;
215
216         /**
217          * Gets the week.
218          *
219          * @since                       2.0
220          *
221          * @return                      The week, @n
222          *                                        else @c -1 if the value of week is undefined
223          */
224         Week GetWeek(void) const;
225
226         /**
227          * Gets the day of the week.
228          *
229          * @since                       2.0
230          *
231          * @return                      The day of the week, @n
232          *                                        else @c -1 if the value of day of the week is undefined
233          */
234         DayOfWeek GetDayOfWeek(void) const;
235
236         /**
237          * Gets the hour.
238          *
239          * @since                       2.0
240          *
241          * @return                      An integer value indicating the hour
242          */
243         int GetHour(void) const;
244
245         /**
246          * Gets the minute.
247          *
248          * @since                       2.0
249          *
250          * @return                      An integer value indicating the minute
251          */
252         int GetMinute(void) const;
253
254         /**
255          * Gets the time mode.
256          *
257          * @since                       2.0
258          *
259          * @return                      An instance of Tizen::System::TimeMode
260          */
261         Tizen::System::TimeMode GetTimeMode(void) const;
262
263         /**
264          * Gets the value of the @c onOrAfterDay field.
265          *
266          * @since                       2.0
267          *
268          * @return                      A @c boolean value of the @c onOrAfterDay field
269          */
270         bool IsOnOrAfterDay(void) const;
271
272         /**
273          * Checks whether the value of the specified instance is equal to that of the current instance.
274          *
275          * @since                       2.0
276          *
277          * @return                      @c true if the value of the specified instance is equal to that of the current instance, @n
278          *                                        else @c false
279          * @param[in]           obj The object to compare with the current instance
280          */
281         virtual bool Equals(const Tizen::Base::Object& obj) const;
282
283         /**
284          * Gets the hash value of the current instance.
285          *
286          * @since                       2.0
287          *
288          * @return                      The hash value of the current instance
289          */
290         virtual int GetHashCode(void) const;
291
292 private:
293         /**
294          * Initializes a %TimeRule instance with given values.
295          *
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
308          */
309         void SetValue(Month month, int day, Week week,
310                 DayOfWeek dayOfWeek, bool onOrAfterDay, int hour,
311                 int minute, Tizen::System::TimeMode timeMode);
312
313         int GetRuleMode(void) const;
314
315         static const int DAY_UNDEFINED = -1;
316
317         Month __month;
318         int __day;
319         Week __week;
320         DayOfWeek __dayOfWeek;
321         int __hour;
322         int __minute;
323         Tizen::System::TimeMode __timeMode;
324         bool __onOrAfterDay;
325
326
327         friend class _TimeRuleImpl;
328         class _TimeRuleImpl* __pTimeRuleImpl;
329
330         friend class _TimeZoneImpl;
331         friend class _LocaleData;
332 }; // TimeRule
333
334 }} // Tizen::Locales
335 #endif  // _FLCL_TIME_RULE_H_