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 FSclCalTodo.cpp
19 * @brief This is the implementation for CalTodo class.
21 * This file contains definitions of @e CalTodo class.
25 #include <FSysSystemTime.h>
26 #include <FSclCalTodo.h>
27 #include <FBaseSysLog.h>
28 #include "FScl_CalTodoImpl.h"
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
33 namespace Tizen { namespace Social
36 CalTodo::CalTodo(void)
37 : Record(RECORD_TYPE_TODO)
39 __pCalTodoImpl = new (std::nothrow) _CalTodoImpl();
40 SysTryReturnVoidResult(NID_SCL, __pCalTodoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
43 CalTodo::CalTodo(const CalTodo& rhs)
45 , __pCalTodoImpl(null)
47 __pCalTodoImpl = new (std::nothrow) _CalTodoImpl(*rhs.__pCalTodoImpl);
48 SysTryReturnVoidResult(NID_SCL, __pCalTodoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
51 CalTodo::~CalTodo(void)
53 delete __pCalTodoImpl;
57 CalTodo::operator =(const CalTodo& rhs)
64 Record::operator=(rhs);
66 *__pCalTodoImpl = *rhs.__pCalTodoImpl;
72 CalTodo::Equals(const Object& rhs) const
74 const CalTodo* pCalTodo = dynamic_cast<const CalTodo*>(&rhs);
81 return (Record::GetRecordId() == pCalTodo->GetRecordId());
85 CalTodo::GetHashCode(void) const
89 hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
95 CalTodo::GetSubject(void) const
97 return __pCalTodoImpl->GetSubject();
101 CalTodo::GetDescription(void) const
103 return __pCalTodoImpl->GetDescription();
107 CalTodo::GetStartDate(void) const
109 const DateTime& startDate = __pCalTodoImpl->GetStartDate();
110 result r = GetLastResult();
111 SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
117 CalTodo::GetDueDate(void) const
119 const DateTime& dueDate = __pCalTodoImpl->GetDueDate();
120 result r = GetLastResult();
121 SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
127 CalTodo::GetPriority(void) const
129 return __pCalTodoImpl->GetPriority();
133 CalTodo::GetStatus(void) const
135 return __pCalTodoImpl->GetStatus();
139 CalTodo::GetSensitivity(void) const
141 return __pCalTodoImpl->GetSensitivity();
145 CalTodo::GetLastRevisedTime(void) const
147 return __pCalTodoImpl->GetLastRevisedTime();
151 CalTodo::SetSubject(const String& subject)
153 result r = __pCalTodoImpl->SetSubject(subject);
154 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
160 CalTodo::SetDescription(const String& description)
162 result r = __pCalTodoImpl->SetDescription(description);
163 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
169 CalTodo::SetStartAndDueDate(const DateTime& start, const DateTime& end)
171 result r = __pCalTodoImpl->SetStartAndDueDate(start, end);
172 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
178 CalTodo::SetStartDate(const DateTime& startDate)
180 result r = __pCalTodoImpl->SetStartDate(startDate);
181 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
187 CalTodo::SetDueDate(const DateTime& dueDate)
189 result r = __pCalTodoImpl->SetDueDate(dueDate);
190 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
196 CalTodo::SetPriority(TodoPriority priority)
198 __pCalTodoImpl->SetPriority(priority);
202 CalTodo::SetStatus(TodoStatus status)
204 __pCalTodoImpl->SetStatus(status);
208 CalTodo::SetSensitivity(RecordSensitivity sensitivity)
210 __pCalTodoImpl->SetSensitivity(sensitivity);
214 CalTodo::SetLocation(const String& location)
216 __pCalTodoImpl->SetLocation(location);
220 CalTodo::GetLocation(void) const
222 return __pCalTodoImpl->GetLocation();
226 CalTodo::SetCoordinates(double latitude, double longitude)
228 result r = __pCalTodoImpl->SetCoordinates(latitude, longitude);
229 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
235 CalTodo::GetCoordinates(double& latitude, double& longitude) const
237 __pCalTodoImpl->GetCoordinates(latitude, longitude);
241 CalTodo::AddReminder(const Reminder& reminder)
243 result r = __pCalTodoImpl->AddReminder(reminder);
244 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
250 CalTodo::RemoveReminderAt(int index)
252 result r = __pCalTodoImpl->RemoveReminderAt(index);
253 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
259 CalTodo::GetAllReminders(void) const
261 return __pCalTodoImpl->GetAllReminders();
265 CalTodo::GetCalendarId(void) const
267 return __pCalTodoImpl->GetCalendarId();