2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSclAttendee.cpp
19 * @brief This is the implementation for Attendee class.
21 * This file contains definitions of @e Attendee class.
24 #include <FSclAttendee.h>
25 #include <FBaseResult.h>
26 #include <FBaseSysLog.h>
27 #include <FApp_AppInfo.h>
29 using namespace Tizen::Base;
30 using namespace Tizen::App;
32 namespace Tizen { namespace Social
35 Attendee::Attendee(const String& email)
37 , __attendeeRole(ATTENDEE_ROLE_ATTENDEE)
38 , __attendeeStatus(ATTENDEE_STATUS_NONE)
39 , __pAttendeeImpl(null)
40 , __personId(INVALID_RECORD_ID)
45 Attendee::Attendee(const Attendee& rhs)
47 , __email(rhs.__email)
48 , __phoneNumber(rhs.__phoneNumber)
49 , __attendeeRole(rhs.__attendeeRole)
50 , __attendeeStatus(rhs.__attendeeStatus)
51 , __pAttendeeImpl(null)
52 , __personId(rhs.__personId)
57 Attendee::~Attendee(void)
63 Attendee::operator =(const Attendee& rhs)
71 __email = rhs.__email;
72 __phoneNumber = rhs.__phoneNumber;
73 __attendeeRole = rhs.__attendeeRole;
74 __attendeeStatus = rhs.__attendeeStatus;
75 __personId = rhs.__personId;
81 Attendee::operator ==(const Attendee& rhs) const
83 if ((__name == rhs.__name) &&
84 (__email == rhs.__email) &&
85 (__phoneNumber == rhs.__phoneNumber) &&
86 (__attendeeRole == rhs.__attendeeRole) &&
87 (__attendeeStatus == rhs.__attendeeStatus) &&
88 (__personId == rhs.__personId))
97 Attendee::operator !=(const Attendee& rhs) const
99 return !(*this == rhs);
103 Attendee::Equals(const Object& rhs) const
105 const Attendee* pAttendee = dynamic_cast<const Attendee*>(&rhs);
107 if (pAttendee == null)
112 return (*this == *pAttendee);
116 Attendee::GetHashCode(void) const
120 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __name.GetHashCode();
121 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __email.GetHashCode();
122 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __phoneNumber.GetHashCode();
123 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __attendeeRole;
124 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __attendeeStatus;
125 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __personId;
131 Attendee::GetName(void) const
137 Attendee::GetEmail(void) const
143 Attendee::GetRole(void) const
145 return __attendeeRole;
149 Attendee::GetStatus(void) const
151 return __attendeeStatus;
155 Attendee::SetName(const String& name)
157 SysTryReturnResult(NID_SCL, !name.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. The name is empty.");
159 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
161 SysTryReturnResult(NID_SCL, name.GetLength() <= MAX_ATTENDEE_NAME_LENGTH,
162 E_INVALID_ARG, "Invalid argument is used. The length of the name exceeds MAX_ATTENDEE_NAME_LENGTH.");
171 Attendee::SetEmail(const String& email)
173 SysTryReturnResult(NID_SCL, !email.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. The email is empty.");
175 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
177 SysTryReturnResult(NID_SCL, email.GetLength() <= MAX_ATTENDEE_EMAIL_LENGTH,
178 E_INVALID_ARG, "Invalid argument is used. The length of the email exceeds MAX_ATTENDEE_EMAIL_LENGTH.");
187 Attendee::SetRole(AttendeeRole role)
191 case ATTENDEE_ROLE_ATTENDEE:
193 case ATTENDEE_ROLE_REQUIRED_ATTENDEE:
195 case ATTENDEE_ROLE_ORGANIZER:
196 __attendeeRole = role;
199 __attendeeRole = ATTENDEE_ROLE_ATTENDEE;
205 Attendee::SetStatus(AttendeeStatus status)
209 case ATTENDEE_STATUS_NONE:
211 case ATTENDEE_STATUS_NOT_RESPONDED:
213 case ATTENDEE_STATUS_ACCEPTED:
215 case ATTENDEE_STATUS_DECLINED:
217 case ATTENDEE_STATUS_TENTATIVE:
218 __attendeeStatus = status;
221 __attendeeStatus = ATTENDEE_STATUS_NONE;
227 Attendee::SetPhoneNumber(const String& phoneNumber)
229 __phoneNumber = phoneNumber;
233 Attendee::GetPhoneNumber(void) const
235 return __phoneNumber;
239 Attendee::SetPersonId(PersonId personId)
241 __personId = personId;
245 Attendee::GetPersonId(void) const