Tizen 2.0 Release
[platform/framework/native/social.git] / src / FScl_OrganizationImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18 * @file         FScl_OrganizationImpl.cpp
19 * @brief        This is the implementation for _OrganizationImpl class.
20 *
21 * This file contains definitions of @e _OrganizationImpl class.
22 */
23
24 #include <FBaseSysLog.h>
25 #include <FSclOrganization.h>
26 #include "FScl_OrganizationImpl.h"
27
28 using namespace Tizen::Base;
29
30 namespace Tizen { namespace Social
31 {
32
33 _OrganizationImpl::_OrganizationImpl(void)
34 {
35 }
36
37 _OrganizationImpl::_OrganizationImpl(const _OrganizationImpl& rhs)
38 {
39         __name = rhs.__name;
40         __jobTitle = rhs.__jobTitle;
41         __department = rhs.__department;
42         __role = rhs.__role;
43         __agent = rhs.__agent;
44 }
45
46 _OrganizationImpl::~_OrganizationImpl(void)
47 {
48
49 }
50
51 _OrganizationImpl&
52 _OrganizationImpl::operator =(const _OrganizationImpl& rhs)
53 {
54         if (this == &rhs)
55         {
56                 return *this;
57         }
58
59         __name = rhs.__name;
60         __jobTitle = rhs.__jobTitle;
61         __department = rhs.__department;
62         __role = rhs.__role;
63         __agent = rhs.__agent;
64
65         return *this;
66 }
67
68 bool
69 _OrganizationImpl::operator ==(const _OrganizationImpl& rhs) const
70 {
71         if (__name != rhs.__name)
72         {
73                 return false;
74         }
75
76         if (__jobTitle != rhs.__jobTitle)
77         {
78                 return false;
79         }
80
81         if (__department != rhs.__department)
82         {
83                 return false;
84         }
85
86         if (__role != rhs.__role)
87         {
88                 return false;
89         }
90
91         if (__agent != rhs.__agent)
92         {
93                 return false;
94         }
95
96         return true;
97 }
98
99 bool
100 _OrganizationImpl::operator !=(const _OrganizationImpl& rhs) const
101 {
102         return !(*this == rhs);
103 }
104
105 bool
106 _OrganizationImpl::Equals(const Object& rhs) const
107 {
108         const _OrganizationImpl* pOrganization = dynamic_cast<const _OrganizationImpl*>(&rhs);
109         if (pOrganization == null)
110         {
111                 return false;
112         }
113
114         return *this == *pOrganization;
115 }
116
117 int
118 _OrganizationImpl::GetHashCode(void) const
119 {
120         int hash = __name.GetHashCode();
121         hash += __jobTitle.GetHashCode();
122         hash +=  __department.GetHashCode();
123         hash +=  __role.GetHashCode();
124         hash +=  __agent.GetHashCode();
125
126         return hash;
127 }
128
129 String
130 _OrganizationImpl::GetName(void) const
131 {
132         return __name;
133 }
134
135 String
136 _OrganizationImpl::GetJobTitle(void) const
137 {
138         return __jobTitle;
139 }
140
141 String
142 _OrganizationImpl::GetDepartment(void) const
143 {
144         return __department;
145 }
146
147 String
148 _OrganizationImpl::GetRole(void) const
149 {
150         return __role;
151 }
152
153 String
154 _OrganizationImpl::GetAgent(void) const
155 {
156         return __agent;
157 }
158
159 void
160 _OrganizationImpl::SetName(const String& name)
161 {
162         __name = name;
163 }
164
165 void
166 _OrganizationImpl::SetJobTitle(const String& jobTitle)
167 {
168         __jobTitle = jobTitle;
169 }
170
171 void
172 _OrganizationImpl::SetDepartment(const String& department)
173 {
174         __department = department;
175 }
176
177 void
178 _OrganizationImpl::SetRole(const String& role)
179 {
180         __role = role;
181 }
182
183 void
184 _OrganizationImpl::SetAgent(const String& agent)
185 {
186         __agent = agent;
187 }
188
189 bool
190 _OrganizationImpl::IsEmpty(void) const
191 {
192         if (!__name.IsEmpty())
193         {
194                 return false;
195         }
196
197         if (!__jobTitle.IsEmpty())
198         {
199                 return false;
200         }
201
202         if (!__role.IsEmpty())
203         {
204                 return false;
205         }
206
207         if (!__agent.IsEmpty())
208         {
209                 return false;
210         }
211
212         if (!__department.IsEmpty())
213         {
214                 return false;
215         }
216
217         return true;
218 }
219
220 const _OrganizationImpl*
221 _OrganizationImpl::GetInstance(const Organization& organization)
222 {
223         return organization.__pOrganizationImpl;
224 }
225
226 _OrganizationImpl*
227 _OrganizationImpl::GetInstance(Organization& organization)
228 {
229         return organization.__pOrganizationImpl;
230 }
231
232 }} // Tizen::Social