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