Modify the spec file for secure log
[framework/osp/social.git] / src / FScl_CategoryChangeInfoImpl.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_CategoryChangeInfoImpl.cpp
18  * @brief               This is the implementation for _CategoryChangeInfoImpl class.
19  *
20  * This file contains definitions of @e _CategoryChangeInfoImpl class.
21  */
22
23 #include <new>
24 #include <FBaseResult.h>
25 #include <FSclCategoryChangeInfo.h>
26 #include <FBaseSysLog.h>
27 #include "FScl_RecordImpl.h"
28 #include "FScl_CategoryChangeInfoImpl.h"
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32
33 namespace Tizen { namespace Social
34 {
35
36 _CategoryChangeInfoImpl::_CategoryChangeInfoImpl(void)
37         : __categoryId(INVALID_RECORD_ID)
38         , __addressbookId(INVALID_ADDRESSBOOK_ID)
39         , __version(0)
40         , __changeType(RECORD_CHANGE_TYPE_ADDED)
41 {
42         // empty body
43 }
44
45 _CategoryChangeInfoImpl::_CategoryChangeInfoImpl(const _CategoryChangeInfoImpl& rhs)
46 {
47         __categoryId = rhs.__categoryId;
48         __addressbookId = rhs.__addressbookId;
49         __version = rhs.__version;
50         __changeType = rhs.__changeType;
51 }
52
53 _CategoryChangeInfoImpl::~_CategoryChangeInfoImpl(void)
54 {
55         // empty body
56 }
57
58 _CategoryChangeInfoImpl&
59 _CategoryChangeInfoImpl::operator =(const _CategoryChangeInfoImpl& rhs)
60 {
61         if (this == &rhs)
62         {
63                 return *this;
64         }
65
66         __categoryId = rhs.__categoryId;
67         __addressbookId = rhs.__addressbookId;
68         __version = rhs.__version;
69         __changeType = rhs.__changeType;
70
71         return *this;
72 }
73
74 bool
75 _CategoryChangeInfoImpl::operator ==(const _CategoryChangeInfoImpl& rhs) const
76 {
77         if (__categoryId != rhs.__categoryId)
78         {
79                 return false;
80         }
81
82         if (__addressbookId != rhs.__addressbookId)
83         {
84                 return false;
85         }
86
87         if (__version != rhs.__version)
88         {
89                 return false;
90         }
91
92         if (__changeType != rhs.__changeType)
93         {
94                 return false;
95         }
96
97         return true;
98 }
99
100
101 bool
102 _CategoryChangeInfoImpl::Equals(const Object& rhs) const
103 {
104         const _CategoryChangeInfoImpl* pCategoryChangeInfoImpl = dynamic_cast<const _CategoryChangeInfoImpl*>(&rhs);
105
106         if (pCategoryChangeInfoImpl == null)
107         {
108                 return false;
109         }
110
111         return *this == *pCategoryChangeInfoImpl;
112 }
113
114 int
115 _CategoryChangeInfoImpl::GetHashCode(void) const
116 {
117         int hashCode = 0;
118
119         hashCode = __categoryId;
120         hashCode += __addressbookId;
121         hashCode += __version;
122
123         hashCode += __changeType;
124
125         return hashCode;
126 }
127
128 AddressbookId
129 _CategoryChangeInfoImpl::GetAddressbookId(void) const
130 {
131         return __addressbookId;
132 }
133
134 void
135 _CategoryChangeInfoImpl::SetAddressbookId(AddressbookId addressbookId)
136 {
137         __addressbookId = addressbookId;
138 }
139
140 RecordId
141 _CategoryChangeInfoImpl::GetCategoryId(void) const
142 {
143         return __categoryId;
144 }
145
146 int
147 _CategoryChangeInfoImpl::GetVersion(void) const
148 {
149         return __version;
150 }
151
152 RecordChangeType
153 _CategoryChangeInfoImpl::GetChangeType(void) const
154 {
155         return __changeType;
156 }
157
158 void
159 _CategoryChangeInfoImpl::SetCategoryId(RecordId categoryId)
160 {
161         __categoryId = categoryId;
162 }
163
164 void
165 _CategoryChangeInfoImpl::SetVersion(int version)
166 {
167         __version = version;
168 }
169
170 void
171 _CategoryChangeInfoImpl::SetChangeType(RecordChangeType changeType)
172 {
173         __changeType = changeType;
174 }
175
176 _CategoryChangeInfoImpl*
177 _CategoryChangeInfoImpl::GetInstance(CategoryChangeInfo& categoryChangeInfo)
178 {
179         return categoryChangeInfo.__pCategoryChangeInfoImpl;
180 }
181
182 const _CategoryChangeInfoImpl*
183 _CategoryChangeInfoImpl::GetInstance(const CategoryChangeInfo& categoryChangeInfo)
184 {
185         return categoryChangeInfo.__pCategoryChangeInfoImpl;
186 }
187
188 }} // Tizen::Social