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 FSclAccountManager.h
18 * @brief This is the header file for the %AccountManager class.
20 * This header file contains the declarations of the %AccountManager class.
22 #ifndef _FSCL_ACCOUNT_MANAGER_H_
23 #define _FSCL_ACCOUNT_MANAGER_H_
25 #include <unique_ptr.h>
26 #include <FBaseObject.h>
27 #include <FBaseTypes.h>
28 #include <FSclTypes.h>
30 namespace Tizen { namespace Base
39 namespace Tizen { namespace Social
42 class AccountProvider;
45 * @class AccountManager
46 * @brief This class provides methods for managing accounts.
49 * @final This class is not intended for extension.
51 * The %AccountManager class provides methods for managing accounts.
53 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/social/acc_manage.htm">Account Management</a>.
55 class _OSP_EXPORT_ AccountManager
56 : public Tizen::Base::Object
61 * The user name must be set in the account.
62 * If the account is added successfully, an account ID is newly assigned to it. @n
63 * The %AddAccount() method can be used only by an application belonging to a package of an application that registers its own account provider.
67 * @privilege %http://tizen.org/privilege/account.write
69 * @return An error code
70 * @param[in,out] account The account to add @n
71 * If this method is successful, the account ID for the added account is assigned.
72 * @exception E_SUCCESS The method is successful.
73 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
74 * @exception E_INVALID_ARG Either of the following conditions has occurred:
75 * - The user name is an empty string in the specified @c account.
76 * - The account ID is not #INVALID_ACCOUNT_ID.
77 * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
78 * - The caller application does not belong to a package of an application that registers its own account provider.
79 * - The account has already been added with the multiple accounts support set to @c false.
80 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
81 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
83 result AddAccount(Account& account);
86 * Removes an account. @n
87 * The %RemoveAccount() method can be used only by the applications belonging to the package of the application that has registered the account provider of the specified account.
91 * @privilege %http://tizen.org/privilege/account.write
93 * @return An error code
94 * @param[in] accountId The account ID
95 * @exception E_SUCCESS The method is successful.
96 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
97 * @exception E_INVALID_ARG The specified @c accountId is invalid.
98 * @exception E_OBJ_NOT_FOUND The specified @c accountId does not exist.
99 * @exception E_INVALID_OPERATION The caller application does not belong to the package of the application that has registered the account provider of the specified account.
100 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
101 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
103 result RemoveAccount(AccountId accountId);
106 * Updates an account. @n
107 * The user name must be set in the account.
108 * The %UpdateAccount() method can be used only by the applications belonging to the package of the application that has registered the account provider of the specified account.
112 * @privilege %http://tizen.org/privilege/account.write
114 * @return An error code
115 * @param[in] account The account to update
116 * @exception E_SUCCESS The method is successful.
117 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
118 * @exception E_INVALID_ARG Either of the following conditions has occurred:
119 * - The user name is an empty string in the specified @c account.
120 * - The account ID is invalid.
121 * @exception E_OBJ_NOT_FOUND The specified @c account does not exist.
122 * @exception E_INVALID_OPERATION The caller application does not belong to the package of the application that has registered the account provider of the specified account.
123 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
124 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
126 result UpdateAccount(const Account& account);
129 * Gets an %AccountManager instance.
133 * @return A pointer to the %AccountManager instance, @n
134 * else @c null if it fails
135 * @remarks The specific error code can be accessed using the GetLastResult() method.
137 static AccountManager* GetInstance(void);
141 // This default constructor is intentionally declared as private to implement the Singleton semantic.
145 AccountManager(void);
148 // This destructor is intentionally declared as private to implement the Singleton semantic.
152 virtual ~AccountManager(void);
155 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
159 AccountManager(const AccountManager& rhs);
162 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
166 AccountManager& operator =(const AccountManager& rhs);
169 // Constructs an instance of this class.
173 // @return An error code
174 // @exception E_SUCCESS The method is successful.
175 // @exception E_SYSTEM The method cannot proceed due to a severe system error.
177 result Construct(void);
180 // Initializes an instance of this class.
184 static void InitAccountManager(void);
187 // Destroys an instance of this class.
191 static void DestroyAccountManager(void);
194 static AccountManager* __pInstance;
195 friend struct std::default_delete<AccountManager>;
197 friend class _AccountManagerImpl;
198 class _AccountManagerImpl* __pAccountManagerImpl;
204 #endif //_FSCL_ACCOUNT_MANAGER_H_