2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FSclAttendee.cpp
18 * @brief This is the implementation for Attendee class.
20 * This file contains definitions of @e Attendee class.
23 #include <FSclAttendee.h>
24 #include <FBaseResult.h>
25 #include <FBaseSysLog.h>
26 #include <FApp_AppInfo.h>
28 using namespace Tizen::Base;
29 using namespace Tizen::App;
31 namespace Tizen { namespace Social
34 Attendee::Attendee(const String& email)
36 , __attendeeRole(ATTENDEE_ROLE_ATTENDEE)
37 , __attendeeStatus(ATTENDEE_STATUS_NONE)
38 , __pAttendeeImpl(null)
39 , __personId(INVALID_RECORD_ID)
44 Attendee::Attendee(const Attendee& rhs)
46 , __email(rhs.__email)
47 , __phoneNumber(rhs.__phoneNumber)
48 , __attendeeRole(rhs.__attendeeRole)
49 , __attendeeStatus(rhs.__attendeeStatus)
50 , __pAttendeeImpl(null)
51 , __personId(rhs.__personId)
56 Attendee::~Attendee(void)
62 Attendee::operator =(const Attendee& rhs)
70 __email = rhs.__email;
71 __phoneNumber = rhs.__phoneNumber;
72 __attendeeRole = rhs.__attendeeRole;
73 __attendeeStatus = rhs.__attendeeStatus;
74 __personId = rhs.__personId;
80 Attendee::operator ==(const Attendee& rhs) const
82 if ((__name == rhs.__name) &&
83 (__email == rhs.__email) &&
84 (__phoneNumber == rhs.__phoneNumber) &&
85 (__attendeeRole == rhs.__attendeeRole) &&
86 (__attendeeStatus == rhs.__attendeeStatus) &&
87 (__personId == rhs.__personId))
96 Attendee::operator !=(const Attendee& rhs) const
98 return !(*this == rhs);
102 Attendee::Equals(const Object& rhs) const
104 const Attendee* pAttendee = dynamic_cast<const Attendee*>(&rhs);
106 if (pAttendee == null)
111 return (*this == *pAttendee);
115 Attendee::GetHashCode(void) const
119 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __name.GetHashCode();
120 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __email.GetHashCode();
121 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __phoneNumber.GetHashCode();
122 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __attendeeRole;
123 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __attendeeStatus;
124 hashCode = ( hashCode << 4 ) ^ ( hashCode >> 28 ) ^ __personId;
130 Attendee::GetName(void) const
136 Attendee::GetEmail(void) const
142 Attendee::GetRole(void) const
144 return __attendeeRole;
148 Attendee::GetStatus(void) const
150 return __attendeeStatus;
154 Attendee::SetName(const String& name)
156 SysTryReturnResult(NID_SCL, !name.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. The name is empty.");
158 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
160 SysTryReturnResult(NID_SCL, name.GetLength() <= MAX_ATTENDEE_NAME_LENGTH,
161 E_INVALID_ARG, "Invalid argument is used. The length of the name exceeds MAX_ATTENDEE_NAME_LENGTH.");
170 Attendee::SetEmail(const String& email)
172 SysTryReturnResult(NID_SCL, !email.IsEmpty(), E_INVALID_ARG, "Invalid argument is used. The email is empty.");
174 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
176 SysTryReturnResult(NID_SCL, email.GetLength() <= MAX_ATTENDEE_EMAIL_LENGTH,
177 E_INVALID_ARG, "Invalid argument is used. The length of the email exceeds MAX_ATTENDEE_EMAIL_LENGTH.");
186 Attendee::SetRole(AttendeeRole role)
190 case ATTENDEE_ROLE_ATTENDEE:
192 case ATTENDEE_ROLE_REQUIRED_ATTENDEE:
194 case ATTENDEE_ROLE_ORGANIZER:
195 __attendeeRole = role;
198 __attendeeRole = ATTENDEE_ROLE_ATTENDEE;
204 Attendee::SetStatus(AttendeeStatus status)
208 case ATTENDEE_STATUS_NONE:
210 case ATTENDEE_STATUS_NOT_RESPONDED:
212 case ATTENDEE_STATUS_ACCEPTED:
214 case ATTENDEE_STATUS_DECLINED:
216 case ATTENDEE_STATUS_TENTATIVE:
217 __attendeeStatus = status;
220 __attendeeStatus = ATTENDEE_STATUS_NONE;
226 Attendee::SetPhoneNumber(const String& phoneNumber)
228 __phoneNumber = phoneNumber;
232 Attendee::GetPhoneNumber(void) const
234 return __phoneNumber;
238 Attendee::SetPersonId(PersonId personId)
240 __personId = personId;
244 Attendee::GetPersonId(void) const