Merge "Fixed exception handling codes" into tizen_2.1
[framework/osp/social.git] / src / FSclContactChangeInfo.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                FSclContactChangeInfo.cpp
19  * @brief               This is the implementation for ContactChangeInfo class.
20  *
21  * This file contains definitions of @e ContactChangeInfo class.
22  */
23
24 #include <new>
25 #include <FBaseResult.h>
26 #include <FSclContactChangeInfo.h>
27 #include <FBaseSysLog.h>
28 #include "FScl_ContactChangeInfoImpl.h"
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32
33 namespace Tizen { namespace Social
34 {
35
36 ContactChangeInfo::ContactChangeInfo(void)
37 {
38         __pContactChangeInfoImpl = new (std::nothrow) _ContactChangeInfoImpl();
39         SysTryReturnVoidResult(NID_SCL, __pContactChangeInfoImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
40 }
41
42 ContactChangeInfo::ContactChangeInfo(const ContactChangeInfo& rhs)
43 {
44         __pContactChangeInfoImpl = new (std::nothrow) _ContactChangeInfoImpl(*rhs.__pContactChangeInfoImpl);
45         SysTryReturnVoidResult(NID_SCL, __pContactChangeInfoImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
46 }
47
48 ContactChangeInfo::~ContactChangeInfo(void)
49 {
50         delete __pContactChangeInfoImpl;
51 }
52
53 ContactChangeInfo&
54 ContactChangeInfo::operator =(const ContactChangeInfo& rhs)
55 {
56         if (this == &rhs)
57         {
58                 return *this;
59         }
60
61         *__pContactChangeInfoImpl = *rhs.__pContactChangeInfoImpl;
62
63         return *this;
64 }
65
66 bool
67 ContactChangeInfo::Equals(const Object& rhs) const
68 {
69         const ContactChangeInfo* pContactChangeInfo = dynamic_cast<const ContactChangeInfo*>(&rhs);
70         if (pContactChangeInfo == null)
71         {
72                 return false;
73         }
74
75         return *__pContactChangeInfoImpl == *pContactChangeInfo->__pContactChangeInfoImpl;
76 }
77
78 int
79 ContactChangeInfo::GetHashCode(void) const
80 {
81         return __pContactChangeInfoImpl->GetHashCode();
82 }
83
84 AddressbookId
85 ContactChangeInfo::GetAddressbookId(void) const
86 {
87         return __pContactChangeInfoImpl->GetAddressbookId();
88 }
89
90 RecordId
91 ContactChangeInfo::GetContactId(void) const
92 {
93         return __pContactChangeInfoImpl->GetContactId();
94 }
95
96 int
97 ContactChangeInfo::GetVersion(void) const
98 {
99         return __pContactChangeInfoImpl->GetVersion();
100 }
101
102 RecordChangeType
103 ContactChangeInfo::GetChangeType(void) const
104 {
105         return __pContactChangeInfoImpl->GetChangeType();
106 }
107
108 bool
109 ContactChangeInfo::IsThumbnailChanged(void) const
110 {
111         return __pContactChangeInfoImpl->IsThumbnailChanged();
112 }
113
114 }} // Tizen::Social