Fixed update instance
[framework/osp/social.git] / src / FScl_CalEventInstanceImpl.cpp
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  * @file                FScl_CalEventInstanceImpl.cpp
19  * @brief               This is the implementation for _CalEventInstanceImpl class.
20  *
21  * This file contains definitions of @e _CalEventInstanceImpl class.
22  */
23
24 #include <FBaseString.h>
25 #include <FBaseDateTime.h>
26 #include <FSclCalEventInstance.h>
27 #include "FScl_RecordImpl.h"
28 #include "FScl_CalEventInstanceImpl.h"
29
30 using namespace Tizen::Base;
31
32 namespace Tizen { namespace Social
33 {
34
35 _CalEventInstanceImpl::_CalEventInstanceImpl(void)
36         : __originalEventId(INVALID_RECORD_ID)
37         , __calendarId(INVALID_RECORD_ID)
38         , __isAllDayEvent(false)
39         , __busyStatus(BUSY_STATUS_FREE)
40         , __status(EVENT_STATUS_NONE)
41         , __priority(EVENT_PRIORITY_NORMAL)
42         , __sensitivity(SENSITIVITY_PUBLIC)
43         , __isRecurring(false)
44         , __hasReminder(false)
45 {
46 }
47
48 _CalEventInstanceImpl::_CalEventInstanceImpl(const _CalEventInstanceImpl& rhs)
49         : __originalEventId(rhs.__originalEventId)
50         , __calendarId(rhs.__calendarId)
51         , __startDateTime(rhs.__startDateTime)
52         , __endDateTime(rhs.__endDateTime)
53         , __subject(rhs.__subject)
54         , __description(rhs.__description)
55         , __location(rhs.__location)
56         , __isAllDayEvent(rhs.__isAllDayEvent)
57         , __busyStatus(rhs.__busyStatus)
58         , __status(rhs.__status)
59         , __priority(rhs.__priority)
60         , __sensitivity(rhs.__sensitivity)
61         , __isRecurring(rhs.__isRecurring)
62         , __hasReminder(rhs.__hasReminder)
63 {
64 }
65
66 _CalEventInstanceImpl::~_CalEventInstanceImpl(void)
67 {
68 }
69
70 _CalEventInstanceImpl&
71 _CalEventInstanceImpl::operator =(const _CalEventInstanceImpl& rhs)
72 {
73         if (this == &rhs)
74         {
75                 return *this;
76         }
77
78         __originalEventId = rhs.__originalEventId;
79         __calendarId = rhs.__calendarId;
80         __startDateTime = rhs.__startDateTime;
81         __endDateTime = rhs.__endDateTime;
82         __subject = rhs.__subject;
83         __description = rhs.__description;
84         __location = rhs.__location;
85         __isAllDayEvent = rhs.__isAllDayEvent;
86         __busyStatus = rhs.__busyStatus;
87         __status = rhs.__status;
88         __priority = rhs.__priority;
89         __sensitivity = rhs.__sensitivity;
90         __isRecurring = rhs.__isRecurring;
91         __hasReminder = rhs.__hasReminder;
92
93         return *this;
94 }
95
96 bool
97 _CalEventInstanceImpl::Equals(const Object& rhs) const
98 {
99         const _CalEventInstanceImpl* pCalEventInstanceImpl = dynamic_cast<const _CalEventInstanceImpl*>(&rhs);
100
101         if (pCalEventInstanceImpl == null)
102         {
103                 return false;
104         }
105
106         return (__originalEventId == pCalEventInstanceImpl->__originalEventId && __calendarId == pCalEventInstanceImpl->__calendarId
107                         && __startDateTime == pCalEventInstanceImpl->__startDateTime);
108 }
109
110 int
111 _CalEventInstanceImpl::GetHashCode(void) const
112 {
113         int hashCode = 17;
114
115         hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __originalEventId);
116         hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __calendarId);
117         hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __startDateTime.GetHashCode();
118
119         return hashCode;
120 }
121
122 RecordId
123 _CalEventInstanceImpl::GetOriginalEventId(void) const
124 {
125         return __originalEventId;
126 }
127
128 RecordId
129 _CalEventInstanceImpl::GetCalendarId(void) const
130 {
131         return __calendarId;
132 }
133
134 DateTime
135 _CalEventInstanceImpl::GetStartTime(void) const
136 {
137         return __startDateTime;
138 }
139
140 DateTime
141 _CalEventInstanceImpl::GetEndTime(void) const
142 {
143         return __endDateTime;
144 }
145
146 String
147 _CalEventInstanceImpl::GetSubject(void) const
148 {
149         return __subject;
150 }
151
152 String
153 _CalEventInstanceImpl::GetDescription(void) const
154 {
155         return __description;
156 }
157
158 String
159 _CalEventInstanceImpl::GetLocation(void) const
160 {
161         return __location;
162 }
163
164 bool
165 _CalEventInstanceImpl::IsAllDayEvent(void) const
166 {
167         return __isAllDayEvent;
168 }
169
170 BusyStatus
171 _CalEventInstanceImpl::GetBusyStatus(void) const
172 {
173         return __busyStatus;
174 }
175
176 EventStatus
177 _CalEventInstanceImpl::GetStatus(void) const
178 {
179         return __status;
180 }
181
182 EventPriority
183 _CalEventInstanceImpl::GetPriority(void) const
184 {
185         return __priority;
186 }
187
188 RecordSensitivity
189 _CalEventInstanceImpl::GetSensitivity(void) const
190 {
191         return __sensitivity;
192 }
193
194 bool
195 _CalEventInstanceImpl::IsRecurring(void) const
196 {
197         return __isRecurring;
198 }
199
200 bool
201 _CalEventInstanceImpl::HasReminder(void) const
202 {
203         return __hasReminder;
204 }
205
206 void
207 _CalEventInstanceImpl::SetOriginalEventId(RecordId originalEventId)
208 {
209         __originalEventId = originalEventId;
210 }
211
212 void
213 _CalEventInstanceImpl::SetCalendarId(RecordId calendarId)
214 {
215         __calendarId = calendarId;
216 }
217
218 void
219 _CalEventInstanceImpl::SetStartTime(const DateTime& startTime)
220 {
221         __startDateTime = startTime;
222 }
223
224 void
225 _CalEventInstanceImpl::SetEndTime(const DateTime& endTime)
226 {
227         __endDateTime = endTime;
228 }
229
230 void
231 _CalEventInstanceImpl::SetSubject(const String& subject)
232 {
233         __subject = subject;
234 }
235
236 void
237 _CalEventInstanceImpl::SetDescription(const String& description)
238 {
239         __description = description;
240 }
241
242 void
243 _CalEventInstanceImpl::SetLocation(const String& location)
244 {
245         __location = location;
246 }
247
248 void
249 _CalEventInstanceImpl::SetAllDayEvent(bool isAllDayEvent)
250 {
251         __isAllDayEvent = isAllDayEvent;
252 }
253
254 void
255 _CalEventInstanceImpl::SetBusyStatus(BusyStatus busyStatus)
256 {
257         __busyStatus = busyStatus;
258 }
259
260 void
261 _CalEventInstanceImpl::SetStatus(EventStatus status)
262 {
263         __status = status;
264 }
265
266 void
267 _CalEventInstanceImpl::SetPriority(EventPriority priority)
268 {
269         __priority = priority;
270 }
271
272 void
273 _CalEventInstanceImpl::SetSensitivity(RecordSensitivity sensitivity)
274 {
275         __sensitivity = sensitivity;
276 }
277
278 void
279 _CalEventInstanceImpl::SetRecurring(bool isRecurring)
280 {
281         __isRecurring = isRecurring;
282 }
283
284 void
285 _CalEventInstanceImpl::SetHasReminder(bool hasReminder)
286 {
287         __hasReminder = hasReminder;
288 }
289
290 _CalEventInstanceImpl*
291 _CalEventInstanceImpl::GetInstance(CalEventInstance& eventInstance)
292 {
293         return eventInstance.__pCalEventInstanceImpl;
294 }
295
296 const _CalEventInstanceImpl*
297 _CalEventInstanceImpl::GetInstance(const CalEventInstance& eventInstance)
298 {
299         return eventInstance.__pCalEventInstanceImpl;
300 }
301
302 }} //Tizen::Social