2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FScl_AddressImpl.cpp
19 * @brief This is the implementation for _AddressImpl class.
21 * This file contains definitions of @e _AddressImpl class.
24 #include <FBaseString.h>
25 #include <FBaseSysLog.h>
26 #include <FSclAddress.h>
27 #include <FApp_AppInfo.h>
28 #include "FScl_AddressImpl.h"
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
33 namespace Tizen { namespace Social
36 _AddressImpl::_AddressImpl(void)
37 : __type(ADDRESS_TYPE_HOME)
42 _AddressImpl::_AddressImpl(const _AddressImpl& rhs)
45 __label = rhs.__label;
46 __extended = rhs.__extended;
47 __street = rhs.__street;
49 __state = rhs.__state;
50 __postalCode = rhs.__postalCode;
51 __country = rhs.__country;
52 __postOfficeBoxNumber = rhs.__postOfficeBoxNumber;
55 _AddressImpl::~_AddressImpl(void)
61 _AddressImpl::operator =(const _AddressImpl& rhs)
69 __label = rhs.__label;
70 __extended = rhs.__extended;
71 __street = rhs.__street;
73 __state = rhs.__state;
74 __postalCode = rhs.__postalCode;
75 __country = rhs.__country;
76 __postOfficeBoxNumber = rhs.__postOfficeBoxNumber;
82 _AddressImpl::operator ==(const _AddressImpl& rhs) const
84 if ((__type == rhs.__type) &&
85 (__label == rhs.__label) &&
86 (__extended == rhs.__extended) &&
87 (__street == rhs.__street) &&
88 (__city == rhs.__city) &&
89 (__state == rhs.__state) &&
90 (__postalCode == rhs.__postalCode) &&
91 (__country == rhs.__country) &&
92 (__postOfficeBoxNumber == rhs.__postOfficeBoxNumber))
101 _AddressImpl::operator !=(const _AddressImpl& rhs) const
103 return !(*this == rhs);
107 _AddressImpl::Equals(const Object& rhs) const
109 const _AddressImpl* pAddressImpl = dynamic_cast<const _AddressImpl*>(&rhs);
111 if (pAddressImpl == null)
116 return (*this == *pAddressImpl);
120 _AddressImpl::GetHashCode(void) const
125 hashCode += __label.GetHashCode();
126 hashCode += __extended.GetHashCode();
127 hashCode += __street.GetHashCode();
128 hashCode += __city.GetHashCode();
129 hashCode += __state.GetHashCode();
130 hashCode += __postalCode.GetHashCode();
131 hashCode += __country.GetHashCode();
132 hashCode += __postOfficeBoxNumber.GetHashCode();
138 _AddressImpl::GetType(void) const
144 _AddressImpl::GetExtended(void) const
150 _AddressImpl::GetStreet(void) const
156 _AddressImpl::GetCity(void) const
162 _AddressImpl::GetState(void) const
168 _AddressImpl::GetPostalCode(void) const
175 _AddressImpl::GetCountry(void) const
182 _AddressImpl::GetPostOfficeBoxNumber(void) const
184 return __postOfficeBoxNumber;
188 _AddressImpl::SetType(AddressType type)
194 _AddressImpl::SetExtended(const String& extended)
196 __extended = extended;
200 _AddressImpl::SetStreet(const String& street)
206 _AddressImpl::SetCity(const String& city)
212 _AddressImpl::SetState(const String& state)
218 _AddressImpl::SetPostalCode(const String& postalCode)
220 __postalCode = postalCode;
224 _AddressImpl::SetCountry(const String& country)
230 _AddressImpl::SetPostOfficeBoxNumber(const String& postOfficeBoxNumber)
232 __postOfficeBoxNumber = postOfficeBoxNumber;
236 _AddressImpl::GetLabel(void) const
242 _AddressImpl::SetLabel(const String& label)
248 _AddressImpl::IsEmpty(void) const
250 if (!__extended.IsEmpty() ||
251 !__postalCode.IsEmpty() ||
252 !__postOfficeBoxNumber.IsEmpty() ||
253 !__state.IsEmpty() ||
254 !__country.IsEmpty() ||
265 _AddressImpl::GetInstance(const Address& address)
267 return address.__pAddressImpl;
271 _AddressImpl::GetInstance(Address& address)
273 return address.__pAddressImpl;