Update change log and spec for wrt-plugins-tizen_0.4.13
[framework/web/wrt-plugins-tizen.git] / src / Calendar / EventRecurrenceRule.h
1 //
2 // Tizen Web Device API
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 #ifndef _EVENT_RECURRENCE_RULE_H_
20 #define _EVENT_RECURRENCE_RULE_H_
21
22 #include <string>
23 #include <vector>
24 #include <ctime>
25 #include <dpl/shared_ptr.h>
26
27 #include <JavaScriptCore/JavaScript.h>
28
29 namespace DeviceAPI {
30 namespace Calendar {
31
32 typedef std::vector<std::string> StringArray;
33 typedef DPL::SharedPtr<StringArray> StringArrayPtr;
34
35 typedef std::vector<long long int> NumberArray;
36 typedef DPL::SharedPtr<NumberArray> NumberArrayPtr;
37
38 #define UNDEFINED_TIME -1
39 #define DEFAULT_TIMEZONE ""
40 #define DEFAULT_INTERVAL 1
41
42 class EventRecurrenceRule
43 {
44   public:
45
46     typedef enum
47     {
48         NO_RECURRENCE,
49         DAILY_RECURRENCE,
50         WEEKLY_RECURRENCE,
51         MONTHLY_RECURRENCE,
52         YEARLY_RECURRENCE,
53         UNDEFINED_RECURRENCE
54     } EventRecurrence;
55
56     EventRecurrenceRule();
57     virtual ~EventRecurrenceRule();
58
59     EventRecurrence getFrequency() const;
60     void setFrequency(const EventRecurrence &value);
61
62     int getInterval() const;
63     void setInterval(const int &value);
64
65     long long int getEndDate() const;
66     void setEndDate(long long int value);
67
68     long getOccurrenceCount() const;
69     void setOccurrenceCount(long value);
70
71     std::vector<int> getDaysOfTheMonth() const;
72     void setDaysOfTheMonth(std::vector<int> value);
73
74     StringArrayPtr getDaysOfTheWeek() const;
75     void setDaysOfTheWeek(StringArrayPtr value);
76     JSObjectRef getDaysOfTheWeekJSRef() const;
77     void setDaysOfTheWeekJSRef(const JSObjectRef value);
78
79     std::vector<int> getDaysOfTheYear() const;
80     void setDaysOfTheYear(std::vector<int> value);
81
82     std::vector<int> getWeeksOfTheYear() const;
83     void setWeeksOfTheYear(std::vector<int> value);
84
85     NumberArrayPtr getSetPositions() const;
86     void setSetPositions(NumberArrayPtr value);
87     JSObjectRef getSetPositionsJSRef() const;
88     void setSetPositionsJSRef(const JSObjectRef value);
89
90     NumberArrayPtr getExceptions() const;
91     void setExceptions(NumberArrayPtr value);
92     JSObjectRef getExceptionsJSRef() const;
93     void setExceptionsJSRef(const JSObjectRef value);
94
95     std::string getTimeZone() const;
96     void setTimeZone(std::string value);
97
98         JSContextRef getContext() const;
99         void setContext(const JSContextRef contextRef);
100
101   protected:
102     EventRecurrence m_frequency;
103     int m_interval;
104     long long int m_endDate;
105     long m_occurrenceCount;
106     std::vector<int> m_daysOfTheMonth;
107     StringArrayPtr m_daysOfTheWeek;
108         JSObjectRef m_daysOfTheWeekJSRef;
109     std::vector<int> m_daysOfTheYear;
110     std::vector<int> m_weeksOfTheYear;
111     NumberArrayPtr m_setPositions;
112         JSObjectRef m_setPositionsJSRef;
113     NumberArrayPtr m_exceptions;
114         JSObjectRef m_exceptionsJSRef;
115     std::string m_timeZone;
116
117         JSContextRef m_context;
118 };
119
120 typedef DPL::SharedPtr<EventRecurrenceRule> EventRecurrenceRulePtr;
121
122 }
123 }
124
125 #endif /* _EVENT_RECURRENCE_RULE_H_ */