2 // Copyright (c) 2013 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 FScl_UserProfileImpl.h
18 * @brief This is the header file for the _UserProfileImpl class.
20 * This header file contains the declarations of the _UserProfileImpl class.
22 #ifndef _FSCL_INTERNAL_USER_PROFILE_H_
23 #define _FSCL_INTERNAL_USER_PROFILE_H_
26 #include <unique_ptr.h>
27 #include <FBaseResult.h>
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FBaseColAllElementsDeleter.h>
32 namespace Tizen { namespace Base
43 namespace Tizen { namespace Social
57 * @class _UserProfileImpl
58 * @brief This class provides a contact.
63 class _UserProfileImpl
64 : public Tizen::Base::Object
69 * This is the default constructor for this class.
73 _UserProfileImpl(void);
76 * Copying of objects using this copy constructor is allowed.
80 * @param[in] rhs An instance of %UserProfile
82 _UserProfileImpl(const _UserProfileImpl& rhs);
85 * This destructor overrides Tizen::Social::Object::~Object().
90 virtual ~_UserProfileImpl(void);
93 * Checks whether the value of the specified instance is equal to the value of the current instance of Tizen::Base::Object.
97 * @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
99 * @param[in] rhs An instance of Tizen::Base::Object to compare
101 virtual bool Equals(const Tizen::Base::Object& rhs) const;
104 * Gets the hash value of the current instance.
108 * @return The hash value of the current instance
110 virtual int GetHashCode(void) const;
113 * Gets the thumbnail path
117 * @return The file path of the thumbnail
118 * @remarks If the thumbnail has not been set, an empty string is returned.
120 Tizen::Base::String GetThumbnailPath(void) const;
123 * Sets the thumbnail image. @n
124 * If the specified @c filePath is an empty string, the current thumbnail image is removed.
128 * @return An error code
129 * @param[in] filePath The file path of the thumbnail image
130 * @exception E_SUCCESS The method is successful.
131 * @exception E_INVALID_ARG The length of the specified @c filePath exceeds system limitations.
132 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
133 * @exception E_SYSTEM A system error has occurred.
134 * @see GetThumbnailPath()
136 result SetThumbnail(const Tizen::Base::String& filePath);
139 * Sets the value of the property having the specified ID to the specified value.
142 * @return An error code
143 * @param[in] id The ID of the property whose value is to set
144 * @param[in] value A new string value to set
145 * @exception E_SUCCESS The method is successful.
146 * @exception E_INVALID_ARG The specified property is read-only.
149 result SetValue(UserProfilePropertyId id, const Tizen::Base::String& value);
152 * Gets the value of the specified property.
156 * @return The property value
157 * @param[in] id The property ID
159 Tizen::Base::String GetValue(UserProfilePropertyId id) const;
162 * Sets the specified phone number at the specified index.
166 * @return An error code
167 * @param[in] index An index to set the value
168 * @param[in] phoneNumber An instance of PhoneNumber to set.
169 * @exception E_SUCCESS The method is successful.
170 * @exception E_INVALID_ARG The specified @c phoneNumber is empty.
171 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
173 result SetPhoneNumberAt(int index, const PhoneNumber& phoneNumber);
176 * Sets the specified email corresponding to the specified index.
180 * @return An error code
181 * @param[in] index An index to set the value
182 * @param[in] email An instance of Email
183 * @exception E_SUCCESS The method is successful.
184 * @exception E_INVALID_ARG The specified @c email is empty.
185 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
187 result SetEmailAt(int index, const Email& email);
190 * Sets the specified URL corresponding to the specified index.
194 * @return An error code
195 * @param[in] index An index to set the value
196 * @param[in] url An instance of Url
197 * @exception E_SUCCESS The method is successful.
198 * @exception E_INVALID_ARG The specified @c url is empty.
199 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
201 result SetUrlAt(int index, const Url& url);
204 * Sets the specified address corresponding to the specified index.
208 * @return An error code
209 * @param[in] index An index to set the value
210 * @param[in] address An instance of Address
211 * @exception E_SUCCESS The method is successful.
212 * @exception E_INVALID_ARG The specified @c address is empty.
213 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
215 result SetAddressAt(int index, const Address& address);
218 * Sets the specified ImAddress corresponding to the specified index.
222 * @return An error code
223 * @param[in] index An index to set the value
224 * @param[in] imAddress An instance of ImAddress
225 * @exception E_SUCCESS The method is successful.
226 * @exception E_INVALID_ARG The specified @c imAddress is empty.
227 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
229 result SetImAddressAt(int index, const ImAddress& imAddress);
232 * Sets the specified note corresponding to the specified index.
236 * @return An error code
237 * @param[in] index An index to set the value
238 * @param[in] note The note to set
239 * @exception E_SUCCESS The method is successful.
240 * @exception E_INVALID_ARG The specified @c note is empty.
241 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
243 result SetNoteAt(int index, const Tizen::Base::String& note);
246 * Sets the specified nick name corresponding to the specified index.
250 * @return An error code
251 * @param[in] index An index to set the value
252 * @param[in] nickname The nick name to set
253 * @exception E_SUCCESS The method is successful.
254 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
256 result SetNicknameAt(int index, const Tizen::Base::String& nickname);
259 * Sets the specified event corresponding to the specified index.
263 * @return An error code
264 * @param[in] index An index to set the value
265 * @param[in] event The event to set
266 * @exception E_SUCCESS The method is successful.
267 * @exception E_INVALID_ARG The specified @c event is empty.
268 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
270 result SetEventAt(int index, const ContactEvent& event);
273 * Sets the specified organization corresponding to the specified index.
277 * @return An error code
278 * @param[in] index An index to set the value
279 * @param[in] organization The organization to set
280 * @exception E_SUCCESS The method is successful.
281 * @exception E_INVALID_ARG The specified @c organization is empty.
282 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
284 result SetOrganizationAt(int index, const Organization& organization);
287 * Sets the specified relationship corresponding to the specified index.
291 * @return An error code
292 * @param[in] index An index to set the value
293 * @param[in] relationship The relationship to set
294 * @exception E_SUCCESS The method is successful.
295 * @exception E_INVALID_ARG The specified @c relationship is empty.
296 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
298 result SetRelationshipAt(int index, const Relationship& relationship);
301 * Gets the addressbook ID.
305 * @return The addressbook ID
307 AddressbookId GetAddressbookId(void) const;
310 * Gets a list of the values belonging to the specific multi value property.
314 * @return A list of the values belonging to the specific multi value property
315 * @param[in] id A property ID
316 * @exception E_SUCCESS The method is successful.
317 * @exception E_OUT_OF_MEMORY The memory is insufficient.
318 * @remarks The specific error code can be accessed using the GetLastResult() method.
320 Tizen::Base::Collection::IList* GetValuesN(UserProfileMultiPropertyId id) const;
323 * Adds the specified phone number to the user profile..
327 * @return An error code
328 * @param[in] phoneNumber The phone number to add
329 * @exception E_SUCCESS The method is successful.
330 * @exception E_INVALID_ARG The specified @c phoneNumber is empty.
332 result AddPhoneNumber(const PhoneNumber& phoneNumber);
335 * Adds the specified email to the user profile..
339 * @return An error code
340 * @param[in] email The mail address to add
341 * @exception E_SUCCESS The method is successful.
342 * @exception E_INVALID_ARG The specified @c email is empty.
344 result AddEmail(const Email& email);
347 * Adds the specified URL to the user profile..
351 * @return An error code
352 * @param[in] url The URL to add
353 * @exception E_SUCCESS The method is successful.
354 * @exception E_INVALID_ARG The specified @c url is empty.
357 result AddUrl(const Url& url);
360 * Adds the specified address to the user profile..
364 * @return An error code
365 * @param[in] address The address to add
366 * @exception E_SUCCESS The method is successful.
367 * @exception E_INVALID_ARG The specified @c address is empty.
369 result AddAddress(const Address& address);
372 * Adds the specified instant message information to the user profile.
376 * @return An error code
377 * @param[in] imAddress The IM address to add
378 * @exception E_SUCCESS The method is successful.
379 * @exception E_INVALID_ARG The specified @c imAddress is empty.
381 result AddImAddress(const ImAddress& imAddress);
384 * Adds the specified note to the user profile..
388 * @return An error code
389 * @param[in] note The note to add
390 * @exception E_SUCCESS The method is successful.
391 * @exception E_INVALID_ARG The specified @c note is empty.
393 result AddNote(const Tizen::Base::String& note);
396 * Adds the specified nick name to the user profile.
400 * @return An error code
401 * @param[in] nickname The nick name to add
402 * @exception E_SUCCESS The method is successful.
403 * @exception E_INVALID_ARG The specified @c nickname is empty.
405 result AddNickname(const Tizen::Base::String& nickname);
408 * Adds the specified event to the user profile..
412 * @return An error code
413 * @param[in] event The event to add
414 * @exception E_SUCCESS The method is successful.
415 * @exception E_INVALID_ARG The specified @c event is empty.
417 result AddEvent(const ContactEvent& event);
420 * Adds the specified organization to the contact.
424 * @return An error code
425 * @param[in] organization The organization to add
426 * @exception E_SUCCESS The method is successful.
427 * @exception E_INVALID_ARG The specified @c organization is empty.
429 result AddOrganization(const Organization& organization);
432 * Adds the specified relationship to the user profile.
436 * @return An error code
437 * @param[in] relationship The relationship to add
438 * @exception E_SUCCESS The method is successful.
439 * @exception E_INVALID_ARG The specified @c organization is empty.
441 result AddRelationship(const Relationship& relationship);
444 * Removes the specific value at the specified index of the multi value property.
448 * @return An error code
449 * @param[in] id A property ID
450 * @param[in] index The index of the value to remove
451 * @exception E_SUCCESS The method is successful.
452 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the properties.
454 result RemoveAt(UserProfileMultiPropertyId id, int index);
456 void SetUserProfileHandle(contacts_record_h profileHandle);
458 contacts_record_h GetUserProfileHandle(void) const;
460 bool IsEmpty(void) const;
462 static const _UserProfileImpl* GetInstance(const UserProfile& userProfile);
463 static _UserProfileImpl* GetInstance(UserProfile& userProfile);
466 * Copying of objects using this copy assignment operator is allowed.
470 * @param[in] rhs An instance of %UserProfile
472 _UserProfileImpl& operator =(const _UserProfileImpl& rhs);
475 bool IsEmptyName(contacts_record_h nameHandle);
476 bool IsEmptyCompany(contacts_record_h companyHandle);
478 Tizen::Base::Collection::IList* GetPhoneNumbersN(void) const;
479 Tizen::Base::Collection::IList* GetEmailsN(void) const;
480 Tizen::Base::Collection::IList* GetUrlsN(void) const;
481 Tizen::Base::Collection::IList* GetAddressesN(void) const;
482 Tizen::Base::Collection::IList* GetImAddressesN(void) const;
483 Tizen::Base::Collection::IList* GetOrganizationsN(void) const;
484 Tizen::Base::Collection::IList* GetRelationshipsN(void) const;
485 Tizen::Base::Collection::IList* GetEventsN(void) const;
486 Tizen::Base::Collection::IList* GetNotesN(void) const;
487 Tizen::Base::Collection::IList* GetNicknamesN(void) const;
490 contacts_record_h __profileHandle;
492 }; // _UserProfileImpl
496 #endif //_FSCL_INTERNAL_USER_PROFILE_H_