Merge "Fixed exception handling codes" into tizen_2.1
[framework/osp/social.git] / src / FSclContactEvent.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         FSclContactEvent.cpp
19 * @brief        This is the implementation for ContactEvent class.
20 *
21 * This file contains definitions of @e ContactEvent class.
22 */
23
24 #include <FSclContactEvent.h>
25 #include <FBaseSysLog.h>
26 #include "FScl_ContactEventImpl.h"
27
28 using namespace Tizen::Base;
29
30 namespace Tizen { namespace Social
31 {
32
33 ContactEvent::ContactEvent(void)
34 {
35         __pContactEventImpl = new (std::nothrow) _ContactEventImpl();
36         SysTryReturnVoidResult(NID_SCL, __pContactEventImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
37 }
38
39 ContactEvent::ContactEvent(const ContactEvent& rhs)
40 {
41         __pContactEventImpl = new (std::nothrow) _ContactEventImpl(*rhs.__pContactEventImpl);
42         SysTryReturnVoidResult(NID_SCL, __pContactEventImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
43 }
44
45 ContactEvent::~ContactEvent(void)
46 {
47         delete __pContactEventImpl;
48 }
49
50 ContactEvent&
51 ContactEvent::operator =(const ContactEvent& rhs)
52 {
53         if (this == &rhs)
54         {
55                 return *this;
56         }
57
58         *__pContactEventImpl = *rhs.__pContactEventImpl;
59
60         return *this;
61 }
62
63 bool
64 ContactEvent::operator ==(const ContactEvent& rhs) const
65 {
66         return *__pContactEventImpl == *rhs.__pContactEventImpl;
67 }
68
69 bool
70 ContactEvent::operator !=(const ContactEvent& rhs) const
71 {
72         return !(*this == rhs);
73 }
74
75 bool
76 ContactEvent::Equals(const Object& rhs) const
77 {
78         const ContactEvent* pContactEvent = dynamic_cast<const ContactEvent*>(&rhs);
79         if (pContactEvent == null)
80         {
81                 return false;
82         }
83
84         return __pContactEventImpl->Equals(*pContactEvent->__pContactEventImpl);
85 }
86
87 int
88 ContactEvent::GetHashCode(void) const
89 {
90         return __pContactEventImpl->GetHashCode();
91 }
92
93 ContactEventType
94 ContactEvent::GetType(void) const
95 {
96         return __pContactEventImpl->GetType();
97 }
98
99 DateTime
100 ContactEvent::GetDate(void) const
101 {
102         return __pContactEventImpl->GetDate();
103 }
104
105 String
106 ContactEvent::GetLabel(void) const
107 {
108         return __pContactEventImpl->GetLabel();
109 }
110
111 void
112 ContactEvent::SetType(ContactEventType type)
113 {
114         __pContactEventImpl->SetType(type);
115 }
116
117 void
118 ContactEvent::SetDate(const DateTime& date)
119 {
120         __pContactEventImpl->SetDate(date);
121 }
122
123 void
124 ContactEvent::SetLabel(const String& label)
125 {
126         __pContactEventImpl->SetLabel(label);
127 }
128
129 }} // Tizen::Social