Fix code for TDIS-5396
[framework/osp/social.git] / src / FSclPhoneNumberContact.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                FSclPhoneNumberContact.cpp
19  * @brief               This is the implementation for PhoneNumberContact class.
20  *
21  * This file contains definitions of @e PhoneNumberContact class.
22  */
23
24 #include <new>
25 #include <FBaseSysLog.h>
26 #include <FSclPhoneNumberContact.h>
27 #include "FScl_PhoneNumberContactImpl.h"
28
29 using namespace Tizen::Base;
30
31 namespace Tizen { namespace Social
32 {
33
34 PhoneNumberContact::PhoneNumberContact(void)
35 {
36         __pPhoneNumberContactImpl = new (std::nothrow) _PhoneNumberContactImpl();
37         SysTryReturnVoidResult(NID_SCL, __pPhoneNumberContactImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
38 }
39
40 PhoneNumberContact::PhoneNumberContact(const PhoneNumberContact& rhs)
41 {
42         __pPhoneNumberContactImpl = new (std::nothrow) _PhoneNumberContactImpl(*rhs.__pPhoneNumberContactImpl);
43         SysTryReturnVoidResult(NID_SCL, __pPhoneNumberContactImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
44 }
45
46 PhoneNumberContact::~PhoneNumberContact(void)
47 {
48         delete __pPhoneNumberContactImpl;
49 }
50
51 PhoneNumberContact&
52 PhoneNumberContact::operator =(const PhoneNumberContact& rhs)
53 {
54         if (this == &rhs)
55         {
56                 return *this;
57         }
58
59         *__pPhoneNumberContactImpl = *rhs.__pPhoneNumberContactImpl;
60
61         return *this;
62 }
63
64 bool
65 PhoneNumberContact::Equals(const Object& obj) const
66 {
67         const PhoneNumberContact* pPhoneNumberContact = dynamic_cast<const PhoneNumberContact*>(&obj);
68
69         if (pPhoneNumberContact == null)
70         {
71                 return false;
72         }
73
74         return *__pPhoneNumberContactImpl == *pPhoneNumberContact->__pPhoneNumberContactImpl;
75 }
76
77 int
78 PhoneNumberContact::GetHashCode(void) const
79 {
80         return __pPhoneNumberContactImpl->GetHashCode();
81 }
82
83 PersonId
84 PhoneNumberContact::GetPersonId(void) const
85 {
86         return __pPhoneNumberContactImpl->GetPersonId();
87 }
88
89 AddressbookId
90 PhoneNumberContact::GetAddressbookId(void) const
91 {
92         return __pPhoneNumberContactImpl->GetAddressbookId();
93 }
94
95 RecordId
96 PhoneNumberContact::GetContactId(void) const
97 {
98         return __pPhoneNumberContactImpl->GetContactId();
99 }
100
101 String
102 PhoneNumberContact::GetDisplayName(void) const
103 {
104         return __pPhoneNumberContactImpl->GetDisplayName();
105 }
106
107 String
108 PhoneNumberContact::GetRingtonePath(void) const
109 {
110         return __pPhoneNumberContactImpl->GetRingtonePath();
111 }
112
113 String
114 PhoneNumberContact::GetThumbnailPath(void) const
115 {
116         return __pPhoneNumberContactImpl->GetThumbnailPath();
117 }
118
119 PhoneNumber
120 PhoneNumberContact::GetPhoneNumber(void) const
121 {
122         return __pPhoneNumberContactImpl->GetPhoneNumber();
123 }
124 }}  // Tizen::Social