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 FSclCalTodo.cpp
18 * @brief This is the implementation for CalTodo class.
20 * This file contains definitions of @e CalTodo class.
24 #include <FSysSystemTime.h>
25 #include <FSclCalTodo.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_CalTodoImpl.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
32 namespace Tizen { namespace Social
35 CalTodo::CalTodo(void)
36 : Record(RECORD_TYPE_TODO)
38 __pCalTodoImpl = new (std::nothrow) _CalTodoImpl();
39 SysTryReturnVoidResult(NID_SCL, __pCalTodoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
42 CalTodo::CalTodo(const CalTodo& rhs)
44 , __pCalTodoImpl(null)
46 __pCalTodoImpl = new (std::nothrow) _CalTodoImpl(*rhs.__pCalTodoImpl);
47 SysTryReturnVoidResult(NID_SCL, __pCalTodoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
50 CalTodo::~CalTodo(void)
52 delete __pCalTodoImpl;
56 CalTodo::operator =(const CalTodo& rhs)
63 Record::operator=(rhs);
65 *__pCalTodoImpl = *rhs.__pCalTodoImpl;
71 CalTodo::Equals(const Object& rhs) const
73 const CalTodo* pCalTodo = dynamic_cast<const CalTodo*>(&rhs);
80 return (Record::GetRecordId() == pCalTodo->GetRecordId());
84 CalTodo::GetHashCode(void) const
88 hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
94 CalTodo::GetSubject(void) const
96 return __pCalTodoImpl->GetSubject();
100 CalTodo::GetDescription(void) const
102 return __pCalTodoImpl->GetDescription();
106 CalTodo::GetStartDate(void) const
108 const DateTime& startDate = __pCalTodoImpl->GetStartDate();
109 result r = GetLastResult();
110 SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
116 CalTodo::GetDueDate(void) const
118 const DateTime& dueDate = __pCalTodoImpl->GetDueDate();
119 result r = GetLastResult();
120 SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
126 CalTodo::GetPriority(void) const
128 return __pCalTodoImpl->GetPriority();
132 CalTodo::GetStatus(void) const
134 return __pCalTodoImpl->GetStatus();
138 CalTodo::GetSensitivity(void) const
140 return __pCalTodoImpl->GetSensitivity();
144 CalTodo::GetLastRevisedTime(void) const
146 return __pCalTodoImpl->GetLastRevisedTime();
150 CalTodo::SetSubject(const String& subject)
152 result r = __pCalTodoImpl->SetSubject(subject);
153 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
159 CalTodo::SetDescription(const String& description)
161 result r = __pCalTodoImpl->SetDescription(description);
162 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
168 CalTodo::SetStartAndDueDate(const DateTime& start, const DateTime& end)
170 result r = __pCalTodoImpl->SetStartAndDueDate(start, end);
171 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
177 CalTodo::SetStartDate(const DateTime& startDate)
179 result r = __pCalTodoImpl->SetStartDate(startDate);
180 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
186 CalTodo::SetDueDate(const DateTime& dueDate)
188 result r = __pCalTodoImpl->SetDueDate(dueDate);
189 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
195 CalTodo::SetPriority(TodoPriority priority)
197 __pCalTodoImpl->SetPriority(priority);
201 CalTodo::SetStatus(TodoStatus status)
203 __pCalTodoImpl->SetStatus(status);
207 CalTodo::SetSensitivity(RecordSensitivity sensitivity)
209 __pCalTodoImpl->SetSensitivity(sensitivity);
213 CalTodo::SetLocation(const String& location)
215 __pCalTodoImpl->SetLocation(location);
219 CalTodo::GetLocation(void) const
221 return __pCalTodoImpl->GetLocation();
225 CalTodo::SetCoordinates(double latitude, double longitude)
227 result r = __pCalTodoImpl->SetCoordinates(latitude, longitude);
228 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
234 CalTodo::GetCoordinates(double& latitude, double& longitude) const
236 __pCalTodoImpl->GetCoordinates(latitude, longitude);
240 CalTodo::AddReminder(const Reminder& reminder)
242 result r = __pCalTodoImpl->AddReminder(reminder);
243 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
249 CalTodo::RemoveReminderAt(int index)
251 result r = __pCalTodoImpl->RemoveReminderAt(index);
252 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
258 CalTodo::GetAllReminders(void) const
260 return __pCalTodoImpl->GetAllReminders();
264 CalTodo::GetCalendarId(void) const
266 return __pCalTodoImpl->GetCalendarId();