summaryrefslogtreecommitdiff
path: root/inc/FSclPerson.h
blob: 60fa9115f7dec9bc9ba3ebe8955a48e3e5809d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
//
// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
 * @file		FSclPerson.h
 * @brief		This is the header file for the %Person class.
 *
 * This header file contains the declarations of the %Person class.
 */
#ifndef _FSCL_PERSON_H_
#define _FSCL_PERSON_H_

#include <FBaseObject.h>
#include <FBaseString.h>
#include <FSclRecord.h>
#include <FSclTypes.h>
#include <FSclPhoneNumber.h>
#include <FSclEmail.h>

namespace Tizen { namespace Base
{
namespace Collection
{
template<typename Type>
class IListT;
}
} }

namespace Tizen { namespace Graphics
{
class Bitmap;
} }

namespace Tizen { namespace Social
{

/**
 * @class      Person
 * @brief      This class provides an aggregated contact information.
 *
 * @since	2.0
 *
 * @final      This class is not intended for extension.
 *
 * The %Person class provides an aggregated contact information of a person. @n 
 * There can be more than one contact of the same person because contacts can be synchronized from multiple service providers. @n
 * %Person has the following information of an individual. @n
 * - Display name
 * - Thumbnail
 * - Ringtone 
 * - Primary phone number
 * - Primary email
 *
 * Each information is collected from contacts linked to the person. @n
 *
 * 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.
 * It is possible to merge two persons into one or unlink a contact from a person.
 */

class _OSP_EXPORT_ Person
        : public Tizen::Base::Object
{
public:
        /**
         * This destructor overrides Tizen::Base::Object::~Object().
         *
         * @since	2.0
         */
	virtual ~Person(void);

	/**
	 * Checks whether the value of the specified instance is equal to the value of the current instance of Tizen::Base::Object.
	 *
	 * @since	2.0
	 *
	 * @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
	 *                     else @c false
	 * @param[in]  rhs            An instance of Tizen::Base::Object to compare
	 */
	virtual bool Equals(const Tizen::Base::Object& rhs) const;

	/**
	 * Gets the hash value of the current instance.
	 *
	 * @since	2.0
	 *
	 * @return     The hash value of the current instance
	 */
	virtual int GetHashCode(void) const;

	/**
	 * Gets the display name.
	 *
	 * @since	2.0
	 *
	 * @return     The display name
	 */
	Tizen::Base::String GetDisplayName(void) const;

	/**
	 * Checks whether this is a favorite or not.
	 *
	 * @since	2.0
	 *
	 * @return     @c true if this is a favorite, @n
	 *              else @c false
	 * @see	SetAsFavorite()
	 */
	bool IsFavorite(void) const;

	/**
	 * Gets the thumbnail path.
	 *
	 * @since	2.0
	 *
	 * @return     The file path of the thumbnail
	 * @remarks    If the thumbnail path has not been set, empty string is returned.
	 */
	Tizen::Base::String GetThumbnailPath(void) const;

	/**
	 * Gets the ringtone path.
	 *
	 * @since	2.0
	 *
	 * @return     The file path of the ringtone
	 * @remarks    If the ringtone path has not been set, empty string is returned.
	 */
	Tizen::Base::String GetRingtonePath(void) const;

	/**
	 * Checks whether this has phone numbers or not.
	 *
	 * @since	2.0
	 *
	 * @return     @c true if this has phone numbers, @n
	 *              else @c false
	 */
	bool HasPhoneNumber(void) const;

	/**
	 * Checks whether this has emails or not.
	 *
	 * @since	2.0
	 *
	 * @return     @c true if this has emails, @n
	 *              else @c false
	 */
	bool HasEmail(void) const;

	/**
	 * Gets the list of account ID of contacts linked to the person.
	 *
	 * @since	2.0
	 *
	 * @return     The account ID list
	 * @exception  E_SUCCESS              The method is successful.
	 * @exception  E_OUT_OF_MEMORY        The memory is insufficient.
	 * @exception  E_SYSTEM     	The method cannot proceed due to a severe system error.
	 * @remarks    The specific error code can be accessed using the GetLastResult() method.
	 */
	Tizen::Base::Collection::IListT<AccountId>* GetAccountIdsN(void) const;

	/**
	 * Gets the ID of this person.
	 *
	 * @since	2.0
	 *
	 * @return	The person ID
	 */
	PersonId GetId(void) const;

	/**
	 * Sets whether this person is a favorite or not.
	 *
	 * @since	2.0
	 * @privlevel	public
	 * @privilege   %http://tizen.org/privilege/contact.write
	 *
	 * @return      An error code
	 * @param[in]   isFavorite    Set to @c true to set this person as a favorite, @n
	 *                            else @c false to set this person as non-favorite
	 * @exception   E_SUCCESS               The method is successful.
	 * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
	 * @exception	E_USER_NOT_CONSENTED	The user blocks an application from calling this method. @b Since: @b 2.1
	 * @exception   E_SYSTEM      The method cannot proceed due to a severe system error.
	 * @see IsFavorite()
	 * @see	AddressbookManager::GetFavoritePersonsN()
	 */
	result SetAsFavorite(bool isFavorite = true);


	/**
	 * Sets the specified phone number as the primary phone number of this person.
	 *
	 * @since	2.0
	 * @privlevel	public
	 * @privilege   %http://tizen.org/privilege/contact.write
	 *
	 * @return     An error code
	 * @param[in]  phoneNumber    The phone number
	 * @exception  E_SUCCESS      The method is successful.
	 * @exception  E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
	 * @exception	E_USER_NOT_CONSENTED	The user blocks an application from calling this method. @b Since: @b 2.1
	 * @exception  E_INVALID_ARG          The specified @c phoneNumber is invalid.
	 * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
	 * @see	GetPrimaryPhoneNumber()
	 */
	result SetAsPrimaryPhoneNumber(const PhoneNumber& phoneNumber);

	/**
	 * Sets the specified email as the primary email of this person.
	 *
	 * @since	2.0
	 * @privlevel	public
	 * @privilege   %http://tizen.org/privilege/contact.write
	 *
	 * @return     An error code
	 * @param[in]  email          The email
	 * @exception  E_SUCCESS      The method is successful.
	 * @exception  E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
	 * @exception	E_USER_NOT_CONSENTED	The user blocks an application from calling this method. @b Since: @b 2.1
	 * @exception  E_INVALID_ARG          The specified @c phoneNumber is invalid.
	 * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
	 * @see	GetPrimaryEmail()
	 */
	result SetAsPrimaryEmail(const Email& email);

	/**
	 * Gets the primary phone number of this person.
	 *
	 * @since	2.0
	 * @privlevel	public
	 * @privilege   %http://tizen.org/privilege/contact.read
	 *
	 * @return	The primary phone number @n If this instance does not have the primary email, an empty PhoneNumber instance is returned.
	 * @exception  E_SUCCESS      		The method is successful.
	 * @exception  E_PRIVILEGE_DENIED      	The application does not have the privilege to call this method.
	 * @exception	E_USER_NOT_CONSENTED	The user blocks an application from calling this method. @b Since: @b 2.1
	 * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
	 * @remarks		The specific error code can be accessed using the GetLastResult() method.
	 * @see SetAsPrimaryPhoneNumber()
	 */
	PhoneNumber GetPrimaryPhoneNumber(void) const;

	/**
	 * Gets the primary email of this person.
	 *
	 * @since	2.0
	 * @privlevel	public
	 * @privilege   %http://tizen.org/privilege/contact.read
	 *
	 * @return	The primary email @n If this instance does not have the primary email, an empty Email instance is returned.
	 * @exception  E_SUCCESS      		The method is successful.
	 * @exception  E_PRIVILEGE_DENIED      	The application does not have the privilege to call this method.
	 * @exception	E_USER_NOT_CONSENTED	The user blocks an application from calling this method. @b Since: @b 2.1
	 * @exception  E_SYSTEM     The method cannot proceed due to a severe system error.
	 * @remarks		The specific error code can be accessed using the GetLastResult() method.
	 * @see SetAsPrimaryEmail()
	 */
	Email GetPrimaryEmail(void) const;

private:
	/**
	 * This constructor is intentionally declared as private so that only the platform can create an instance.
	 *
	 * @since	2.0
	 */
	Person(void);

	/**
	 * This copy constructor is intentionally declared as private to prohibit copying of objects by users.
	 *
	 * @since	2.0
	 *
	 * @param[in]  rhs            An instance of %Person
	 */
	Person(const Person& rhs);

	/**
	 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
	 *
	 * @since	2.0
	 *
	 * @param[in]  rhs            An instance of %Person
	 */
	Person& operator =(const Person& rhs);

private:
        friend class _PersonImpl;
        class _PersonImpl* __pPersonImpl;

        friend class _AddressbookManagerImpl;
        friend class _AddressbookUtil;
}; 	// Person

}}	// Tizen::Social

#endif // _FSCL_PERSON_H_