Update change log and spec for wrt-plugins-tizen_0.4.13
[framework/web/wrt-plugins-tizen.git] / src / Calendar / EventRecurrenceRule.cpp
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 #include "EventRecurrenceRule.h"
20 #include <Commons/Exception.h>
21 #include <dpl/log/log.h>
22
23 namespace DeviceAPI {
24 namespace Calendar {
25
26 EventRecurrenceRule::EventRecurrenceRule()
27 {
28     m_frequency = NO_RECURRENCE;
29     m_interval = DEFAULT_INTERVAL;
30     m_endDate = UNDEFINED_TIME;
31     m_occurrenceCount = -1;
32     StringArrayPtr stringArrayPtr(new StringArray());
33     m_daysOfTheWeek = stringArrayPtr;
34     m_daysOfTheWeekJSRef = NULL;
35     NumberArrayPtr numberArraySetPositionsPtr(new NumberArray());
36     m_setPositions = numberArraySetPositionsPtr;
37         m_setPositionsJSRef = NULL;
38     NumberArrayPtr numberArrayExceptionsPtr(new NumberArray());
39     m_exceptions = numberArrayExceptionsPtr;
40         m_exceptionsJSRef = NULL;
41     m_timeZone = DEFAULT_TIMEZONE;
42     m_context = NULL;
43 }
44
45 EventRecurrenceRule::~EventRecurrenceRule()
46 {
47         if(m_daysOfTheWeekJSRef) {
48                 LogDebug("Unprotect JS daysOfTheWeek.");
49                 JSValueUnprotect(m_context, m_daysOfTheWeekJSRef);
50         }
51         if(m_daysOfTheWeekJSRef) {
52                 LogDebug("Unprotect JS setPositions.");
53                 JSValueUnprotect(m_context, m_setPositionsJSRef);
54         }
55         if(m_exceptionsJSRef) {
56                 LogDebug("Unprotect JS exceptions.");
57                 JSValueUnprotect(m_context, m_exceptionsJSRef);
58         }
59 }
60
61 EventRecurrenceRule::EventRecurrence EventRecurrenceRule::getFrequency() const
62 {
63     return m_frequency;
64 }
65
66 void EventRecurrenceRule::setFrequency(const EventRecurrenceRule::EventRecurrence &value)
67 {
68     m_frequency = value;
69 }
70
71 int EventRecurrenceRule::getInterval() const
72 {
73     return m_interval;
74 }
75
76 void EventRecurrenceRule::setInterval(const int &value)
77 {
78     m_interval = value;
79 }
80
81 long long int EventRecurrenceRule::getEndDate() const
82 {
83     return m_endDate;
84 }
85
86 void EventRecurrenceRule::setEndDate(long long int value)
87 {
88     m_endDate = value;
89 }
90
91 long EventRecurrenceRule::getOccurrenceCount() const
92 {
93     return m_occurrenceCount;
94 }
95 void EventRecurrenceRule::setOccurrenceCount(long value)
96 {
97     m_occurrenceCount = value;
98 }
99
100 std::vector<int> EventRecurrenceRule::getDaysOfTheMonth() const
101 {
102     return m_daysOfTheMonth;
103 }
104
105 void EventRecurrenceRule::setDaysOfTheMonth(std::vector<int> value)
106 {
107     m_daysOfTheMonth = value;
108 }
109
110 StringArrayPtr EventRecurrenceRule::getDaysOfTheWeek() const
111 {
112     return m_daysOfTheWeek;
113 }
114
115 void EventRecurrenceRule::setDaysOfTheWeek(StringArrayPtr value)
116 {
117     m_daysOfTheWeek = value;
118 }
119
120 JSObjectRef EventRecurrenceRule::getDaysOfTheWeekJSRef() const
121 {
122     return m_daysOfTheWeekJSRef;
123 }
124 void EventRecurrenceRule::setDaysOfTheWeekJSRef(const JSObjectRef value)
125 {
126     m_daysOfTheWeekJSRef = value;
127 }
128
129 std::vector<int> EventRecurrenceRule::getDaysOfTheYear() const
130 {
131     return m_daysOfTheYear;
132 }
133
134 void EventRecurrenceRule::setDaysOfTheYear(std::vector<int> value)
135 {
136     m_daysOfTheYear = value;
137 }
138
139 std::vector<int> EventRecurrenceRule::getWeeksOfTheYear() const
140 {
141     return m_weeksOfTheYear;
142 }
143
144 void EventRecurrenceRule::setWeeksOfTheYear(std::vector<int> value)
145 {
146     m_weeksOfTheYear = value;
147 }
148
149 NumberArrayPtr EventRecurrenceRule::getSetPositions() const
150 {
151     return m_setPositions;
152 }
153
154 void EventRecurrenceRule::setSetPositions(NumberArrayPtr value)
155 {
156     m_setPositions = value;
157 }
158
159 JSObjectRef EventRecurrenceRule::getSetPositionsJSRef() const
160 {
161     return m_setPositionsJSRef;
162 }
163
164 void EventRecurrenceRule::setSetPositionsJSRef(const JSObjectRef value)
165 {
166     m_setPositionsJSRef = value;
167 }
168
169 NumberArrayPtr EventRecurrenceRule::getExceptions() const
170 {
171     return m_exceptions;
172 }
173
174 void EventRecurrenceRule::setExceptions(NumberArrayPtr value)
175 {
176     m_exceptions = value;
177 }
178
179 JSObjectRef EventRecurrenceRule::getExceptionsJSRef() const
180 {
181     return m_exceptionsJSRef;
182 }
183
184 void EventRecurrenceRule::setExceptionsJSRef(const JSObjectRef value)
185 {
186     m_exceptionsJSRef = value;
187 }
188
189 std::string EventRecurrenceRule::getTimeZone() const
190 {
191     return m_timeZone;
192 }
193
194 void EventRecurrenceRule::setTimeZone(std::string value)
195 {
196     m_timeZone = value;
197 }
198
199 JSContextRef EventRecurrenceRule::getContext() const
200 {
201         return m_context;
202 }
203
204 void EventRecurrenceRule::setContext(const JSContextRef contextRef)
205 {
206         m_context = contextRef;
207 }
208
209 }
210 }