Tizen 2.0 Release
[platform/framework/native/social.git] / src / FScl_ContactEventImpl.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         FScl_ContactEventImpl.cpp
19 * @brief        This is the implementation for _ContactEventImpl class.
20 *
21 * This file contains definitions of @e _ContactEventImpl 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 _ContactEventImpl::_ContactEventImpl(void)
34 {
35 }
36
37 _ContactEventImpl::_ContactEventImpl(const _ContactEventImpl& rhs)
38 {
39         __date = rhs.__date;
40         __type = rhs.__type;
41         __label = rhs.__label;
42 }
43
44 _ContactEventImpl::~_ContactEventImpl(void)
45 {
46
47 }
48
49 _ContactEventImpl&
50 _ContactEventImpl::operator =(const _ContactEventImpl& rhs)
51 {
52         if (this == &rhs)
53         {
54                 return *this;
55         }
56
57         __date = rhs.__date;
58         __type = rhs.__type;
59         __label = rhs.__label;
60
61         return *this;
62 }
63
64 bool
65 _ContactEventImpl::operator ==(const _ContactEventImpl& rhs) const
66 {
67         if (__date != rhs.__date)
68         {
69                 return false;
70         }
71
72         if (__type != rhs.__type)
73         {
74                 return false;
75         }
76
77         if (__label != rhs.__label)
78         {
79                 return false;
80         }
81
82         return true;
83 }
84
85 bool
86 _ContactEventImpl::operator !=(const _ContactEventImpl& rhs) const
87 {
88         return !(*this == rhs);
89 }
90
91 bool
92 _ContactEventImpl::Equals(const Object& rhs) const
93 {
94         const _ContactEventImpl* pContactEvent = dynamic_cast<const _ContactEventImpl*>(&rhs);
95         if (pContactEvent == null)
96         {
97                 return false;
98         }
99
100         return *this == *pContactEvent;
101 }
102
103 int
104 _ContactEventImpl::GetHashCode(void) const
105 {
106         int hash = __date.GetHashCode() + __label.GetHashCode() + __type;
107
108         return hash;
109 }
110
111 ContactEventType
112 _ContactEventImpl::GetType(void) const
113 {
114         return __type;
115 }
116
117 DateTime
118 _ContactEventImpl::GetDate(void) const
119 {
120         return __date;
121 }
122
123 String
124 _ContactEventImpl::GetLabel(void) const
125 {
126         return __label;
127 }
128
129 void
130 _ContactEventImpl::SetType(ContactEventType type)
131 {
132         __type = type;
133 }
134
135 void
136 _ContactEventImpl::SetDate(const DateTime& date)
137 {
138         __date = date;
139 }
140
141 void
142 _ContactEventImpl::SetLabel(const String& label)
143 {
144         __label = label;
145 }
146
147 const _ContactEventImpl*
148 _ContactEventImpl::GetInstance(const ContactEvent& contactEvent)
149 {
150         return contactEvent.__pContactEventImpl;
151 }
152
153 _ContactEventImpl*
154 _ContactEventImpl::GetInstance(ContactEvent& contactEvent)
155 {
156         return contactEvent.__pContactEventImpl;
157 }
158
159 }} // Tizen::Social