Initialize Tizen 2.3
[framework/osp/social.git] / src / FSclCalEventChangeInfo.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16 /**
17  * @file                FSclCalEventChangeInfo.cpp
18  * @brief               This is the implementation for CalEventChangeInfo class.
19  *
20  * This file contains definitions of @e CalEventChangeInfo class.
21  */
22
23 #include <new>
24 #include <FBaseSysLog.h>
25 #include <FSclCalEventChangeInfo.h>
26 #include "FScl_CalEventChangeInfoImpl.h"
27
28 namespace Tizen { namespace Social
29 {
30
31 const static int _INVALID_VERSION = -1;
32
33 CalEventChangeInfo::CalEventChangeInfo(void)
34 : __pCalEventChangeInfoImpl(null)
35 {
36         __pCalEventChangeInfoImpl = new (std::nothrow) _CalEventChangeInfoImpl();
37         SysTryReturnVoidResult(NID_SCL, __pCalEventChangeInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
38 }
39
40 CalEventChangeInfo::CalEventChangeInfo(const CalEventChangeInfo& rhs)
41 : __pCalEventChangeInfoImpl(null)
42 {
43         __pCalEventChangeInfoImpl = new (std::nothrow) _CalEventChangeInfoImpl(*(rhs.__pCalEventChangeInfoImpl));
44         SysTryReturnVoidResult(NID_SCL, __pCalEventChangeInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
45 }
46
47 CalEventChangeInfo::~CalEventChangeInfo(void)
48 {
49         delete __pCalEventChangeInfoImpl;
50 }
51
52 CalEventChangeInfo&
53 CalEventChangeInfo::operator =(const CalEventChangeInfo& rhs)
54 {
55         if (this == &rhs)
56         {
57                 return *this;
58         }
59
60         *__pCalEventChangeInfoImpl = *rhs.__pCalEventChangeInfoImpl;
61
62         return *this;
63 }
64
65 bool
66 CalEventChangeInfo::Equals(const Object& rhs) const
67 {
68         const CalEventChangeInfo* pCalEventChangeInfo = dynamic_cast<const CalEventChangeInfo*>(&rhs);
69         if (pCalEventChangeInfo == null)
70         {
71                 return false;
72         }
73
74         return __pCalEventChangeInfoImpl->Equals(*_CalEventChangeInfoImpl::GetInstance(*pCalEventChangeInfo));
75 }
76
77 int
78 CalEventChangeInfo::GetHashCode(void) const
79 {
80         return __pCalEventChangeInfoImpl->GetHashCode();
81 }
82
83 RecordChangeType
84 CalEventChangeInfo::GetChangeType(void) const
85 {
86         return __pCalEventChangeInfoImpl->GetChangeType();
87 }
88
89 RecordId
90 CalEventChangeInfo::GetEventId(void) const
91 {
92         return __pCalEventChangeInfoImpl->GetEventId();
93 }
94
95 RecordId
96 CalEventChangeInfo::GetCalendarId(void) const
97 {
98         return __pCalEventChangeInfoImpl->GetCalendarId();
99 }
100
101 int
102 CalEventChangeInfo::GetVersion(void) const
103 {
104         return __pCalEventChangeInfoImpl->GetVersion();
105 }
106
107 }}      // Tizen::Social