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_PhoneNumberContactImpl.cpp
19 * @brief This is the implementation for _PhoneNumberContactImpl class.
21 * This file contains definitions of @e _PhoneNumberContactImpl class.
25 #include <unique_ptr.h>
26 #include <FBaseResult.h>
27 #include <FBaseString.h>
28 #include <FBaseSysLog.h>
29 #include <FSclPhoneNumberContact.h>
30 #include <FSclPhoneNumber.h>
31 #include "FScl_RecordImpl.h"
32 #include "FScl_PhoneNumberImpl.h"
33 #include "FScl_PhoneNumberContactImpl.h"
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
38 namespace Tizen { namespace Social
41 _PhoneNumberContactImpl::_PhoneNumberContactImpl(void)
42 : __addressbookId(INVALID_ADDRESSBOOK_ID)
43 , __contactId(INVALID_RECORD_ID)
48 _PhoneNumberContactImpl::_PhoneNumberContactImpl(const _PhoneNumberContactImpl& rhs)
50 __addressbookId = rhs.__addressbookId;
51 __contactId = rhs.__contactId;
52 __personId = rhs.__personId;
53 __displayName = rhs.__displayName;
54 __thumbnail = rhs.__thumbnail;
55 __ringtone = rhs.__ringtone;
56 __phoneNumber = rhs.__phoneNumber;
59 _PhoneNumberContactImpl::~_PhoneNumberContactImpl(void)
64 _PhoneNumberContactImpl&
65 _PhoneNumberContactImpl::operator =(const _PhoneNumberContactImpl& rhs)
71 __addressbookId = rhs.__addressbookId;
72 __contactId = rhs.__contactId;
73 __personId = rhs.__personId;
74 __displayName = rhs.__displayName;
75 __thumbnail = rhs.__thumbnail;
76 __ringtone = rhs.__ringtone;
77 __phoneNumber = rhs.__phoneNumber;
83 _PhoneNumberContactImpl::operator ==(const _PhoneNumberContactImpl& rhs) const
85 if (__addressbookId != rhs.__addressbookId)
90 if (__contactId != rhs.__contactId)
95 if (__personId != rhs.__personId)
100 if (__displayName != rhs.__displayName)
106 if (__thumbnail != rhs.__thumbnail)
112 if (__ringtone != rhs.__ringtone)
117 if (__phoneNumber != rhs.__phoneNumber)
126 _PhoneNumberContactImpl::Equals(const Object& rhs) const
128 const _PhoneNumberContactImpl* pPhoneNumberContactImpl = dynamic_cast<const _PhoneNumberContactImpl*>(&rhs);
129 if (pPhoneNumberContactImpl == null)
134 return *this == *pPhoneNumberContactImpl;
138 _PhoneNumberContactImpl::GetHashCode(void) const
142 hashCode = 0xffffffff & __contactId;
143 hashCode += __addressbookId;
144 hashCode += __personId;
145 hashCode += __displayName.GetHashCode();
146 hashCode += __thumbnail.GetHashCode();
147 hashCode += __ringtone.GetHashCode();
148 hashCode += __phoneNumber.GetHashCode();
154 _PhoneNumberContactImpl::GetPersonId(void) const
160 _PhoneNumberContactImpl::SetPersonId(PersonId personId)
162 __personId = personId;
167 _PhoneNumberContactImpl::SetAddressbookId(AddressbookId addressbookId)
169 __addressbookId = addressbookId;
173 _PhoneNumberContactImpl::GetAddressbookId(void) const
175 return __addressbookId;
180 _PhoneNumberContactImpl::GetContactId(void) const
186 _PhoneNumberContactImpl::GetDisplayName(void) const
188 return __displayName;
192 _PhoneNumberContactImpl::GetThumbnailPath(void) const
198 _PhoneNumberContactImpl::GetRingtonePath(void) const
205 _PhoneNumberContactImpl::GetPhoneNumber(void) const
207 return __phoneNumber;
211 _PhoneNumberContactImpl::SetContactId(RecordId contactId)
213 __contactId = contactId;
217 _PhoneNumberContactImpl::SetDisplayName(const String& displayName)
219 __displayName = displayName;
223 _PhoneNumberContactImpl::SetThumbnailPath(const String& thumbnail)
225 __thumbnail = thumbnail;
229 _PhoneNumberContactImpl::SetRingtonePath(const String& ringtone)
231 __ringtone = ringtone;
235 _PhoneNumberContactImpl::SetPhoneNumberData(int recordId, PhoneNumberType type, const Tizen::Base::String& label, const Tizen::Base::String& number)
237 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetRecordId(recordId);
238 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetType(type);
239 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetLabel(label);
240 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetPhoneNumber(number);
243 _PhoneNumberContactImpl*
244 _PhoneNumberContactImpl::GetInstance(PhoneNumberContact& simpleContact)
246 return simpleContact.__pPhoneNumberContactImpl;
249 const _PhoneNumberContactImpl*
250 _PhoneNumberContactImpl::GetInstance(const PhoneNumberContact& simpleContact)
252 return simpleContact.__pPhoneNumberContactImpl;