// // Open Service Platform // 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 FSclCalendar.cpp * @brief This is the implementation for Calendar class. * * This file contains definitions of @e Calendar class. */ #include #include #include #include "FScl_CalendarImpl.h" using namespace Tizen::Base; namespace Tizen { namespace Social { Calendar::Calendar(CalendarItemType itemType) : Record(RECORD_TYPE_CALENDAR) , __pCalendarImpl(null) { __pCalendarImpl = new (std::nothrow) _CalendarImpl(itemType); SysTryReturnVoidResult(NID_SCL, __pCalendarImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); } Calendar::Calendar(const Calendar& rhs) : Record(rhs) , __pCalendarImpl(null) { __pCalendarImpl = new (std::nothrow) _CalendarImpl(*rhs.__pCalendarImpl); SysTryReturnVoidResult(NID_SCL, __pCalendarImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); } Calendar::~Calendar(void) { delete __pCalendarImpl; } Calendar& Calendar::operator =(const Calendar& rhs) { if (this == &rhs) { return *this; } Record::operator=(rhs); *__pCalendarImpl = *rhs.__pCalendarImpl; return *this; } bool Calendar::Equals(const Tizen::Base::Object& rhs) const { const Calendar* pCalendar = dynamic_cast(&rhs); if (pCalendar == null) { return false; } return (Record::GetRecordId() == pCalendar->GetRecordId()); } int Calendar::GetHashCode(void) const { int hashCode = 17; hashCode = static_cast(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId()); return hashCode; } String Calendar::GetName(void) const { return __pCalendarImpl->GetName(); } CalendarItemType Calendar::GetItemType(void) const { return __pCalendarImpl->GetItemType(); } AccountId Calendar::GetAccountId(void) const { return __pCalendarImpl->GetAccountId(); } result Calendar::GetColor(byte& red, byte& green, byte& blue) const { result r = __pCalendarImpl->GetColor(red, green, blue); SysTryReturnResult(NID_SCL, r == E_SUCCESS, r, "Propagating."); return E_SUCCESS; } void Calendar::SetName(const Tizen::Base::String& name) { __pCalendarImpl->SetName(name); } void Calendar::SetColor(byte red, byte green, byte blue) { __pCalendarImpl->SetColor(red, green, blue); } void Calendar::ClearColor(void) { __pCalendarImpl->ClearColor(); } }} // Tizen::Social