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 FSclRecurrence.cpp
18 * @brief This is the implementation for Recurrence class.
20 * This file contains definitions of @e Recurrence class.
24 #include <FBaseColIList.h>
25 #include <FSclRecurrence.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_RecurrenceImpl.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
32 namespace Tizen { namespace Social
35 Recurrence::Recurrence(void)
36 : __pRecurrenceImpl(null)
38 __pRecurrenceImpl = new (std::nothrow) _RecurrenceImpl();
39 SysTryReturnVoidResult(NID_SCL, __pRecurrenceImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
42 Recurrence::Recurrence(const Recurrence& rhs)
43 : __pRecurrenceImpl(null)
45 __pRecurrenceImpl = new (std::nothrow) _RecurrenceImpl(*rhs.__pRecurrenceImpl);
46 SysTryReturnVoidResult(NID_SCL, __pRecurrenceImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
49 Recurrence::~Recurrence(void)
51 delete __pRecurrenceImpl;
55 Recurrence::operator =(const Recurrence& rhs)
62 *__pRecurrenceImpl = *rhs.__pRecurrenceImpl;
68 Recurrence::Equals(const Object& rhs) const
70 const Recurrence* pRecurrence = dynamic_cast<const Recurrence*>(&rhs);
71 if (pRecurrence == null)
76 return __pRecurrenceImpl->Equals(*_RecurrenceImpl::GetInstance(*pRecurrence));
80 Recurrence::GetHashCode(void) const
82 return __pRecurrenceImpl->GetHashCode();
86 Recurrence::GetFrequency(void) const
88 return __pRecurrenceImpl->GetFrequency();
92 Recurrence::GetInterval(void) const
94 return __pRecurrenceImpl->GetInterval();
98 Recurrence::GetUntil(void) const
100 return __pRecurrenceImpl->GetUntil();
104 Recurrence::GetCounts(void) const
106 return __pRecurrenceImpl->GetCounts();
110 Recurrence::GetWeekStart(void) const
112 return __pRecurrenceImpl->GetWeekStart();
116 Recurrence::GetDayOfWeek(void) const
118 return __pRecurrenceImpl->GetDayOfWeek();
122 Recurrence::GetDayOfMonth(void) const
124 return __pRecurrenceImpl->GetDayOfMonth();
128 Recurrence::GetWeekOfMonth(void) const
130 return __pRecurrenceImpl->GetWeekOfMonth();
134 Recurrence::GetMonthOfYear(void)const
136 return __pRecurrenceImpl->GetMonthOfYear();
140 Recurrence::SetFrequency(RecurFrequency type)
142 __pRecurrenceImpl->SetFrequency(type);
146 Recurrence::SetInterval(int interval)
148 result r = __pRecurrenceImpl->SetInterval(interval);
149 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
155 Recurrence::SetUntil(const DateTime* pUntil)
157 result r = __pRecurrenceImpl->SetUntil(pUntil);
158 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
164 Recurrence::SetCounts(int count)
166 result r = __pRecurrenceImpl->SetCounts(count);
167 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
173 Recurrence::SetWeekStart(CalDayOfWeek weekStart)
175 result r = __pRecurrenceImpl->SetWeekStart(weekStart);
176 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
182 Recurrence::SetDayOfWeek(int day)
184 result r = __pRecurrenceImpl->SetDayOfWeek(day);
185 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
191 Recurrence::SetDayOfMonth(int day)
193 result r = __pRecurrenceImpl->SetDayOfMonth(day);
194 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
200 Recurrence::SetWeekOfMonth(int week)
202 result r = __pRecurrenceImpl->SetWeekOfMonth(week);
203 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
210 Recurrence::SetMonthOfYear(int month)
212 result r = __pRecurrenceImpl->SetMonthOfYear(month);
213 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
219 Recurrence::AddExceptionDate(const DateTime& exceptionDate)
221 result r = __pRecurrenceImpl->AddExceptionDate(exceptionDate);
222 SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
228 Recurrence::GetExceptionDatesN(void) const
230 IList* pList = __pRecurrenceImpl->GetExceptionDatesN();
231 result r = GetLastResult();
232 SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));