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 FScl_UserProfileImpl.h
19 * @brief This is the header file for the _UserProfileImpl class.
21 * This header file contains the declarations of the _UserProfileImpl class.
23 #ifndef _FSCL_INTERNAL_USER_PROFILE_H_
24 #define _FSCL_INTERNAL_USER_PROFILE_H_
27 #include <unique_ptr.h>
28 #include <FBaseResult.h>
29 #include <FBaseObject.h>
30 #include <FBaseString.h>
31 #include <FBaseColAllElementsDeleter.h>
33 namespace Tizen { namespace Base
44 namespace Tizen { namespace Social
58 * @class _UserProfileImpl
59 * @brief This class provides a contact.
64 class _UserProfileImpl
65 : public Tizen::Base::Object
70 * This is the default constructor for this class.
74 _UserProfileImpl(void);
77 * Copying of objects using this copy constructor is allowed.
81 * @param[in] rhs An instance of %UserProfile
83 _UserProfileImpl(const _UserProfileImpl& rhs);
86 * This destructor overrides Tizen::Social::Object::~Object().
91 virtual ~_UserProfileImpl(void);
94 * Checks whether the value of the specified instance is equal to the value of the current instance of Tizen::Base::Object.
98 * @return @c true if the value of the specified instance of Tizen::Base::Object is equal to the value of the current instance of %Tizen::Base::Object, @n
100 * @param[in] rhs An instance of Tizen::Base::Object to compare
102 virtual bool Equals(const Tizen::Base::Object& rhs) const;
105 * Gets the hash value of the current instance.
109 * @return The hash value of the current instance
111 virtual int GetHashCode(void) const;
114 * Gets the thumbnail path
118 * @return The file path of the thumbnail
119 * @remarks If the thumbnail has not been set, an empty string is returned.
121 Tizen::Base::String GetThumbnailPath(void) const;
124 * Sets the thumbnail image. @n
125 * If the specified @c filePath is an empty string, the current thumbnail image is removed.
129 * @return An error code
130 * @param[in] filePath The file path of the thumbnail image
131 * @exception E_SUCCESS The method is successful.
132 * @exception E_INVALID_ARG The length of the specified @c filePath exceeds system limitations.
133 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
134 * @exception E_SYSTEM A system error has occurred.
135 * @see GetThumbnailPath()
137 result SetThumbnail(const Tizen::Base::String& filePath);
140 * Sets the value of the property having the specified ID to the specified value.
143 * @return An error code
144 * @param[in] id The ID of the property whose value is to set
145 * @param[in] value A new string value to set
146 * @exception E_SUCCESS The method is successful.
147 * @exception E_INVALID_ARG The specified property is read-only.
150 result SetValue(UserProfilePropertyId id, const Tizen::Base::String& value);
153 * Gets the value of the specified property.
157 * @return The property value
158 * @param[in] id The property ID
160 Tizen::Base::String GetValue(UserProfilePropertyId id) const;
163 * Sets the specified phone number at the specified index.
167 * @return An error code
168 * @param[in] index An index to set the value
169 * @param[in] phoneNumber An instance of PhoneNumber to set.
170 * @exception E_SUCCESS The method is successful.
171 * @exception E_INVALID_ARG The specified @c phoneNumber is empty.
172 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
174 result SetPhoneNumberAt(int index, const PhoneNumber& phoneNumber);
177 * Sets the specified email corresponding to the specified index.
181 * @return An error code
182 * @param[in] index An index to set the value
183 * @param[in] email An instance of Email
184 * @exception E_SUCCESS The method is successful.
185 * @exception E_INVALID_ARG The specified @c email is empty.
186 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
188 result SetEmailAt(int index, const Email& email);
191 * Sets the specified URL corresponding to the specified index.
195 * @return An error code
196 * @param[in] index An index to set the value
197 * @param[in] url An instance of Url
198 * @exception E_SUCCESS The method is successful.
199 * @exception E_INVALID_ARG The specified @c url is empty.
200 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
202 result SetUrlAt(int index, const Url& url);
205 * Sets the specified address corresponding to the specified index.
209 * @return An error code
210 * @param[in] index An index to set the value
211 * @param[in] address An instance of Address
212 * @exception E_SUCCESS The method is successful.
213 * @exception E_INVALID_ARG The specified @c address is empty.
214 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
216 result SetAddressAt(int index, const Address& address);
219 * Sets the specified ImAddress corresponding to the specified index.
223 * @return An error code
224 * @param[in] index An index to set the value
225 * @param[in] imAddress An instance of ImAddress
226 * @exception E_SUCCESS The method is successful.
227 * @exception E_INVALID_ARG The specified @c imAddress is empty.
228 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
230 result SetImAddressAt(int index, const ImAddress& imAddress);
233 * Sets the specified note corresponding to the specified index.
237 * @return An error code
238 * @param[in] index An index to set the value
239 * @param[in] note The note to set
240 * @exception E_SUCCESS The method is successful.
241 * @exception E_INVALID_ARG The specified @c note is empty.
242 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
244 result SetNoteAt(int index, const Tizen::Base::String& note);
247 * Sets the specified nick name corresponding to the specified index.
251 * @return An error code
252 * @param[in] index An index to set the value
253 * @param[in] nickname The nick name to set
254 * @exception E_SUCCESS The method is successful.
255 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
257 result SetNicknameAt(int index, const Tizen::Base::String& nickname);
260 * Sets the specified event corresponding to the specified index.
264 * @return An error code
265 * @param[in] index An index to set the value
266 * @param[in] event The event to set
267 * @exception E_SUCCESS The method is successful.
268 * @exception E_INVALID_ARG The specified @c event is empty.
269 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
271 result SetEventAt(int index, const ContactEvent& event);
274 * Sets the specified organization corresponding to the specified index.
278 * @return An error code
279 * @param[in] index An index to set the value
280 * @param[in] organization The organization to set
281 * @exception E_SUCCESS The method is successful.
282 * @exception E_INVALID_ARG The specified @c organization is empty.
283 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
285 result SetOrganizationAt(int index, const Organization& organization);
288 * Sets the specified relationship corresponding to the specified index.
292 * @return An error code
293 * @param[in] index An index to set the value
294 * @param[in] relationship The relationship to set
295 * @exception E_SUCCESS The method is successful.
296 * @exception E_INVALID_ARG The specified @c relationship is empty.
297 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
299 result SetRelationshipAt(int index, const Relationship& relationship);
302 * Gets the addressbook ID.
306 * @return The addressbook ID
308 AddressbookId GetAddressbookId(void) const;
311 * Gets a list of the values belonging to the specific multi value property.
315 * @return A list of the values belonging to the specific multi value property
316 * @param[in] id A property ID
317 * @exception E_SUCCESS The method is successful.
318 * @exception E_OUT_OF_MEMORY The memory is insufficient.
319 * @remarks The specific error code can be accessed using the GetLastResult() method.
321 Tizen::Base::Collection::IList* GetValuesN(UserProfileMultiPropertyId id) const;
324 * Adds the specified phone number to the user profile..
328 * @return An error code
329 * @param[in] phoneNumber The phone number to add
330 * @exception E_SUCCESS The method is successful.
331 * @exception E_INVALID_ARG The specified @c phoneNumber is empty.
333 result AddPhoneNumber(const PhoneNumber& phoneNumber);
336 * Adds the specified email to the user profile..
340 * @return An error code
341 * @param[in] email The mail address to add
342 * @exception E_SUCCESS The method is successful.
343 * @exception E_INVALID_ARG The specified @c email is empty.
345 result AddEmail(const Email& email);
348 * Adds the specified URL to the user profile..
352 * @return An error code
353 * @param[in] url The URL to add
354 * @exception E_SUCCESS The method is successful.
355 * @exception E_INVALID_ARG The specified @c url is empty.
358 result AddUrl(const Url& url);
361 * Adds the specified address to the user profile..
365 * @return An error code
366 * @param[in] address The address to add
367 * @exception E_SUCCESS The method is successful.
368 * @exception E_INVALID_ARG The specified @c address is empty.
370 result AddAddress(const Address& address);
373 * Adds the specified instant message information to the user profile.
377 * @return An error code
378 * @param[in] imAddress The IM address to add
379 * @exception E_SUCCESS The method is successful.
380 * @exception E_INVALID_ARG The specified @c imAddress is empty.
382 result AddImAddress(const ImAddress& imAddress);
385 * Adds the specified note to the user profile..
389 * @return An error code
390 * @param[in] note The note to add
391 * @exception E_SUCCESS The method is successful.
392 * @exception E_INVALID_ARG The specified @c note is empty.
394 result AddNote(const Tizen::Base::String& note);
397 * Adds the specified nick name to the user profile.
401 * @return An error code
402 * @param[in] nickname The nick name to add
403 * @exception E_SUCCESS The method is successful.
404 * @exception E_INVALID_ARG The specified @c nickname is empty.
406 result AddNickname(const Tizen::Base::String& nickname);
409 * Adds the specified event to the user profile..
413 * @return An error code
414 * @param[in] event The event to add
415 * @exception E_SUCCESS The method is successful.
416 * @exception E_INVALID_ARG The specified @c event is empty.
418 result AddEvent(const ContactEvent& event);
421 * Adds the specified organization to the contact.
425 * @return An error code
426 * @param[in] organization The organization to add
427 * @exception E_SUCCESS The method is successful.
428 * @exception E_INVALID_ARG The specified @c organization is empty.
430 result AddOrganization(const Organization& organization);
433 * Adds the specified relationship to the user profile.
437 * @return An error code
438 * @param[in] relationship The relationship to add
439 * @exception E_SUCCESS The method is successful.
440 * @exception E_INVALID_ARG The specified @c organization is empty.
442 result AddRelationship(const Relationship& relationship);
445 * Removes the specific value at the specified index of the multi value property.
449 * @return An error code
450 * @param[in] id A property ID
451 * @param[in] index The index of the value to remove
452 * @exception E_SUCCESS The method is successful.
453 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
455 result RemoveAt(UserProfileMultiPropertyId id, int index);
457 void SetUserProfileHandle(contacts_record_h profileHandle);
459 contacts_record_h GetUserProfileHandle(void) const;
461 bool IsEmpty(void) const;
463 static const _UserProfileImpl* GetInstance(const UserProfile& userProfile);
464 static _UserProfileImpl* GetInstance(UserProfile& userProfile);
467 * Copying of objects using this copy assignment operator is allowed.
471 * @param[in] rhs An instance of %UserProfile
473 _UserProfileImpl& operator =(const _UserProfileImpl& rhs);
476 bool IsEmptyName(contacts_record_h nameHandle);
477 bool IsEmptyCompany(contacts_record_h companyHandle);
479 Tizen::Base::Collection::IList* GetPhoneNumbersN(void) const;
480 Tizen::Base::Collection::IList* GetEmailsN(void) const;
481 Tizen::Base::Collection::IList* GetUrlsN(void) const;
482 Tizen::Base::Collection::IList* GetAddressesN(void) const;
483 Tizen::Base::Collection::IList* GetImAddressesN(void) const;
484 Tizen::Base::Collection::IList* GetOrganizationsN(void) const;
485 Tizen::Base::Collection::IList* GetRelationshipsN(void) const;
486 Tizen::Base::Collection::IList* GetEventsN(void) const;
487 Tizen::Base::Collection::IList* GetNotesN(void) const;
488 Tizen::Base::Collection::IList* GetNicknamesN(void) const;
491 contacts_record_h __profileHandle;
493 }; // _UserProfileImpl
497 #endif //_FSCL_INTERNAL_USER_PROFILE_H_