2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FSclCalEvent.cpp
18 * @brief This is the implementation for CalEvent class.
20 * This file contains definitions of @e CalEvent class.
24 #include <FSclCalEvent.h>
25 #include <FBaseSysLog.h>
26 #include "FScl_CalEventImpl.h"
28 using namespace Tizen::Base::Collection;
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Social
34 CalEvent::CalEvent(void)
35 : Record(RECORD_TYPE_EVENT)
36 ,__pCalEventImpl(null)
38 __pCalEventImpl = new (std::nothrow) _CalEventImpl();
39 SysTryReturnVoidResult(NID_SCL, __pCalEventImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
42 CalEvent::CalEvent(const CalEvent& rhs)
44 ,__pCalEventImpl(null)
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.");
50 CalEvent::~CalEvent(void)
52 delete __pCalEventImpl;
56 CalEvent::operator =(const CalEvent& rhs)
63 Record::operator=(rhs);
65 *__pCalEventImpl = *rhs.__pCalEventImpl;
71 CalEvent::Equals(const Object& rhs) const
73 const CalEvent* pCalEvent = dynamic_cast<const CalEvent*>(&rhs);
75 if (pCalEvent == null)
80 return (Record::GetRecordId() == pCalEvent->GetRecordId());
84 CalEvent::GetHashCode(void) const
88 hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
94 CalEvent::IsInstance(void) const
96 return __pCalEventImpl->IsInstance();
100 CalEvent::IsRecurring(void) const
102 return __pCalEventImpl->IsRecurring();
106 CalEvent::GetOriginalCalEventId(void) const
108 return __pCalEventImpl->GetOriginalCalEventId();
112 CalEvent::IsAllDayEvent(void) const
114 return __pCalEventImpl->IsAllDayEvent();
118 CalEvent::SetAllDayEvent(bool isAllDayEvent)
120 __pCalEventImpl->SetAllDayEvent(isAllDayEvent);
124 CalEvent::GetUIDN(void) const
126 ByteBuffer* pByteBuffer = __pCalEventImpl->GetUIDN();
127 result r = GetLastResult();
128 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
134 CalEvent::SetUID(const ByteBuffer* pUID)
136 result r = __pCalEventImpl->SetUID(pUID);
137 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
143 CalEvent::GetUid(void) const
146 return __pCalEventImpl->GetUid();
150 CalEvent::SetUid(const Tizen::Base::String& uid)
153 __pCalEventImpl->SetUid(uid);
157 CalEvent::GetStatus(void) const
159 return __pCalEventImpl->GetStatus();
163 CalEvent::SetStatus(EventStatus status)
165 __pCalEventImpl->SetStatus(status);
169 CalEvent::GetBusyStatus(void) const
171 return __pCalEventImpl->GetBusyStatus();
175 CalEvent::SetBusyStatus(BusyStatus busyStatus)
177 __pCalEventImpl->SetBusyStatus(busyStatus);
181 CalEvent::GetPriority(void) const
183 return __pCalEventImpl->GetPriority();
187 CalEvent::SetPriority(EventPriority priority)
189 __pCalEventImpl->SetPriority(priority);
193 CalEvent::AddAttendee(const Attendee& attendee)
195 result r = __pCalEventImpl->AddAttendee(attendee);
196 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
202 CalEvent::RemoveAttendee(const Attendee& attendee)
204 result r = __pCalEventImpl->RemoveAttendee(attendee);
205 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
211 CalEvent::GetAllAttendeesN(void) const
213 IList* pList = __pCalEventImpl->GetAllAttendeesN();
214 result r = GetLastResult();
215 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
220 Tizen::Locales::TimeZone
221 CalEvent::GetTimeZone(void) const
223 return __pCalEventImpl->GetTimeZone();
227 CalEvent::SetTimeZone(const Tizen::Locales::TimeZone& timeZone)
229 return __pCalEventImpl->SetTimeZone(timeZone);
233 CalEvent::GetRecurrenceId(void) const
235 RecurrenceId recurrenceId = __pCalEventImpl->GetRecurrenceId();
236 result r = GetLastResult();
237 SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
243 CalEvent::GetSubject(void) const
245 return __pCalEventImpl->GetSubject();
249 CalEvent::GetDescription(void) const
251 return __pCalEventImpl->GetDescription();
256 CalEvent::GetStartTime(void) const
258 return __pCalEventImpl->GetStartTime();
262 CalEvent::GetEndTime(void) const
264 return __pCalEventImpl->GetEndTime();
268 CalEvent::GetLocation(void) const
270 return __pCalEventImpl->GetLocation();
274 CalEvent::GetCategory(void) const
276 return __pCalEventImpl->GetCategory();
280 CalEvent::GetSensitivity(void) const
282 return __pCalEventImpl->GetSensitivity();
287 CalEvent::GetReminder(void) const
289 return __pCalEventImpl->GetReminder();
293 CalEvent::GetRecurrence(void) const
295 return __pCalEventImpl->GetRecurrence();
299 CalEvent::GetLastRevisedTime(void) const
301 return __pCalEventImpl->GetLastRevisedTime();
305 CalEvent::SetSubject(const String& subject)
307 result r = __pCalEventImpl->SetSubject(subject);
308 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
314 CalEvent::SetDescription(const String& description)
316 result r = __pCalEventImpl->SetDescription(description);
317 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
323 CalEvent::SetStartAndEndTime(const DateTime& start, const DateTime& end)
325 result r = __pCalEventImpl->SetStartAndEndTime(start, end);
326 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
332 CalEvent::SetLocation(const String& location)
334 result r = __pCalEventImpl->SetLocation(location);
335 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
341 CalEvent::SetCategory(EventCategory category)
343 __pCalEventImpl->SetCategory(category);
347 CalEvent::SetSensitivity(RecordSensitivity sensitivity)
349 __pCalEventImpl->SetSensitivity(sensitivity);
353 CalEvent::SetCoordinates(double latitude, double longitude)
355 result r = __pCalEventImpl->SetCoordinates(latitude, longitude);
356 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
362 CalEvent::GetCoordinates(double& latitude, double& longitude) const
364 __pCalEventImpl->GetCoordinates(latitude, longitude);
368 CalEvent::SetReminder(const Reminder* pReminder)
370 result r = __pCalEventImpl->SetReminder(pReminder);
371 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
377 CalEvent::SetRecurrence(const Recurrence* pRecurrence)
379 result r = __pCalEventImpl->SetRecurrence(pRecurrence);
380 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
386 CalEvent::AddReminder(const Reminder& reminder)
388 result r = __pCalEventImpl->AddReminder(reminder);
389 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
395 CalEvent::RemoveReminderAt(int index)
397 result r = __pCalEventImpl->RemoveReminderAt(index);
398 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
404 CalEvent::GetAllReminders(void) const
406 return __pCalEventImpl->GetAllReminders();
410 CalEvent::GetCalendarId(void) const
412 return __pCalEventImpl->GetCalendarId();
416 CalEvent::GetBaseEventId(void) const
418 return __pCalEventImpl->GetBaseEventId();