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 FSclCalendar.cpp
19 * @brief This is the implementation for Calendar class.
21 * This file contains definitions of @e Calendar class.
25 #include <FSclCalendar.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_CalendarImpl.h"
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Social
34 Calendar::Calendar(CalendarItemType itemType)
35 : Record(RECORD_TYPE_CALENDAR)
36 , __pCalendarImpl(null)
38 __pCalendarImpl = new (std::nothrow) _CalendarImpl(itemType);
39 SysTryReturnVoidResult(NID_SCL, __pCalendarImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
42 Calendar::Calendar(const Calendar& rhs)
44 , __pCalendarImpl(null)
46 __pCalendarImpl = new (std::nothrow) _CalendarImpl(*rhs.__pCalendarImpl);
47 SysTryReturnVoidResult(NID_SCL, __pCalendarImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
50 Calendar::~Calendar(void)
52 delete __pCalendarImpl;
56 Calendar::operator =(const Calendar& rhs)
63 Record::operator=(rhs);
65 *__pCalendarImpl = *rhs.__pCalendarImpl;
71 Calendar::Equals(const Tizen::Base::Object& rhs) const
73 const Calendar* pCalendar = dynamic_cast<const Calendar*>(&rhs);
75 if (pCalendar == null)
80 return (Record::GetRecordId() == pCalendar->GetRecordId());
84 Calendar::GetHashCode(void) const
88 hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ Record::GetRecordId());
94 Calendar::GetName(void) const
96 return __pCalendarImpl->GetName();
100 Calendar::GetItemType(void) const
102 return __pCalendarImpl->GetItemType();
106 Calendar::GetAccountId(void) const
108 return __pCalendarImpl->GetAccountId();
112 Calendar::GetColor(byte& red, byte& green, byte& blue) const
114 result r = __pCalendarImpl->GetColor(red, green, blue);
115 SysTryReturnResult(NID_SCL, r == E_SUCCESS, r, "Propagating.");
121 Calendar::SetName(const Tizen::Base::String& name)
123 __pCalendarImpl->SetName(name);
127 Calendar::SetColor(byte red, byte green, byte blue)
129 __pCalendarImpl->SetColor(red, green, blue);
133 Calendar::ClearColor(void)
135 __pCalendarImpl->ClearColor();