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 FSclRecurrence.cpp
19 * @brief This is the implementation for Recurrence class.
21 * This file contains definitions of @e Recurrence class.
25 #include <FBaseColIList.h>
26 #include <FSclRecurrence.h>
27 #include <FBaseSysLog.h>
28 #include "FScl_RecurrenceImpl.h"
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
33 namespace Tizen { namespace Social
36 Recurrence::Recurrence(void)
37 : __pRecurrenceImpl(null)
39 __pRecurrenceImpl = new (std::nothrow) _RecurrenceImpl();
40 SysTryReturnVoidResult(NID_SCL, __pRecurrenceImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
43 Recurrence::Recurrence(const Recurrence& rhs)
44 : __pRecurrenceImpl(null)
46 __pRecurrenceImpl = new (std::nothrow) _RecurrenceImpl(*rhs.__pRecurrenceImpl);
47 SysTryReturnVoidResult(NID_SCL, __pRecurrenceImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
50 Recurrence::~Recurrence(void)
52 delete __pRecurrenceImpl;
56 Recurrence::operator =(const Recurrence& rhs)
63 *__pRecurrenceImpl = *rhs.__pRecurrenceImpl;
69 Recurrence::Equals(const Object& rhs) const
71 const Recurrence* pRecurrence = dynamic_cast<const Recurrence*>(&rhs);
72 if (pRecurrence == null)
77 return __pRecurrenceImpl->Equals(*_RecurrenceImpl::GetInstance(*pRecurrence));
81 Recurrence::GetHashCode(void) const
83 return __pRecurrenceImpl->GetHashCode();
87 Recurrence::GetFrequency(void) const
89 return __pRecurrenceImpl->GetFrequency();
93 Recurrence::GetInterval(void) const
95 return __pRecurrenceImpl->GetInterval();
99 Recurrence::GetUntil(void) const
101 return __pRecurrenceImpl->GetUntil();
105 Recurrence::GetCounts(void) const
107 return __pRecurrenceImpl->GetCounts();
111 Recurrence::GetWeekStart(void) const
113 return __pRecurrenceImpl->GetWeekStart();
117 Recurrence::GetDayOfWeek(void) const
119 return __pRecurrenceImpl->GetDayOfWeek();
123 Recurrence::GetDayOfMonth(void) const
125 return __pRecurrenceImpl->GetDayOfMonth();
129 Recurrence::GetWeekOfMonth(void) const
131 return __pRecurrenceImpl->GetWeekOfMonth();
135 Recurrence::GetMonthOfYear(void)const
137 return __pRecurrenceImpl->GetMonthOfYear();
141 Recurrence::SetFrequency(RecurFrequency type)
143 __pRecurrenceImpl->SetFrequency(type);
147 Recurrence::SetInterval(int interval)
149 result r = __pRecurrenceImpl->SetInterval(interval);
150 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
156 Recurrence::SetUntil(const DateTime* pUntil)
158 result r = __pRecurrenceImpl->SetUntil(pUntil);
159 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
165 Recurrence::SetCounts(int count)
167 result r = __pRecurrenceImpl->SetCounts(count);
168 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
174 Recurrence::SetWeekStart(CalDayOfWeek weekStart)
176 result r = __pRecurrenceImpl->SetWeekStart(weekStart);
177 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
183 Recurrence::SetDayOfWeek(int day)
185 result r = __pRecurrenceImpl->SetDayOfWeek(day);
186 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
192 Recurrence::SetDayOfMonth(int day)
194 result r = __pRecurrenceImpl->SetDayOfMonth(day);
195 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
201 Recurrence::SetWeekOfMonth(int week)
203 result r = __pRecurrenceImpl->SetWeekOfMonth(week);
204 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
211 Recurrence::SetMonthOfYear(int month)
213 result r = __pRecurrenceImpl->SetMonthOfYear(month);
214 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
220 Recurrence::AddExceptionDate(const DateTime& exceptionDate)
222 result r = __pRecurrenceImpl->AddExceptionDate(exceptionDate);
223 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
229 Recurrence::GetExceptionDatesN(void) const
231 IList* pList = __pRecurrenceImpl->GetExceptionDatesN();
232 result r = GetLastResult();
233 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));