// // Copyright (c) 2013 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 FSclUserProfile.cpp * @brief This is the implementation for Profile class. * * This file contains definitions of @e UserProfile class. */ #include #include #include #include #include #include #include #include #include #include #include "FScl_UserProfileImpl.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; using namespace Tizen::Graphics; namespace Tizen { namespace Social { UserProfile::UserProfile(void) { __pUserProfileImpl = new (std::nothrow) _UserProfileImpl(); SysTryReturnVoidResult(NID_SCL, __pUserProfileImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); } UserProfile::UserProfile(const UserProfile& rhs) { __pUserProfileImpl = new (std::nothrow) _UserProfileImpl(*rhs.__pUserProfileImpl); SysTryReturnVoidResult(NID_SCL, __pUserProfileImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); } UserProfile::~UserProfile(void) { delete __pUserProfileImpl; } UserProfile& UserProfile::operator =(const UserProfile& rhs) { if (this == &rhs) { return *this; } *__pUserProfileImpl = *rhs.__pUserProfileImpl; return *this; } bool UserProfile::Equals(const Object& rhs) const { const UserProfile* pUserProfile = dynamic_cast(&rhs); if (pUserProfile == null) { return false; } return __pUserProfileImpl->Equals(*_UserProfileImpl::GetInstance(*pUserProfile)); } int UserProfile::GetHashCode(void) const { return __pUserProfileImpl->GetHashCode(); } AddressbookId UserProfile::GetAddressbookId(void) const { return __pUserProfileImpl->GetAddressbookId(); } String UserProfile::GetThumbnailPath(void) const { return __pUserProfileImpl->GetThumbnailPath(); } result UserProfile::SetThumbnail(const String& filePath) { result r = __pUserProfileImpl->SetThumbnail(filePath); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } String UserProfile::GetValue(UserProfilePropertyId id) const { return __pUserProfileImpl->GetValue(id); } result UserProfile::SetValue(UserProfilePropertyId id, const String& value) { result r = __pUserProfileImpl->SetValue(id, value); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddNote(const String& note) { result r = __pUserProfileImpl->AddNote(note); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddNickname(const String& nickname) { result r = __pUserProfileImpl->AddNickname(nickname); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddPhoneNumber(const PhoneNumber& phoneNumber) { result r = __pUserProfileImpl->AddPhoneNumber(phoneNumber); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddEmail(const Email& email) { result r = __pUserProfileImpl->AddEmail(email); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddUrl(const Url& url) { result r = __pUserProfileImpl->AddUrl(url); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddAddress(const Address& address) { result r = __pUserProfileImpl->AddAddress(address); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddImAddress(const ImAddress& imAddress) { result r = __pUserProfileImpl->AddImAddress(imAddress); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddOrganization(const Organization& organization) { result r = __pUserProfileImpl->AddOrganization(organization); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddEvent(const ContactEvent& event) { result r = __pUserProfileImpl->AddEvent(event); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::AddRelationship(const Relationship& relationship) { result r = __pUserProfileImpl->AddRelationship(relationship); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::RemoveAt(UserProfileMultiPropertyId id, int index) { result r = __pUserProfileImpl->RemoveAt(id, index); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } IList* UserProfile::GetValuesN(UserProfileMultiPropertyId id) const { IList* pList = __pUserProfileImpl->GetValuesN(id); SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); return pList; } result UserProfile::SetNoteAt(int index, const String& note) { result r = __pUserProfileImpl->SetNoteAt(index, note); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetNicknameAt(int index, const String& nickname) { result r = __pUserProfileImpl->SetNicknameAt(index, nickname); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetPhoneNumberAt(int index, const PhoneNumber& phoneNumber) { result r = __pUserProfileImpl->SetPhoneNumberAt(index, phoneNumber); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetEmailAt(int index, const Email& email) { result r = __pUserProfileImpl->SetEmailAt(index, email); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetEventAt(int index, const ContactEvent& event) { result r = __pUserProfileImpl->SetEventAt(index, event); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetOrganizationAt(int index, const Organization& organization) { result r = __pUserProfileImpl->SetOrganizationAt(index, organization); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetUrlAt(int index, const Url& url) { result r = __pUserProfileImpl->SetUrlAt(index, url); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetAddressAt(int index, const Address& address) { result r = __pUserProfileImpl->SetAddressAt(index, address); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetImAddressAt(int index, const ImAddress& imAddress) { result r = __pUserProfileImpl->SetImAddressAt(index, imAddress); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } result UserProfile::SetRelationshipAt(int index, const Relationship& relationship) { result r = __pUserProfileImpl->SetRelationshipAt(index, relationship); SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } }} // Tizen::Social