// // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /** * @file FScl_EmailContactImpl.cpp * @brief This is the implementation for _EmailContactImpl class. * * This file contains definitions of @e _EmailContactImpl class. */ #include #include #include #include #include #include #include "FScl_RecordImpl.h" #include "FScl_EmailContactImpl.h" #include "FScl_EmailImpl.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; namespace Tizen { namespace Social { _EmailContactImpl::_EmailContactImpl(void) : __addressbookId(INVALID_ADDRESSBOOK_ID) , __contactId(INVALID_RECORD_ID) { //empty body } _EmailContactImpl::_EmailContactImpl(const _EmailContactImpl& rhs) { __addressbookId = rhs.__addressbookId; __contactId = rhs.__contactId; __personId = rhs.__personId; __displayName = rhs.__displayName; __thumbnail = rhs.__thumbnail; __ringtone = rhs.__ringtone; __email = rhs.__email; } _EmailContactImpl::~_EmailContactImpl(void) { //empty body } _EmailContactImpl& _EmailContactImpl::operator =(const _EmailContactImpl& rhs) { if (this == &rhs) { return *this; } __addressbookId = rhs.__addressbookId; __contactId = rhs.__contactId; __personId = rhs.__personId; __displayName = rhs.__displayName; __thumbnail = rhs.__thumbnail; __ringtone = rhs.__ringtone; __email = rhs.__email; return *this; } bool _EmailContactImpl::operator ==(const _EmailContactImpl& rhs) const { if (__addressbookId != rhs.__addressbookId) { return false; } if (__contactId != rhs.__contactId) { return false; } if (__personId != rhs.__personId) { return false; } if (__displayName != rhs.__displayName) { return false; } if (__thumbnail != rhs.__thumbnail) { return false; } if (__ringtone != rhs.__ringtone) { return false; } if (__email != rhs.__email) { return false; } return true; } bool _EmailContactImpl::Equals(const Object& rhs) const { const _EmailContactImpl* pEmailContactImpl = dynamic_cast(&rhs); if (pEmailContactImpl == null) { return false; } return *this == *pEmailContactImpl; } int _EmailContactImpl::GetHashCode(void) const { int hashCode = 0; hashCode = 0xffffffff & __contactId; hashCode += __addressbookId; hashCode += __personId; hashCode += __displayName.GetHashCode(); hashCode += __thumbnail.GetHashCode(); hashCode += __ringtone.GetHashCode(); hashCode += __email.GetHashCode(); return hashCode; } PersonId _EmailContactImpl::GetPersonId(void) const { return __personId; } void _EmailContactImpl::SetPersonId(PersonId personId) { __personId = personId; } void _EmailContactImpl::SetAddressbookId(AddressbookId addressbookId) { __addressbookId = addressbookId; } AddressbookId _EmailContactImpl::GetAddressbookId(void) const { return __addressbookId; } RecordId _EmailContactImpl::GetContactId(void) const { return __contactId; } String _EmailContactImpl::GetDisplayName(void) const { return __displayName; } String _EmailContactImpl::GetThumbnailPath(void) const { return __thumbnail; } String _EmailContactImpl::GetRingtonePath(void) const { return __ringtone; } Email _EmailContactImpl::GetEmail(void) const { return __email; } void _EmailContactImpl::SetContactId(RecordId contactId) { __contactId = contactId; } void _EmailContactImpl::SetDisplayName(const String& displayName) { __displayName = displayName; } void _EmailContactImpl::SetThumbnailPath(const String& thumbnail) { __thumbnail = thumbnail; } void _EmailContactImpl::SetRingtonePath(const String& ringtone) { __ringtone = ringtone; } void _EmailContactImpl::SetEmailData(int recordId, EmailType type, const Tizen::Base::String& label, const Tizen::Base::String& email) { _EmailImpl::GetInstance(__email)->SetRecordId(recordId); _EmailImpl::GetInstance(__email)->SetType(type); _EmailImpl::GetInstance(__email)->SetLabel(label); _EmailImpl::GetInstance(__email)->SetEmail(email); } _EmailContactImpl* _EmailContactImpl::GetInstance(EmailContact& simpleContact) { return simpleContact.__pEmailContactImpl; } const _EmailContactImpl* _EmailContactImpl::GetInstance(const EmailContact& simpleContact) { return simpleContact.__pEmailContactImpl; } }} // Tizen::Social