Modify the spec file for secure log
[framework/osp/social.git] / src / FSclCalTodo.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                FSclCalTodo.cpp
18  * @brief               This is the implementation for CalTodo class.
19  *
20  * This file contains definitions of @e CalTodo class.
21  */
22
23 #include <new>
24 #include <FSysSystemTime.h>
25 #include <FSclCalTodo.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_CalTodoImpl.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31
32 namespace Tizen { namespace Social
33 {
34
35 CalTodo::CalTodo(void)
36         : Record(RECORD_TYPE_TODO)
37 {
38         __pCalTodoImpl = new (std::nothrow) _CalTodoImpl();
39         SysTryReturnVoidResult(NID_SCL, __pCalTodoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
40 }
41
42 CalTodo::CalTodo(const CalTodo& rhs)
43         : Record(rhs)
44         , __pCalTodoImpl(null)
45 {
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.");
48 }
49
50 CalTodo::~CalTodo(void)
51 {
52         delete __pCalTodoImpl;
53 }
54
55 CalTodo&
56 CalTodo::operator =(const CalTodo& rhs)
57 {
58         if (this == &rhs)
59         {
60                 return *this;
61         }
62
63         Record::operator=(rhs);
64
65         *__pCalTodoImpl = *rhs.__pCalTodoImpl;
66
67         return *this;
68 }
69
70 bool
71 CalTodo::Equals(const Object& rhs) const
72 {
73         const CalTodo* pCalTodo = dynamic_cast<const CalTodo*>(&rhs);
74
75         if (pCalTodo == null)
76         {
77                 return false;
78         }
79
80         return (Record::GetRecordId() == pCalTodo->GetRecordId());
81 }
82
83 int
84 CalTodo::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 String
94 CalTodo::GetSubject(void) const
95 {
96         return __pCalTodoImpl->GetSubject();
97 }
98
99 String
100 CalTodo::GetDescription(void) const
101 {
102         return __pCalTodoImpl->GetDescription();
103 }
104
105 DateTime
106 CalTodo::GetStartDate(void) const
107 {
108         const DateTime& startDate = __pCalTodoImpl->GetStartDate();
109         result r = GetLastResult();
110         SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
111
112         return startDate;
113 }
114
115 DateTime
116 CalTodo::GetDueDate(void) const
117 {
118         const DateTime& dueDate = __pCalTodoImpl->GetDueDate();
119         result r = GetLastResult();
120         SysTryReturn(NID_SCL, r == E_SUCCESS, DateTime(), r, "[%s] Propagating.", GetErrorMessage(r));
121
122         return dueDate;
123 }
124
125 TodoPriority
126 CalTodo::GetPriority(void) const
127 {
128         return __pCalTodoImpl->GetPriority();
129 }
130
131 TodoStatus
132 CalTodo::GetStatus(void) const
133 {
134         return __pCalTodoImpl->GetStatus();
135 }
136
137 RecordSensitivity
138 CalTodo::GetSensitivity(void) const
139 {
140         return __pCalTodoImpl->GetSensitivity();
141 }
142
143 DateTime
144 CalTodo::GetLastRevisedTime(void) const
145 {
146         return __pCalTodoImpl->GetLastRevisedTime();
147 }
148
149 result
150 CalTodo::SetSubject(const String& subject)
151 {
152         result r = __pCalTodoImpl->SetSubject(subject);
153         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
154
155         return E_SUCCESS;
156 }
157
158 result
159 CalTodo::SetDescription(const String& description)
160 {
161         result r = __pCalTodoImpl->SetDescription(description);
162         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
163
164         return E_SUCCESS;
165 }
166
167 result
168 CalTodo::SetStartAndDueDate(const DateTime& start, const DateTime& end)
169 {
170         result r = __pCalTodoImpl->SetStartAndDueDate(start, end);
171         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
172
173         return E_SUCCESS;
174 }
175
176 result
177 CalTodo::SetStartDate(const DateTime& startDate)
178 {
179         result r = __pCalTodoImpl->SetStartDate(startDate);
180         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
181
182         return E_SUCCESS;
183 }
184
185 result
186 CalTodo::SetDueDate(const DateTime& dueDate)
187 {
188         result r = __pCalTodoImpl->SetDueDate(dueDate);
189         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
190
191         return E_SUCCESS;
192 }
193
194 void
195 CalTodo::SetPriority(TodoPriority priority)
196 {
197         __pCalTodoImpl->SetPriority(priority);
198 }
199
200 void
201 CalTodo::SetStatus(TodoStatus status)
202 {
203         __pCalTodoImpl->SetStatus(status);
204 }
205
206 void
207 CalTodo::SetSensitivity(RecordSensitivity sensitivity)
208 {
209         __pCalTodoImpl->SetSensitivity(sensitivity);
210 }
211
212 void
213 CalTodo::SetLocation(const String& location)
214 {
215         __pCalTodoImpl->SetLocation(location);
216 }
217
218 String
219 CalTodo::GetLocation(void) const
220 {
221         return __pCalTodoImpl->GetLocation();
222 }
223
224 result
225 CalTodo::SetCoordinates(double latitude, double longitude)
226 {
227         result r = __pCalTodoImpl->SetCoordinates(latitude, longitude);
228         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
229
230         return E_SUCCESS;
231 }
232
233 void
234 CalTodo::GetCoordinates(double& latitude, double& longitude) const
235 {
236         __pCalTodoImpl->GetCoordinates(latitude, longitude);
237 }
238
239 result
240 CalTodo::AddReminder(const Reminder& reminder)
241 {
242         result r = __pCalTodoImpl->AddReminder(reminder);
243         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
244
245         return E_SUCCESS;
246 }
247
248 result
249 CalTodo::RemoveReminderAt(int index)
250 {
251         result r = __pCalTodoImpl->RemoveReminderAt(index);
252         SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
253
254         return E_SUCCESS;
255 }
256
257 const IList&
258 CalTodo::GetAllReminders(void) const
259 {
260         return __pCalTodoImpl->GetAllReminders();
261 }
262
263 RecordId
264 CalTodo::GetCalendarId(void) const
265 {
266         return __pCalTodoImpl->GetCalendarId();
267 }
268
269 }}      // Tizen::Social