Merge "fix doxygen for SetExtened()" into tizen_2.1
[framework/osp/social.git] / inc / FSclAccountManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 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         FSclAccountManager.h
19 * @brief        This is the header file for the %AccountManager class.
20 *
21 * This header file contains the declarations of the %AccountManager class.
22 */
23 #ifndef _FSCL_ACCOUNT_MANAGER_H_
24 #define _FSCL_ACCOUNT_MANAGER_H_
25
26 #include <unique_ptr.h>
27 #include <FBaseObject.h>
28 #include <FBaseTypes.h>
29 #include <FSclTypes.h>
30
31 namespace Tizen { namespace Base
32 {
33 class String;
34 namespace Collection
35 {
36 class IList;
37 }
38 }}
39
40 namespace Tizen { namespace Social
41 {
42 class Account;
43 class AccountProvider;
44
45 /**
46  * @class       AccountManager
47  * @brief       This class provides the method for managing accounts.
48  * @since       2.1
49  *
50  * @final       This class is not intended for extension.
51  *
52  * The %AccountManager class provides the method for managing accounts.
53  */
54 class _OSP_EXPORT_ AccountManager
55         : public Tizen::Base::Object
56 {
57 public:
58         /**
59          * Adds an account. @n
60          * The user name must be set in the account.
61          * If the account is added successfully, an account ID is newly assigned to it.
62          * The %AddAccount() method can be used only by the application belonging to a package of an application that registers its own account provider.
63          *
64          * @since               2.1
65          * @privlevel   public
66          * @privilege   %http://tizen.org/privilege/account.write
67          *
68          * @return                      An error code
69          * @param[in,out]       account                                 The account to add
70          * @exception           E_SUCCESS                               The method is successful.
71          * @exception           E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
72          * @exception           E_INVALID_ARG                   Either of the following conditions has occurred: @n
73          *                                                                                      - The user name is an empty string in the specified @c account. @n
74          *                                                                                      - The account ID is not #INVALID_ACCOUNT_ID. @n
75          * @exception           E_INVALID_OPERATION             Either of the following conditions has occurred: @n
76          *                                                                                      - The caller application does not belong to a package of an application that registers its own account provider. @n
77          *                                                                                      - The account has already been added with the multiple accounts support set to @c false.
78          * @exception           E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
79          * @exception           E_SYSTEM                                The method cannot proceed due to a severe system error.
80          */
81         result AddAccount(Account& account);
82
83         /**
84          * Removes an account. @n
85          * The %RemoveAccount() method can be used only by an application belonging to a package of an application that registers its own account provider.
86          *
87          * @since               2.1
88          * @privlevel   public
89          * @privilege   %http://tizen.org/privilege/account.write
90          *
91          * @return              An error code
92          * @param[in]   accountId                               The account ID
93          * @exception   E_SUCCESS                               The method is successful.
94          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
95          * @exception   E_INVALID_ARG                   The specified @c accountId is invalid.
96          * @exception   E_OBJ_NOT_FOUND                 The specified @c accountId does not exist.
97          * @exception   E_INVALID_OPERATION             This operation is not allowed if the caller application does not belong to a package of an application that registers its own account provider.
98          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
99          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
100          */
101         result RemoveAccount(AccountId accountId);
102
103         /**
104          * Updates an account. @n
105          * The user name must be set in an account.
106          * The %UpdateAccount() method can be used only by an application belonging to a package of an application that registers its own account provider.
107          *
108          * @since               2.1
109          * @privlevel   public
110          * @privilege   %http://tizen.org/privilege/account.write
111          *
112          * @return              An error code
113          * @param[in]   account                                 The account to update
114          * @exception   E_SUCCESS                               The method is successful.
115          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
116          * @exception   E_INVALID_ARG                   Either of the following conditions has occurred: @n
117          *                                                                              - The user name is an empty string in the specified @c account. @n
118          *                                                                              - The account ID is invalid. @n
119          * @exception   E_OBJ_NOT_FOUND                 The specified @c account does not exist.
120          * @exception   E_INVALID_OPERATION             This operation is not allowed if the caller application does not belong to a package of an application that registers its own account provider.
121          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
122          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
123          */
124         result UpdateAccount(const Account& account);
125
126         /**
127          * Gets the %AccountManager instance.
128          *
129          * @since               2.1
130          *
131          * @return              A pointer to the %AccountManager instance, @n
132          *                              else @c null if it fails
133          * @remarks             The specific error code can be accessed using the GetLastResult() method.
134          */
135         static AccountManager* GetInstance(void);
136
137 private:
138         //
139         // This default constructor is intentionally declared as private to implement the Singleton semantic.
140         //
141         // @since               2.1
142         //
143         AccountManager(void);
144
145         //
146         // This destructor is intentionally declared as private to implement the Singleton semantic.
147         //
148         // @since               2.1
149         //
150         virtual ~AccountManager(void);
151
152         //
153         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
154         //
155         // @since               2.1
156         //
157         AccountManager(const AccountManager& rhs);
158
159         //
160         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
161         //
162         // @since               2.1
163         //
164         AccountManager& operator =(const AccountManager& rhs);
165
166         //
167         // Constructs an instance of this class.
168         //
169         // @since               2.1
170         //
171         // @return              An error code
172         // @exception   E_SUCCESS                       The method is successful.
173         // @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
174         //
175         result Construct(void);
176
177         //
178         // Initializes an instance of this class.
179         //
180         // @since               2.1
181         //
182         static void InitAccountManager(void);
183
184         //
185         // Destroys an instance of this class.
186         //
187         // @since               2.1
188         //
189         static void DestroyAccountManager(void);
190
191 private:
192         static AccountManager* __pInstance;
193         friend struct std::default_delete<AccountManager>;
194
195         friend class _AccountManagerImpl;
196         class _AccountManagerImpl* __pAccountManagerImpl;
197
198 };      // AccountManager
199
200 }}      // Tizen::Social
201
202 #endif //_FSCL_ACCOUNT_MANAGER_H_