Modify the spec file for secure log
[framework/osp/social.git] / src / FScl_ReminderImpl.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_ReminderImpl.cpp
18  * @brief               This is the implementation for _ReminderImpl class.
19  *
20  * This file contains definitions of @e _ReminderImpl class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FBaseDateTime.h>
25 #include <FSclReminder.h>
26 #include "FScl_CalendarbookUtil.h"
27 #include "FScl_ReminderImpl.h"
28
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31
32 namespace Tizen { namespace Social
33 {
34
35 _ReminderImpl::_ReminderImpl(void)
36 {
37 }
38
39 _ReminderImpl::_ReminderImpl(const _ReminderImpl& rhs)
40         : __absoluteTime(rhs.__absoluteTime)
41         , __isAbsolute(false)
42 {
43 }
44
45 _ReminderImpl::~_ReminderImpl(void)
46 {
47 }
48
49 _ReminderImpl&
50 _ReminderImpl::operator =(const _ReminderImpl& rhs)
51 {
52         if (this == &rhs)
53         {
54                 return *this;
55         }
56
57         __absoluteTime = rhs.__absoluteTime;
58         __isAbsolute = rhs.__isAbsolute;
59
60         return *this;
61 }
62
63 bool
64 _ReminderImpl::Equals(const Object& rhs) const
65 {
66         const _ReminderImpl* pReminderImpl = dynamic_cast<const _ReminderImpl*>(&rhs);
67
68         if (pReminderImpl == null)
69         {
70                 return false;
71         }
72
73         return (__absoluteTime.Equals(pReminderImpl->__absoluteTime) && __isAbsolute == pReminderImpl->__isAbsolute);
74 }
75
76 int
77 _ReminderImpl::GetHashCode(void) const
78 {
79         int hashCode = 17;
80
81         hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __absoluteTime.GetHashCode();
82         hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __isAbsolute;
83
84         return hashCode;
85 }
86
87 result
88 _ReminderImpl::SetAbsoluteTime(const DateTime& time)
89 {
90         SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(time), E_INVALID_ARG, "Invalid argument is used. time = %S", time.ToString().GetPointer());
91
92         __absoluteTime = time;
93         __isAbsolute = true;
94
95         return E_SUCCESS;
96 }
97
98 DateTime
99 _ReminderImpl::GetAbsoluteTime(void) const
100 {
101         return __absoluteTime;
102 }
103
104 bool
105 _ReminderImpl::IsAbsolute(void) const
106 {
107         return __isAbsolute;
108 }
109
110 _ReminderImpl*
111 _ReminderImpl::GetInstance(Reminder& reminder)
112 {
113         return reminder.__pReminderImpl;
114 }
115
116 const _ReminderImpl*
117 _ReminderImpl::GetInstance(const Reminder& reminder)
118 {
119         return reminder.__pReminderImpl;
120 }
121
122 }}      // Tizen::Social