add % before the privilege tag not to link to the linkage page
[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 the account management.
48  * @since       2.1
49  *
50  * @final       This class is not intended for extension.
51  */
52 class _OSP_EXPORT_ AccountManager
53         : public Tizen::Base::Object
54 {
55 public:
56         /**
57          * Adds an account. @n
58          * The user name must have been set in the account.
59          * If the account is added successfully, an account ID is newly assigned to it.
60          * This method can be used only by the application belonging to the package of the application which registers its own account provider.
61          *
62          * @since               2.1
63          * @privlevel   public
64          * @privilege   %http://tizen.org/privilege/account.write
65          *
66          * @return                      An error code
67          * @param[in,out]       account                         The account to add
68          * @exception           E_SUCCESS                       The method is successful.
69          * @exception           E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
70          * @exception           E_INVALID_ARG           Either of the following conditions has occurred: @n
71          *                                                                              - The user name is an empty string in the specified @c account. @n
72          *                                                                              - The account ID is not #INVALID_ACCOUNT_ID. @n
73          * @exception           E_INVALID_OPERATION     Either of the following conditions has occurred: @n
74          *                                                                              - The caller application does not belong to the package of the application which registers its own account provider. @n
75          *                                                                              - The multiple accounts support is set to false and the account is already added. @n
76          * @exception           E_SYSTEM                        The method cannot proceed due to a severe system error.
77          */
78         result AddAccount(Account& account);
79
80         /**
81          * Removes an account. @n
82          * This method can be used only by the application belonging to the package of the application which registers its own account provider.
83          *
84          * @since               2.1
85          * @privlevel   public
86          * @privilege   %http://tizen.org/privilege/account.write
87          *
88          * @return              An error code
89          * @param[in]   accountId                       The account ID
90          * @exception   E_SUCCESS                       The method is successful.
91          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
92          * @exception   E_INVALID_ARG           The specified @c accountId is invalid.
93          * @exception   E_OBJ_NOT_FOUND         The specified @c accountId does not exist.
94          * @exception   E_INVALID_OPERATION     This operation is not allowed if the caller application does not belong to the package of the application which registers its own account provider.
95          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
96          */
97         result RemoveAccount(AccountId accountId);
98
99         /**
100          * Updates an account. @n
101          * The user name must have been set in the account.
102          * This method can be used only by the application belonging to the package of the application which registers its own account provider.
103          *
104          * @since               2.1
105          * @privlevel   public
106          * @privilege   %http://tizen.org/privilege/account.write
107          *
108          * @return              An error code
109          * @param[in]   account                         The account to update
110          * @exception   E_SUCCESS                       The method is successful.
111          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
112          * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
113          *                                                                      - The user name is an empty string in the specified @c account. @n
114          *                                                                      - The account ID is invalid. @n
115          * @exception   E_OBJ_NOT_FOUND         The specified @c account does not exist.
116          * @exception   E_INVALID_OPERATION     This operation is not allowed if the caller application does not belong to the package of the application which registers its own account provider.
117          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
118          */
119         result UpdateAccount(const Account& account);
120
121         /**
122          * Gets the account manager instance.
123          *
124          * @since               2.1
125          *
126          * @return              A pointer to the %AccountManager instance, @n
127          *                              else @c null if it fails
128          * @remarks             The specific error code can be accessed using the GetLastResult() method.
129          */
130         static AccountManager* GetInstance(void);
131
132 private:
133         //
134         // This default constructor is intentionally declared as private to implement the Singleton semantic.
135         //
136         // @since               2.1
137         //
138         AccountManager(void);
139
140         //
141         // This destructor is intentionally declared as private to implement the Singleton semantic.
142         //
143         // @since               2.1
144         //
145         virtual ~AccountManager(void);
146
147         //
148         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
149         //
150         // @since               2.1
151         //
152         AccountManager(const AccountManager& rhs);
153
154         //
155         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
156         //
157         // @since               2.1
158         //
159         AccountManager& operator =(const AccountManager& rhs);
160
161         //
162         // Constructs the instance of this class.
163         //
164         // @since               2.1
165         //
166         // @return              An error code
167         // @exception   E_SUCCESS                       The method is successful.
168         // @exception   E_SYSTEM                        A system error has occurred.
169         //
170         result Construct(void);
171
172         //
173         // Initializes the instance of this class.
174         //
175         // @since               2.1
176         //
177         static void InitAccountManager(void);
178
179         //
180         // Destroys the instance of this class.
181         //
182         // @since               2.1
183         //
184         static void DestroyAccountManager(void);
185
186 private:
187         static AccountManager* __pInstance;
188         friend struct std::default_delete<AccountManager>;
189
190         friend class _AccountManagerImpl;
191         class _AccountManagerImpl* __pAccountManagerImpl;
192
193 };      // AccountManager
194
195 }}      // Tizen::Social
196
197 #endif //_FSCL_ACCOUNT_MANAGER_H_