2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSclCalEvent.cpp
19 * @brief This is the implementation for CalEvent class.
21 * This file contains definitions of @e CalEvent class.
25 #include <FSclCalEvent.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_CalEventImpl.h"
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Social
35 CalEvent::CalEvent(void)
36 : Record(RECORD_TYPE_EVENT)
37 ,__pCalEventImpl(null)
39 __pCalEventImpl = new (std::nothrow) _CalEventImpl();
40 SysTryReturnVoidResult(NID_SCL, __pCalEventImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
43 CalEvent::CalEvent(const CalEvent& rhs)
45 ,__pCalEventImpl(null)
47 __pCalEventImpl = new (std::nothrow) _CalEventImpl(*rhs.__pCalEventImpl);
48 SysTryReturnVoidResult(NID_SCL, __pCalEventImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
51 CalEvent::~CalEvent(void)
53 delete __pCalEventImpl;
57 CalEvent::operator =(const CalEvent& rhs)
64 Record::operator=(rhs);
66 *__pCalEventImpl = *rhs.__pCalEventImpl;
72 CalEvent::Equals(const Object& rhs) const
74 const CalEvent* pCalEvent = dynamic_cast<const CalEvent*>(&rhs);
76 if (pCalEvent == null)
81 return (Record::GetRecordId() == pCalEvent->GetRecordId());
85 CalEvent::GetHashCode(void) const
89 hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
95 CalEvent::IsInstance(void) const
97 return __pCalEventImpl->IsInstance();
101 CalEvent::IsRecurring(void) const
103 return __pCalEventImpl->IsRecurring();
107 CalEvent::GetOriginalCalEventId(void) const
109 return __pCalEventImpl->GetOriginalCalEventId();
113 CalEvent::IsAllDayEvent(void) const
115 return __pCalEventImpl->IsAllDayEvent();
119 CalEvent::SetAllDayEvent(bool isAllDayEvent)
121 __pCalEventImpl->SetAllDayEvent(isAllDayEvent);
125 CalEvent::GetUIDN(void) const
127 ByteBuffer* pByteBuffer = __pCalEventImpl->GetUIDN();
128 result r = GetLastResult();
129 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
135 CalEvent::SetUID(const ByteBuffer* pUID)
137 result r = __pCalEventImpl->SetUID(pUID);
138 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
144 CalEvent::GetUid(void) const
147 return __pCalEventImpl->GetUid();
151 CalEvent::SetUid(const Tizen::Base::String& uid)
154 __pCalEventImpl->SetUid(uid);
158 CalEvent::GetStatus(void) const
160 return __pCalEventImpl->GetStatus();
164 CalEvent::SetStatus(EventStatus status)
166 __pCalEventImpl->SetStatus(status);
170 CalEvent::GetBusyStatus(void) const
172 return __pCalEventImpl->GetBusyStatus();
176 CalEvent::SetBusyStatus(BusyStatus busyStatus)
178 __pCalEventImpl->SetBusyStatus(busyStatus);
182 CalEvent::GetPriority(void) const
184 return __pCalEventImpl->GetPriority();
188 CalEvent::SetPriority(EventPriority priority)
190 __pCalEventImpl->SetPriority(priority);
194 CalEvent::AddAttendee(const Attendee& attendee)
196 result r = __pCalEventImpl->AddAttendee(attendee);
197 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
203 CalEvent::RemoveAttendee(const Attendee& attendee)
205 result r = __pCalEventImpl->RemoveAttendee(attendee);
206 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
212 CalEvent::GetAllAttendeesN(void) const
214 IList* pList = __pCalEventImpl->GetAllAttendeesN();
215 result r = GetLastResult();
216 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
221 Tizen::Locales::TimeZone
222 CalEvent::GetTimeZone(void) const
224 return __pCalEventImpl->GetTimeZone();
228 CalEvent::SetTimeZone(const Tizen::Locales::TimeZone& timeZone)
230 return __pCalEventImpl->SetTimeZone(timeZone);
234 CalEvent::GetRecurrenceId(void) const
236 RecurrenceId recurrenceId = __pCalEventImpl->GetRecurrenceId();
237 result r = GetLastResult();
238 SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
244 CalEvent::GetSubject(void) const
246 return __pCalEventImpl->GetSubject();
250 CalEvent::GetDescription(void) const
252 return __pCalEventImpl->GetDescription();
257 CalEvent::GetStartTime(void) const
259 return __pCalEventImpl->GetStartTime();
263 CalEvent::GetEndTime(void) const
265 return __pCalEventImpl->GetEndTime();
269 CalEvent::GetLocation(void) const
271 return __pCalEventImpl->GetLocation();
275 CalEvent::GetCategory(void) const
277 return __pCalEventImpl->GetCategory();
281 CalEvent::GetSensitivity(void) const
283 return __pCalEventImpl->GetSensitivity();
288 CalEvent::GetReminder(void) const
290 return __pCalEventImpl->GetReminder();
294 CalEvent::GetRecurrence(void) const
296 return __pCalEventImpl->GetRecurrence();
300 CalEvent::GetLastRevisedTime(void) const
302 return __pCalEventImpl->GetLastRevisedTime();
306 CalEvent::SetSubject(const String& subject)
308 result r = __pCalEventImpl->SetSubject(subject);
309 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
315 CalEvent::SetDescription(const String& description)
317 result r = __pCalEventImpl->SetDescription(description);
318 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
324 CalEvent::SetStartAndEndTime(const DateTime& start, const DateTime& end)
326 result r = __pCalEventImpl->SetStartAndEndTime(start, end);
327 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
333 CalEvent::SetLocation(const String& location)
335 result r = __pCalEventImpl->SetLocation(location);
336 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
342 CalEvent::SetCategory(EventCategory category)
344 __pCalEventImpl->SetCategory(category);
348 CalEvent::SetSensitivity(RecordSensitivity sensitivity)
350 __pCalEventImpl->SetSensitivity(sensitivity);
354 CalEvent::SetCoordinates(double latitude, double longitude)
356 result r = __pCalEventImpl->SetCoordinates(latitude, longitude);
357 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
363 CalEvent::GetCoordinates(double& latitude, double& longitude) const
365 __pCalEventImpl->GetCoordinates(latitude, longitude);
369 CalEvent::SetReminder(const Reminder* pReminder)
371 result r = __pCalEventImpl->SetReminder(pReminder);
372 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
378 CalEvent::SetRecurrence(const Recurrence* pRecurrence)
380 result r = __pCalEventImpl->SetRecurrence(pRecurrence);
381 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
387 CalEvent::AddReminder(const Reminder& reminder)
389 result r = __pCalEventImpl->AddReminder(reminder);
390 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
396 CalEvent::RemoveReminderAt(int index)
398 result r = __pCalEventImpl->RemoveReminderAt(index);
399 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
405 CalEvent::GetAllReminders(void) const
407 return __pCalEventImpl->GetAllReminders();
411 CalEvent::GetCalendarId(void) const
413 return __pCalEventImpl->GetCalendarId();
417 CalEvent::GetBaseEventId(void) const
419 return __pCalEventImpl->GetBaseEventId();