// // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /** * @file FSclRecurrence.cpp * @brief This is the implementation for Recurrence class. * * This file contains definitions of @e Recurrence class. */ #include #include #include #include #include "FScl_RecurrenceImpl.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; namespace Tizen { namespace Social { Recurrence::Recurrence(void) : __pRecurrenceImpl(null) { __pRecurrenceImpl = new (std::nothrow) _RecurrenceImpl(); SysTryReturnVoidResult(NID_SCL, __pRecurrenceImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); } Recurrence::Recurrence(const Recurrence& rhs) : __pRecurrenceImpl(null) { __pRecurrenceImpl = new (std::nothrow) _RecurrenceImpl(*rhs.__pRecurrenceImpl); SysTryReturnVoidResult(NID_SCL, __pRecurrenceImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); } Recurrence::~Recurrence(void) { delete __pRecurrenceImpl; } Recurrence& Recurrence::operator =(const Recurrence& rhs) { if (this == &rhs) { return *this; } *__pRecurrenceImpl = *rhs.__pRecurrenceImpl; return *this; } bool Recurrence::Equals(const Object& rhs) const { const Recurrence* pRecurrence = dynamic_cast(&rhs); if (pRecurrence == null) { return false; } return __pRecurrenceImpl->Equals(*_RecurrenceImpl::GetInstance(*pRecurrence)); } int Recurrence::GetHashCode(void) const { return __pRecurrenceImpl->GetHashCode(); } RecurFrequency Recurrence::GetFrequency(void) const { return __pRecurrenceImpl->GetFrequency(); } int Recurrence::GetInterval(void) const { return __pRecurrenceImpl->GetInterval(); } const DateTime* Recurrence::GetUntil(void) const { return __pRecurrenceImpl->GetUntil(); } int Recurrence::GetCounts(void) const { return __pRecurrenceImpl->GetCounts(); } CalDayOfWeek Recurrence::GetWeekStart(void) const { return __pRecurrenceImpl->GetWeekStart(); } int Recurrence::GetDayOfWeek(void) const { return __pRecurrenceImpl->GetDayOfWeek(); } int Recurrence::GetDayOfMonth(void) const { return __pRecurrenceImpl->GetDayOfMonth(); } int Recurrence::GetWeekOfMonth(void) const { return __pRecurrenceImpl->GetWeekOfMonth(); } int Recurrence::GetMonthOfYear(void)const { return __pRecurrenceImpl->GetMonthOfYear(); } void Recurrence::SetFrequency(RecurFrequency type) { __pRecurrenceImpl->SetFrequency(type); } result Recurrence::SetInterval(int interval) { result r = __pRecurrenceImpl->SetInterval(interval); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetUntil(const DateTime* pUntil) { result r = __pRecurrenceImpl->SetUntil(pUntil); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetCounts(int count) { result r = __pRecurrenceImpl->SetCounts(count); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetWeekStart(CalDayOfWeek weekStart) { result r = __pRecurrenceImpl->SetWeekStart(weekStart); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetDayOfWeek(int day) { result r = __pRecurrenceImpl->SetDayOfWeek(day); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetDayOfMonth(int day) { result r = __pRecurrenceImpl->SetDayOfMonth(day); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetWeekOfMonth(int week) { result r = __pRecurrenceImpl->SetWeekOfMonth(week); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::SetMonthOfYear(int month) { result r = __pRecurrenceImpl->SetMonthOfYear(month); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result Recurrence::AddExceptionDate(const DateTime& exceptionDate) { result r = __pRecurrenceImpl->AddExceptionDate(exceptionDate); SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } IList* Recurrence::GetExceptionDatesN(void) const { IList* pList = __pRecurrenceImpl->GetExceptionDatesN(); result r = GetLastResult(); SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); return pList; } }} // Tizen::Social