Fix for CompatTC Fail
[framework/osp/social.git] / src / FScl_CalEventChangeInfoImpl.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                FScl_CalEventChangeInfoImpl.cpp
18  * @brief               This is the implementation for _CalEventChangeInfoImpl class.
19  *
20  * This file contains definitions of @e _CalEventChangeInfoImpl class.
21  */
22
23 #include <FSclCalEventChangeInfo.h>
24 #include <FSclRecord.h>
25 #include "FScl_CalEventChangeInfoImpl.h"
26 #include "FScl_RecordImpl.h"
27
28 using namespace Tizen::Base;
29
30 namespace Tizen { namespace Social
31 {
32
33 const static int _INVALID_VERSION = -1;
34
35 _CalEventChangeInfoImpl::_CalEventChangeInfoImpl(void)
36         : __changeType(RECORD_CHANGE_TYPE_ADDED)
37         , __eventId(INVALID_RECORD_ID)
38         , __calendarId(INVALID_RECORD_ID)
39         , __version(_INVALID_VERSION)
40 {
41 }
42
43 _CalEventChangeInfoImpl::_CalEventChangeInfoImpl(const _CalEventChangeInfoImpl& rhs)
44         : __changeType(rhs.__changeType)
45         , __eventId(rhs.__eventId)
46         , __calendarId(rhs.__calendarId)
47         , __version(rhs.__version)
48 {
49 }
50
51 _CalEventChangeInfoImpl::~_CalEventChangeInfoImpl(void)
52 {
53 }
54
55 _CalEventChangeInfoImpl&
56 _CalEventChangeInfoImpl::operator =(const _CalEventChangeInfoImpl& rhs)
57 {
58         if (this == &rhs)
59         {
60                 return *this;
61         }
62
63         __changeType = rhs.__changeType;
64         __eventId = rhs.__eventId;
65         __calendarId = rhs.__calendarId;
66         __version = rhs.__version;
67
68         return *this;
69 }
70
71 bool
72 _CalEventChangeInfoImpl::Equals(const Object& rhs) const
73 {
74         const _CalEventChangeInfoImpl* pCalEventChangeInfoImpl = dynamic_cast<const _CalEventChangeInfoImpl*>(&rhs);
75
76         if (pCalEventChangeInfoImpl == null)
77         {
78                 return false;
79         }
80
81         return (__changeType == pCalEventChangeInfoImpl->__changeType && __eventId == pCalEventChangeInfoImpl->__eventId
82                         && __calendarId == pCalEventChangeInfoImpl->__calendarId && __version == pCalEventChangeInfoImpl->__version);
83 }
84
85 int
86 _CalEventChangeInfoImpl::GetHashCode(void) const
87 {
88         int hashCode = 17;
89
90         hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __changeType;
91         hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __eventId);
92         hashCode = static_cast<int>(( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __calendarId);
93         hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __version;
94
95         return hashCode;
96 }
97
98 RecordChangeType
99 _CalEventChangeInfoImpl::GetChangeType(void) const
100 {
101         return __changeType;
102 }
103
104 RecordId
105 _CalEventChangeInfoImpl::GetEventId(void) const
106 {
107         return __eventId;
108 }
109
110 RecordId
111 _CalEventChangeInfoImpl::GetCalendarId(void) const
112 {
113         return __calendarId;
114 }
115
116 int
117 _CalEventChangeInfoImpl::GetVersion(void) const
118 {
119         return __version;
120 }
121
122 void
123 _CalEventChangeInfoImpl::SetChangeType(RecordChangeType changeType)
124 {
125         __changeType = changeType;
126 }
127
128 void
129 _CalEventChangeInfoImpl::SetEventId(RecordId eventId)
130 {
131         __eventId = eventId;
132 }
133
134 void
135 _CalEventChangeInfoImpl::SetCalendarId(RecordId calendarId)
136 {
137         __calendarId = calendarId;
138 }
139
140 void
141 _CalEventChangeInfoImpl::SetVersion(int version)
142 {
143         __version = version;
144 }
145
146 _CalEventChangeInfoImpl*
147 _CalEventChangeInfoImpl::GetInstance(CalEventChangeInfo& calEventChangeInfo)
148 {
149         return calEventChangeInfo.__pCalEventChangeInfoImpl;
150 }
151
152 const _CalEventChangeInfoImpl*
153 _CalEventChangeInfoImpl::GetInstance(const CalEventChangeInfo& calEventChangeInfo)
154 {
155         return calEventChangeInfo.__pCalEventChangeInfoImpl;
156 }
157
158 }}      // Tizen::Social