2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FScl_AddressImpl.cpp
18 * @brief This is the implementation for _AddressImpl class.
20 * This file contains definitions of @e _AddressImpl class.
23 #include <FBaseString.h>
24 #include <FBaseSysLog.h>
25 #include <FSclAddress.h>
26 #include <FApp_AppInfo.h>
27 #include "FScl_AddressImpl.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Social
35 _AddressImpl::_AddressImpl(void)
36 : __type(ADDRESS_TYPE_HOME)
41 _AddressImpl::_AddressImpl(const _AddressImpl& rhs)
44 __label = rhs.__label;
45 __extended = rhs.__extended;
46 __street = rhs.__street;
48 __state = rhs.__state;
49 __postalCode = rhs.__postalCode;
50 __country = rhs.__country;
51 __postOfficeBoxNumber = rhs.__postOfficeBoxNumber;
54 _AddressImpl::~_AddressImpl(void)
60 _AddressImpl::operator =(const _AddressImpl& rhs)
68 __label = rhs.__label;
69 __extended = rhs.__extended;
70 __street = rhs.__street;
72 __state = rhs.__state;
73 __postalCode = rhs.__postalCode;
74 __country = rhs.__country;
75 __postOfficeBoxNumber = rhs.__postOfficeBoxNumber;
81 _AddressImpl::operator ==(const _AddressImpl& rhs) const
83 if ((__type == rhs.__type) &&
84 (__label == rhs.__label) &&
85 (__extended == rhs.__extended) &&
86 (__street == rhs.__street) &&
87 (__city == rhs.__city) &&
88 (__state == rhs.__state) &&
89 (__postalCode == rhs.__postalCode) &&
90 (__country == rhs.__country) &&
91 (__postOfficeBoxNumber == rhs.__postOfficeBoxNumber))
100 _AddressImpl::operator !=(const _AddressImpl& rhs) const
102 return !(*this == rhs);
106 _AddressImpl::Equals(const Object& rhs) const
108 const _AddressImpl* pAddressImpl = dynamic_cast<const _AddressImpl*>(&rhs);
110 if (pAddressImpl == null)
115 return (*this == *pAddressImpl);
119 _AddressImpl::GetHashCode(void) const
124 hashCode += __label.GetHashCode();
125 hashCode += __extended.GetHashCode();
126 hashCode += __street.GetHashCode();
127 hashCode += __city.GetHashCode();
128 hashCode += __state.GetHashCode();
129 hashCode += __postalCode.GetHashCode();
130 hashCode += __country.GetHashCode();
131 hashCode += __postOfficeBoxNumber.GetHashCode();
137 _AddressImpl::GetType(void) const
143 _AddressImpl::GetExtended(void) const
149 _AddressImpl::GetStreet(void) const
155 _AddressImpl::GetCity(void) const
161 _AddressImpl::GetState(void) const
167 _AddressImpl::GetPostalCode(void) const
174 _AddressImpl::GetCountry(void) const
181 _AddressImpl::GetPostOfficeBoxNumber(void) const
183 return __postOfficeBoxNumber;
187 _AddressImpl::SetType(AddressType type)
193 _AddressImpl::SetExtended(const String& extended)
195 __extended = extended;
199 _AddressImpl::SetStreet(const String& street)
205 _AddressImpl::SetCity(const String& city)
211 _AddressImpl::SetState(const String& state)
217 _AddressImpl::SetPostalCode(const String& postalCode)
219 __postalCode = postalCode;
223 _AddressImpl::SetCountry(const String& country)
229 _AddressImpl::SetPostOfficeBoxNumber(const String& postOfficeBoxNumber)
231 __postOfficeBoxNumber = postOfficeBoxNumber;
235 _AddressImpl::GetLabel(void) const
241 _AddressImpl::SetLabel(const String& label)
247 _AddressImpl::IsEmpty(void) const
249 if (!__extended.IsEmpty() ||
250 !__postalCode.IsEmpty() ||
251 !__postOfficeBoxNumber.IsEmpty() ||
252 !__state.IsEmpty() ||
253 !__country.IsEmpty() ||
264 _AddressImpl::GetInstance(const Address& address)
266 return address.__pAddressImpl;
270 _AddressImpl::GetInstance(Address& address)
272 return address.__pAddressImpl;