Fix code for TDIS-5396
[framework/osp/social.git] / src / FSclEmailContact.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                FSclEmailContact.cpp
19  * @brief               This is the implementation for EmailContact class.
20  *
21  * This file contains definitions of @e EmailContact class.
22  */
23
24 #include <new>
25 #include <FBaseSysLog.h>
26 #include <FSclEmailContact.h>
27 #include "FScl_EmailContactImpl.h"
28
29 using namespace Tizen::Base;
30
31 namespace Tizen { namespace Social
32 {
33
34 EmailContact::EmailContact(void)
35 {
36         __pEmailContactImpl = new (std::nothrow) _EmailContactImpl();
37         SysTryReturnVoidResult(NID_SCL, __pEmailContactImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]Not enough memory.");
38 }
39
40 EmailContact::EmailContact(const EmailContact& rhs)
41 {
42         __pEmailContactImpl = new (std::nothrow) _EmailContactImpl(*rhs.__pEmailContactImpl);
43         SysTryReturnVoidResult(NID_SCL, __pEmailContactImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]Not enough memory.");
44 }
45
46 EmailContact::~EmailContact(void)
47 {
48         delete __pEmailContactImpl;
49 }
50
51 EmailContact&
52 EmailContact::operator =(const EmailContact& rhs)
53 {
54         if (this == &rhs)
55         {
56                 return *this;
57         }
58
59         *__pEmailContactImpl = *rhs.__pEmailContactImpl;
60
61         return *this;
62 }
63
64 bool
65 EmailContact::Equals(const Object& obj) const
66 {
67         const EmailContact* pEmailContact = dynamic_cast<const EmailContact*>(&obj);
68
69         if (pEmailContact == null)
70         {
71                 return false;
72         }
73
74         return *__pEmailContactImpl == *pEmailContact->__pEmailContactImpl;
75 }
76
77 int
78 EmailContact::GetHashCode(void) const
79 {
80         return __pEmailContactImpl->GetHashCode();
81 }
82
83 PersonId
84 EmailContact::GetPersonId(void) const
85 {
86         return __pEmailContactImpl->GetPersonId();
87 }
88
89 AddressbookId
90 EmailContact::GetAddressbookId(void) const
91 {
92         return __pEmailContactImpl->GetAddressbookId();
93 }
94
95 RecordId
96 EmailContact::GetContactId(void) const
97 {
98         return __pEmailContactImpl->GetContactId();
99 }
100
101 String
102 EmailContact::GetDisplayName(void) const
103 {
104         return __pEmailContactImpl->GetDisplayName();
105 }
106
107 String
108 EmailContact::GetRingtonePath(void) const
109 {
110         return __pEmailContactImpl->GetRingtonePath();
111 }
112
113 String
114 EmailContact::GetThumbnailPath(void) const
115 {
116         return __pEmailContactImpl->GetThumbnailPath();
117 }
118
119 Email
120 EmailContact::GetEmail(void) const
121 {
122         return __pEmailContactImpl->GetEmail();
123 }
124 }}  // Tizen::Social