// // Open Service Platform // 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 FSclPerson.cpp * @brief This is the implementation for Profile class. * * This file contains definitions of @e Person class. */ #include #include #include #include #include #include "FScl_PersonImpl.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; using namespace Tizen::Security; namespace Tizen { namespace Social { Person::Person(void) { _PersonImpl* pPersonImpl = new (std::nothrow) _PersonImpl(); SysTryReturnVoidResult(NID_SCL, pPersonImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(GetLastResult())); __pPersonImpl = pPersonImpl; } Person::~Person(void) { delete __pPersonImpl; } bool Person::Equals(const Object& rhs) const { const Person* pPerson = dynamic_cast(&rhs); if (pPerson == null) { return false; } return __pPersonImpl->Equals(*pPerson->__pPersonImpl);; } int Person::GetHashCode(void) const { return __pPersonImpl->GetHashCode(); } String Person::GetDisplayName(void) const { return __pPersonImpl->GetDisplayName(); } PersonId Person::GetId(void) const { return __pPersonImpl->GetId(); } result Person::SetAsFavorite(bool isFavorite) { SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED , "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); return __pPersonImpl->SetAsFavorite(isFavorite); } bool Person::IsFavorite(void) const { return __pPersonImpl->IsFavorite(); } String Person::GetThumbnailPath(void) const { return __pPersonImpl->GetThumbnailPath(); } String Person::GetRingtonePath(void) const { return __pPersonImpl->GetRingtonePath(); } bool Person::HasPhoneNumber(void) const { return __pPersonImpl->HasPhoneNumber(); } bool Person::HasEmail(void) const { return __pPersonImpl->HasEmail(); } IListT* Person::GetAccountIdsN(void) const { return __pPersonImpl->GetAccountIdsN(); } result Person::SetAsPrimaryPhoneNumber(const PhoneNumber& phoneNumber) { SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED , "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); return __pPersonImpl->SetAsPrimaryPhoneNumber(phoneNumber); } result Person::SetAsPrimaryEmail(const Email& email) { SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED , "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); return __pPersonImpl->SetAsPrimaryEmail(email); } PhoneNumber Person::GetPrimaryPhoneNumber(void) const { SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, PhoneNumber(), E_PRIVILEGE_DENIED , "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); return __pPersonImpl->GetPrimaryPhoneNumber(); } Email Person::GetPrimaryEmail(void) const { SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, Email(), E_PRIVILEGE_DENIED , "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); return __pPersonImpl->GetPrimaryEmail(); } }} // Tizen::Social