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_PhoneNumberContactImpl.cpp
18 * @brief This is the implementation for _PhoneNumberContactImpl class.
20 * This file contains definitions of @e _PhoneNumberContactImpl class.
24 #include <unique_ptr.h>
25 #include <FBaseResult.h>
26 #include <FBaseString.h>
27 #include <FBaseSysLog.h>
28 #include <FSclPhoneNumberContact.h>
29 #include <FSclPhoneNumber.h>
30 #include "FScl_RecordImpl.h"
31 #include "FScl_PhoneNumberImpl.h"
32 #include "FScl_PhoneNumberContactImpl.h"
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Collection;
37 namespace Tizen { namespace Social
40 _PhoneNumberContactImpl::_PhoneNumberContactImpl(void)
41 : __addressbookId(INVALID_ADDRESSBOOK_ID)
42 , __contactId(INVALID_RECORD_ID)
47 _PhoneNumberContactImpl::_PhoneNumberContactImpl(const _PhoneNumberContactImpl& rhs)
49 __addressbookId = rhs.__addressbookId;
50 __contactId = rhs.__contactId;
51 __personId = rhs.__personId;
52 __displayName = rhs.__displayName;
53 __thumbnail = rhs.__thumbnail;
54 __ringtone = rhs.__ringtone;
55 __phoneNumber = rhs.__phoneNumber;
58 _PhoneNumberContactImpl::~_PhoneNumberContactImpl(void)
63 _PhoneNumberContactImpl&
64 _PhoneNumberContactImpl::operator =(const _PhoneNumberContactImpl& rhs)
70 __addressbookId = rhs.__addressbookId;
71 __contactId = rhs.__contactId;
72 __personId = rhs.__personId;
73 __displayName = rhs.__displayName;
74 __thumbnail = rhs.__thumbnail;
75 __ringtone = rhs.__ringtone;
76 __phoneNumber = rhs.__phoneNumber;
82 _PhoneNumberContactImpl::operator ==(const _PhoneNumberContactImpl& rhs) const
84 if (__addressbookId != rhs.__addressbookId)
89 if (__contactId != rhs.__contactId)
94 if (__personId != rhs.__personId)
99 if (__displayName != rhs.__displayName)
105 if (__thumbnail != rhs.__thumbnail)
111 if (__ringtone != rhs.__ringtone)
116 if (__phoneNumber != rhs.__phoneNumber)
125 _PhoneNumberContactImpl::Equals(const Object& rhs) const
127 const _PhoneNumberContactImpl* pPhoneNumberContactImpl = dynamic_cast<const _PhoneNumberContactImpl*>(&rhs);
128 if (pPhoneNumberContactImpl == null)
133 return *this == *pPhoneNumberContactImpl;
137 _PhoneNumberContactImpl::GetHashCode(void) const
141 hashCode = 0xffffffff & __contactId;
142 hashCode += __addressbookId;
143 hashCode += __personId;
144 hashCode += __displayName.GetHashCode();
145 hashCode += __thumbnail.GetHashCode();
146 hashCode += __ringtone.GetHashCode();
147 hashCode += __phoneNumber.GetHashCode();
153 _PhoneNumberContactImpl::GetPersonId(void) const
159 _PhoneNumberContactImpl::SetPersonId(PersonId personId)
161 __personId = personId;
166 _PhoneNumberContactImpl::SetAddressbookId(AddressbookId addressbookId)
168 __addressbookId = addressbookId;
172 _PhoneNumberContactImpl::GetAddressbookId(void) const
174 return __addressbookId;
179 _PhoneNumberContactImpl::GetContactId(void) const
185 _PhoneNumberContactImpl::GetDisplayName(void) const
187 return __displayName;
191 _PhoneNumberContactImpl::GetThumbnailPath(void) const
197 _PhoneNumberContactImpl::GetRingtonePath(void) const
204 _PhoneNumberContactImpl::GetPhoneNumber(void) const
206 return __phoneNumber;
210 _PhoneNumberContactImpl::SetContactId(RecordId contactId)
212 __contactId = contactId;
216 _PhoneNumberContactImpl::SetDisplayName(const String& displayName)
218 __displayName = displayName;
222 _PhoneNumberContactImpl::SetThumbnailPath(const String& thumbnail)
224 __thumbnail = thumbnail;
228 _PhoneNumberContactImpl::SetRingtonePath(const String& ringtone)
230 __ringtone = ringtone;
234 _PhoneNumberContactImpl::SetPhoneNumberData(int recordId, PhoneNumberType type, const Tizen::Base::String& label, const Tizen::Base::String& number)
236 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetRecordId(recordId);
237 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetType(type);
238 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetLabel(label);
239 _PhoneNumberImpl::GetInstance(__phoneNumber)->SetPhoneNumber(number);
242 _PhoneNumberContactImpl*
243 _PhoneNumberContactImpl::GetInstance(PhoneNumberContact& simpleContact)
245 return simpleContact.__pPhoneNumberContactImpl;
248 const _PhoneNumberContactImpl*
249 _PhoneNumberContactImpl::GetInstance(const PhoneNumberContact& simpleContact)
251 return simpleContact.__pPhoneNumberContactImpl;