add % before the privilege tag not to link to the linkage page
[framework/osp/social.git] / inc / FSclPerson.h
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                FSclPerson.h
19  * @brief               This is the header file for the %Person class.
20  *
21  * This header file contains the declarations of the %Person class.
22  */
23 #ifndef _FSCL_PERSON_H_
24 #define _FSCL_PERSON_H_
25
26 #include <FBaseObject.h>
27 #include <FBaseString.h>
28 #include <FSclRecord.h>
29 #include <FSclTypes.h>
30 #include <FSclPhoneNumber.h>
31 #include <FSclEmail.h>
32
33 namespace Tizen { namespace Base
34 {
35 namespace Collection
36 {
37 template<typename Type>
38 class IListT;
39 }
40 } }
41
42 namespace Tizen { namespace Graphics
43 {
44 class Bitmap;
45 } }
46
47 namespace Tizen { namespace Social
48 {
49
50 /**
51  * @class      Person
52  * @brief      This class provides an aggregated contact information.
53  *
54  * @since       2.0
55  *
56  * @final      This class is not intended for extension.
57  *
58  * The %Person class provides an aggregated contact information of a person. @n 
59  * There can be more than one contact of the same person because contacts can be synchronized from multiple service providers. @n
60  * %Person has the following information of an individual. @n
61  * - Display name
62  * - Thumbnail
63  * - Ringtone 
64  * - Primary phone number
65  * - Primary email
66  *
67  * Each information is collected from contacts linked to the person. @n
68  *
69  * There is no explicit way to create a person. When a contact is added, the system creates a new person and links the contact to the person.
70  * It is possible to merge two persons into one or unlink a contact from a person.
71  */
72
73 class _OSP_EXPORT_ Person
74         : public Tizen::Base::Object
75 {
76 public:
77         /**
78          * This destructor overrides Tizen::Base::Object::~Object().
79          *
80          * @since       2.0
81          */
82         virtual ~Person(void);
83
84         /**
85          * Checks whether the value of the specified instance is equal to the value of the current instance of Tizen::Base::Object.
86          *
87          * @since       2.0
88          *
89          * @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
90          *                     else @c false
91          * @param[in]  rhs            An instance of Tizen::Base::Object to compare
92          */
93         virtual bool Equals(const Tizen::Base::Object& rhs) const;
94
95         /**
96          * Gets the hash value of the current instance.
97          *
98          * @since       2.0
99          *
100          * @return     The hash value of the current instance
101          */
102         virtual int GetHashCode(void) const;
103
104         /**
105          * Gets the display name.
106          *
107          * @since       2.0
108          *
109          * @return     The display name
110          */
111         Tizen::Base::String GetDisplayName(void) const;
112
113         /**
114          * Checks whether this is a favorite or not.
115          *
116          * @since       2.0
117          *
118          * @return     @c true if this is a favorite, @n
119          *              else @c false
120          * @see SetAsFavorite()
121          */
122         bool IsFavorite(void) const;
123
124         /**
125          * Gets the thumbnail path.
126          *
127          * @since       2.0
128          *
129          * @return     The file path of the thumbnail
130          * @remarks    If the thumbnail path has not been set, empty string is returned.
131          */
132         Tizen::Base::String GetThumbnailPath(void) const;
133
134         /**
135          * Gets the ringtone path.
136          *
137          * @since       2.0
138          *
139          * @return     The file path of the ringtone
140          * @remarks    If the ringtone path has not been set, empty string is returned.
141          */
142         Tizen::Base::String GetRingtonePath(void) const;
143
144         /**
145          * Checks whether this has phone numbers or not.
146          *
147          * @since       2.0
148          *
149          * @return     @c true if this has phone numbers, @n
150          *              else @c false
151          */
152         bool HasPhoneNumber(void) const;
153
154         /**
155          * Checks whether this has emails or not.
156          *
157          * @since       2.0
158          *
159          * @return     @c true if this has emails, @n
160          *              else @c false
161          */
162         bool HasEmail(void) const;
163
164         /**
165          * Gets the list of account ID of contacts linked to the person.
166          *
167          * @since       2.0
168          *
169          * @return     The account ID list
170          * @exception  E_SUCCESS              The method is successful.
171          * @exception  E_OUT_OF_MEMORY        The memory is insufficient.
172          * @exception  E_SYSTEM         The method cannot proceed due to a severe system error.
173          * @remarks    The specific error code can be accessed using the GetLastResult() method.
174          */
175         Tizen::Base::Collection::IListT<AccountId>* GetAccountIdsN(void) const;
176
177         /**
178          * Gets the ID of this person.
179          *
180          * @since       2.0
181          *
182          * @return      The person ID
183          */
184         PersonId GetId(void) const;
185
186         /**
187          * Sets whether this person is a favorite or not.
188          *
189          * @since       2.0
190          * @privlevel   public
191          * @privilege   %http://tizen.org/privilege/contact.write
192          *
193          * @return      An error code
194          * @param[in]   isFavorite    Set to @c true to set this person as a favorite, @n
195          *                            else @c false to set this person as non-favorite
196          * @exception   E_SUCCESS               The method is successful.
197          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
198          * @exception   E_SYSTEM      The method cannot proceed due to a severe system error.
199          * @see IsFavorite()
200          * @see AddressbookManager::GetFavoritePersonsN()
201          */
202         result SetAsFavorite(bool isFavorite = true);
203
204
205         /**
206          * Sets the specified phone number as the primary phone number of this person.
207          *
208          * @since       2.0
209          * @privlevel   public
210          * @privilege   %http://tizen.org/privilege/contact.write
211          *
212          * @return     An error code
213          * @param[in]  phoneNumber    The phone number
214          * @exception  E_SUCCESS      The method is successful.
215          * @exception  E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
216          * @exception  E_INVALID_ARG          The specified @c phoneNumber is invalid.
217          * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
218          * @see GetPrimaryPhoneNumber()
219          */
220         result SetAsPrimaryPhoneNumber(const PhoneNumber& phoneNumber);
221
222         /**
223          * Sets the specified email as the primary email of this person.
224          *
225          * @since       2.0
226          * @privlevel   public
227          * @privilege   %http://tizen.org/privilege/contact.write
228          *
229          * @return     An error code
230          * @param[in]  email          The email
231          * @exception  E_SUCCESS      The method is successful.
232          * @exception  E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
233          * @exception  E_INVALID_ARG          The specified @c phoneNumber is invalid.
234          * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
235          * @see GetPrimaryEmail()
236          */
237         result SetAsPrimaryEmail(const Email& email);
238
239         /**
240          * Gets the primary phone number of this person.
241          *
242          * @since       2.0
243          * @privlevel   public
244          * @privilege   %http://tizen.org/privilege/contact.read
245          *
246          * @return      The primary phone number @n If this instance does not have the primary email, an empty PhoneNumber instance is returned.
247          * @exception  E_SUCCESS                The method is successful.
248          * @exception  E_PRIVILEGE_DENIED       The application does not have the privilege to call this method.
249          * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
250          * @remarks             The specific error code can be accessed using the GetLastResult() method.
251          * @see SetAsPrimaryPhoneNumber()
252          */
253         PhoneNumber GetPrimaryPhoneNumber(void) const;
254
255         /**
256          * Gets the primary email of this person.
257          *
258          * @since       2.0
259          * @privlevel   public
260          * @privilege   %http://tizen.org/privilege/contact.read
261          *
262          * @return      The primary email @n If this instance does not have the primary email, an empty Email instance is returned.
263          * @exception  E_SUCCESS                The method is successful.
264          * @exception  E_PRIVILEGE_DENIED       The application does not have the privilege to call this method.
265          * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
266          * @remarks             The specific error code can be accessed using the GetLastResult() method.
267          * @see SetAsPrimaryEmail()
268          */
269         Email GetPrimaryEmail(void) const;
270
271 private:
272         /**
273          * This constructor is intentionally declared as private so that only the platform can create an instance.
274          *
275          * @since       2.0
276          */
277         Person(void);
278
279         /**
280          * This copy constructor is intentionally declared as private to prohibit copying of objects by users.
281          *
282          * @since       2.0
283          *
284          * @param[in]  rhs            An instance of %Person
285          */
286         Person(const Person& rhs);
287
288         /**
289          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
290          *
291          * @since       2.0
292          *
293          * @param[in]  rhs            An instance of %Person
294          */
295         Person& operator =(const Person& rhs);
296
297 private:
298         friend class _PersonImpl;
299         class _PersonImpl* __pPersonImpl;
300
301         friend class _AddressbookManagerImpl;
302         friend class _AddressbookUtil;
303 };      // Person
304
305 }}      // Tizen::Social
306
307 #endif // _FSCL_PERSON_H_