Modify the spec file for secure log
[framework/osp/social.git] / src / FSclCalEvent.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FSclCalEvent.cpp
18  * @brief               This is the implementation for CalEvent class.
19  *
20  * This file contains definitions of @e CalEvent class.
21  */
22
23 #include <new>
24 #include <FSclCalEvent.h>
25 #include <FBaseSysLog.h>
26 #include "FScl_CalEventImpl.h"
27
28 using namespace Tizen::Base::Collection;
29 using namespace Tizen::Base;
30
31 namespace Tizen { namespace Social
32 {
33
34 CalEvent::CalEvent(void)
35         : Record(RECORD_TYPE_EVENT)
36         ,__pCalEventImpl(null)
37 {
38         __pCalEventImpl = new (std::nothrow) _CalEventImpl();
39         SysTryReturnVoidResult(NID_SCL, __pCalEventImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
40 }
41
42 CalEvent::CalEvent(const CalEvent& rhs)
43         : Record(rhs)
44         ,__pCalEventImpl(null)
45 {
46         __pCalEventImpl = new (std::nothrow) _CalEventImpl(*rhs.__pCalEventImpl);
47         SysTryReturnVoidResult(NID_SCL, __pCalEventImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
48 }
49
50 CalEvent::~CalEvent(void)
51 {
52         delete __pCalEventImpl;
53 }
54
55 CalEvent&
56 CalEvent::operator =(const CalEvent& rhs)
57 {
58         if (this == &rhs)
59         {
60                 return *this;
61         }
62
63         Record::operator=(rhs);
64
65         *__pCalEventImpl = *rhs.__pCalEventImpl;
66
67         return *this;
68 }
69
70 bool
71 CalEvent::Equals(const Object& rhs) const
72 {
73         const CalEvent* pCalEvent = dynamic_cast<const CalEvent*>(&rhs);
74
75         if (pCalEvent == null)
76         {
77                 return false;
78         }
79
80         return (Record::GetRecordId() == pCalEvent->GetRecordId());
81 }
82
83 int
84 CalEvent::GetHashCode(void) const
85 {
86         int hashCode = 17;
87
88         hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
89
90         return hashCode;
91 }
92
93 bool
94 CalEvent::IsInstance(void) const
95 {
96         return __pCalEventImpl->IsInstance();
97 }
98
99 bool
100 CalEvent::IsRecurring(void) const
101 {
102         return __pCalEventImpl->IsRecurring();
103 }
104
105 RecordId
106 CalEvent::GetOriginalCalEventId(void)   const
107 {
108         return __pCalEventImpl->GetOriginalCalEventId();
109 }
110
111 bool
112 CalEvent::IsAllDayEvent(void)   const
113 {
114         return __pCalEventImpl->IsAllDayEvent();
115 }
116
117 void
118 CalEvent::SetAllDayEvent(bool isAllDayEvent)
119 {
120         __pCalEventImpl->SetAllDayEvent(isAllDayEvent);
121 }
122
123 ByteBuffer*
124 CalEvent::GetUIDN(void) const
125 {
126         ByteBuffer* pByteBuffer = __pCalEventImpl->GetUIDN();
127         result r = GetLastResult();
128         SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
129
130         return pByteBuffer;
131 }
132
133 result
134 CalEvent::SetUID(const ByteBuffer* pUID)
135 {
136         result r = __pCalEventImpl->SetUID(pUID);
137         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
138
139         return E_SUCCESS;
140 }
141
142 Tizen::Base::String
143 CalEvent::GetUid(void) const
144 {
145         ClearLastResult();
146         return __pCalEventImpl->GetUid();
147 }
148
149 void
150 CalEvent::SetUid(const Tizen::Base::String& uid)
151 {
152         ClearLastResult();
153         __pCalEventImpl->SetUid(uid);
154 }
155
156 EventStatus
157 CalEvent::GetStatus(void) const
158 {
159         return __pCalEventImpl->GetStatus();
160 }
161
162 void
163 CalEvent::SetStatus(EventStatus status)
164 {
165         __pCalEventImpl->SetStatus(status);
166 }
167
168 BusyStatus
169 CalEvent::GetBusyStatus(void) const
170 {
171         return __pCalEventImpl->GetBusyStatus();
172 }
173
174 void
175 CalEvent::SetBusyStatus(BusyStatus busyStatus)
176 {
177         __pCalEventImpl->SetBusyStatus(busyStatus);
178 }
179
180 EventPriority
181 CalEvent::GetPriority(void) const
182 {
183         return __pCalEventImpl->GetPriority();
184 }
185
186 void
187 CalEvent::SetPriority(EventPriority priority)
188 {
189         __pCalEventImpl->SetPriority(priority);
190 }
191
192 result
193 CalEvent::AddAttendee(const Attendee& attendee)
194 {
195         result r = __pCalEventImpl->AddAttendee(attendee);
196         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
197
198         return E_SUCCESS;
199 }
200
201 result
202 CalEvent::RemoveAttendee(const Attendee& attendee)
203 {
204         result r = __pCalEventImpl->RemoveAttendee(attendee);
205         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
206
207         return E_SUCCESS;
208 }
209
210 IList*
211 CalEvent::GetAllAttendeesN(void) const
212 {
213         IList* pList = __pCalEventImpl->GetAllAttendeesN();
214         result r = GetLastResult();
215         SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
216
217         return pList;
218 }
219
220 Tizen::Locales::TimeZone
221 CalEvent::GetTimeZone(void) const
222 {
223         return __pCalEventImpl->GetTimeZone();
224 }
225
226 result
227 CalEvent::SetTimeZone(const Tizen::Locales::TimeZone& timeZone)
228 {
229         return __pCalEventImpl->SetTimeZone(timeZone);
230 }
231
232 RecurrenceId
233 CalEvent::GetRecurrenceId(void) const
234 {
235         RecurrenceId recurrenceId = __pCalEventImpl->GetRecurrenceId();
236         result r = GetLastResult();
237         SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
238
239         return recurrenceId;
240 }
241
242 String
243 CalEvent::GetSubject(void) const
244 {
245         return __pCalEventImpl->GetSubject();
246 }
247
248 String
249 CalEvent::GetDescription(void) const
250 {
251         return __pCalEventImpl->GetDescription();
252 }
253
254
255 DateTime
256 CalEvent::GetStartTime(void) const
257 {
258         return __pCalEventImpl->GetStartTime();
259 }
260
261 DateTime
262 CalEvent::GetEndTime(void) const
263 {
264         return __pCalEventImpl->GetEndTime();
265 }
266
267 String
268 CalEvent::GetLocation(void) const
269 {
270         return __pCalEventImpl->GetLocation();
271 }
272
273 EventCategory
274 CalEvent::GetCategory(void) const
275 {
276         return __pCalEventImpl->GetCategory();
277 }
278
279 RecordSensitivity
280 CalEvent::GetSensitivity(void) const
281 {
282         return __pCalEventImpl->GetSensitivity();
283 }
284
285
286 const Reminder*
287 CalEvent::GetReminder(void) const
288 {
289         return __pCalEventImpl->GetReminder();
290 }
291
292 const Recurrence*
293 CalEvent::GetRecurrence(void) const
294 {
295         return __pCalEventImpl->GetRecurrence();
296 }
297
298 DateTime
299 CalEvent::GetLastRevisedTime(void) const
300 {
301         return __pCalEventImpl->GetLastRevisedTime();
302 }
303
304 result
305 CalEvent::SetSubject(const String& subject)
306 {
307         result r = __pCalEventImpl->SetSubject(subject);
308         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
309
310         return E_SUCCESS;
311 }
312
313 result
314 CalEvent::SetDescription(const String& description)
315 {
316         result r = __pCalEventImpl->SetDescription(description);
317         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
318
319         return E_SUCCESS;
320 }
321
322 result
323 CalEvent::SetStartAndEndTime(const DateTime& start, const DateTime& end)
324 {
325         result r = __pCalEventImpl->SetStartAndEndTime(start, end);
326         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
327
328         return E_SUCCESS;
329 }
330
331 result
332 CalEvent::SetLocation(const String& location)
333 {
334         result r = __pCalEventImpl->SetLocation(location);
335         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
336
337         return E_SUCCESS;
338 }
339
340 void
341 CalEvent::SetCategory(EventCategory category)
342 {
343         __pCalEventImpl->SetCategory(category);
344 }
345
346 void
347 CalEvent::SetSensitivity(RecordSensitivity sensitivity)
348 {
349         __pCalEventImpl->SetSensitivity(sensitivity);
350 }
351
352 result
353 CalEvent::SetCoordinates(double latitude, double longitude)
354 {
355         result r = __pCalEventImpl->SetCoordinates(latitude, longitude);
356         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
357
358         return E_SUCCESS;
359 }
360
361 void
362 CalEvent::GetCoordinates(double& latitude, double& longitude) const
363 {
364         __pCalEventImpl->GetCoordinates(latitude, longitude);
365 }
366
367 result
368 CalEvent::SetReminder(const Reminder* pReminder)
369 {
370         result r = __pCalEventImpl->SetReminder(pReminder);
371         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
372
373         return E_SUCCESS;
374 }
375
376 result
377 CalEvent::SetRecurrence(const Recurrence* pRecurrence)
378 {
379         result r = __pCalEventImpl->SetRecurrence(pRecurrence);
380         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
381
382         return E_SUCCESS;
383 }
384
385 result
386 CalEvent::AddReminder(const Reminder& reminder)
387 {
388         result r = __pCalEventImpl->AddReminder(reminder);
389         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
390
391         return E_SUCCESS;
392 }
393
394 result
395 CalEvent::RemoveReminderAt(int index)
396 {
397         result r = __pCalEventImpl->RemoveReminderAt(index);
398         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
399
400         return E_SUCCESS;
401 }
402
403 const IList&
404 CalEvent::GetAllReminders(void) const
405 {
406         return __pCalEventImpl->GetAllReminders();
407 }
408
409 RecordId
410 CalEvent::GetCalendarId(void) const
411 {
412         return __pCalEventImpl->GetCalendarId();
413 }
414
415 RecordId
416 CalEvent::GetBaseEventId(void) const
417 {
418         return __pCalEventImpl->GetBaseEventId();
419 }
420
421 }}      // Tizen::Social