Modify the spec file for secure log
[framework/osp/social.git] / src / FScl_ContactEventImpl.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17 * @file         FScl_ContactEventImpl.cpp
18 * @brief        This is the implementation for _ContactEventImpl class.
19 *
20 * This file contains definitions of @e _ContactEventImpl class.
21 */
22
23 #include <FSclContactEvent.h>
24 #include <FBaseSysLog.h>
25 #include "FScl_ContactEventImpl.h"
26
27 using namespace Tizen::Base;
28
29 namespace Tizen { namespace Social
30 {
31
32 _ContactEventImpl::_ContactEventImpl(void)
33 : __type(CONTACT_EVENT_TYPE_BIRTHDAY)
34 , __isDateChanged(false)
35 {
36 }
37
38 _ContactEventImpl::_ContactEventImpl(const _ContactEventImpl& rhs)
39 {
40         __date = rhs.__date;
41         __type = rhs.__type;
42         __label = rhs.__label;
43         __isDateChanged = rhs.__isDateChanged;
44 }
45
46 _ContactEventImpl::~_ContactEventImpl(void)
47 {
48
49 }
50
51 _ContactEventImpl&
52 _ContactEventImpl::operator =(const _ContactEventImpl& rhs)
53 {
54         if (this == &rhs)
55         {
56                 return *this;
57         }
58
59         __date = rhs.__date;
60         __type = rhs.__type;
61         __label = rhs.__label;
62         __isDateChanged = rhs.__isDateChanged;
63
64         return *this;
65 }
66
67 bool
68 _ContactEventImpl::operator ==(const _ContactEventImpl& rhs) const
69 {
70         if (__date != rhs.__date)
71         {
72                 return false;
73         }
74
75         if (__type != rhs.__type)
76         {
77                 return false;
78         }
79
80         if (__label != rhs.__label)
81         {
82                 return false;
83         }
84
85         return true;
86 }
87
88 bool
89 _ContactEventImpl::operator !=(const _ContactEventImpl& rhs) const
90 {
91         return !(*this == rhs);
92 }
93
94 bool
95 _ContactEventImpl::Equals(const Object& rhs) const
96 {
97         const _ContactEventImpl* pContactEvent = dynamic_cast<const _ContactEventImpl*>(&rhs);
98         if (pContactEvent == null)
99         {
100                 return false;
101         }
102
103         return *this == *pContactEvent;
104 }
105
106 int
107 _ContactEventImpl::GetHashCode(void) const
108 {
109         int hash = __date.GetHashCode() + __label.GetHashCode() + __type;
110
111         return hash;
112 }
113
114 ContactEventType
115 _ContactEventImpl::GetType(void) const
116 {
117         return __type;
118 }
119
120 DateTime
121 _ContactEventImpl::GetDate(void) const
122 {
123         return __date;
124 }
125
126 String
127 _ContactEventImpl::GetLabel(void) const
128 {
129         return __label;
130 }
131
132 void
133 _ContactEventImpl::SetType(ContactEventType type)
134 {
135         __type = type;
136 }
137
138 void
139 _ContactEventImpl::SetDate(const DateTime& date)
140 {
141         __date = date;
142         __isDateChanged = true;
143 }
144
145 void
146 _ContactEventImpl::SetLabel(const String& label)
147 {
148         __label = label;
149 }
150
151 bool
152 _ContactEventImpl::IsDateChanged(void) const
153 {
154         return __isDateChanged;
155 }
156
157 const _ContactEventImpl*
158 _ContactEventImpl::GetInstance(const ContactEvent& contactEvent)
159 {
160         return contactEvent.__pContactEventImpl;
161 }
162
163 _ContactEventImpl*
164 _ContactEventImpl::GetInstance(ContactEvent& contactEvent)
165 {
166         return contactEvent.__pContactEventImpl;
167 }
168
169 }} // Tizen::Social