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 FSclCalendar.cpp
18 * @brief This is the implementation for Calendar class.
20 * This file contains definitions of @e Calendar class.
24 #include <FSclCalendar.h>
25 #include <FBaseSysLog.h>
26 #include "FScl_CalendarImpl.h"
28 using namespace Tizen::Base;
30 namespace Tizen { namespace Social
33 Calendar::Calendar(CalendarItemType itemType)
34 : Record(RECORD_TYPE_CALENDAR)
35 , __pCalendarImpl(null)
37 __pCalendarImpl = new (std::nothrow) _CalendarImpl(itemType);
38 SysTryReturnVoidResult(NID_SCL, __pCalendarImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
41 Calendar::Calendar(const Calendar& rhs)
43 , __pCalendarImpl(null)
45 __pCalendarImpl = new (std::nothrow) _CalendarImpl(*rhs.__pCalendarImpl);
46 SysTryReturnVoidResult(NID_SCL, __pCalendarImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
49 Calendar::~Calendar(void)
51 delete __pCalendarImpl;
55 Calendar::operator =(const Calendar& rhs)
62 Record::operator=(rhs);
64 *__pCalendarImpl = *rhs.__pCalendarImpl;
70 Calendar::Equals(const Tizen::Base::Object& rhs) const
72 const Calendar* pCalendar = dynamic_cast<const Calendar*>(&rhs);
74 if (pCalendar == null)
79 return (Record::GetRecordId() == pCalendar->GetRecordId());
83 Calendar::GetHashCode(void) const
87 hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
93 Calendar::GetName(void) const
95 return __pCalendarImpl->GetName();
99 Calendar::GetItemType(void) const
101 return __pCalendarImpl->GetItemType();
105 Calendar::GetAccountId(void) const
107 return __pCalendarImpl->GetAccountId();
111 Calendar::GetColor(byte& red, byte& green, byte& blue) const
113 result r = __pCalendarImpl->GetColor(red, green, blue);
114 SysTryReturnResult(NID_SCL, r == E_SUCCESS, r, "Propagating.");
120 Calendar::SetName(const Tizen::Base::String& name)
122 __pCalendarImpl->SetName(name);
126 Calendar::SetColor(byte red, byte green, byte blue)
128 __pCalendarImpl->SetColor(red, green, blue);
132 Calendar::ClearColor(void)
134 __pCalendarImpl->ClearColor();