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