Update privilege string, PackageAppInfo for wgt
[platform/framework/native/appfw.git] / src / app / FApp_AppRegistryImpl.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 /**
19  * @file        FApp_AppRegistryImpl.h
20  * @brief       This is the header file of the _AppRegistryImpl class.
21  */
22
23 #ifndef _FAPP_INTERNAL_APP_REGISTRY_IMPL_H_
24 #define _FAPP_INTERNAL_APP_REGISTRY_IMPL_H_
25
26 #include <FBaseObject.h>
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
29
30 namespace Tizen { namespace Io { class Registry; } }
31
32 namespace Tizen { namespace App
33 {
34
35 /**
36  * @class               _AppRegistryImpl
37  * @brief               This class manages an application's preferences.
38  * @since               1.0
39  */
40 class _AppRegistryImpl
41         : public Tizen::Base::Object
42 {
43 public:
44         /**
45          * This is the destructor for this class.
46          *
47          * @since               1.0
48          */
49         virtual ~_AppRegistryImpl(void);
50
51         /**
52          * Adds a string value along with the specified key.
53          *
54          * @since               1.0
55          * @return      An error code
56          * @param[in]   key             A key corresponding to the value
57          * @param[in]   value   A string value
58          * @exception   E_SUCCESS                               The method was successful.
59          * @exception   E_INVALID_ARG                   The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
60          * @exception   E_KEY_ALREADY_EXIST             The key has already been used in the application preferences.
61          * @exception   E_OUT_OF_MEMORY                 Insufficient memory.
62          * @remark      In order to save the value in the persistent storage, the _AppRegistryImpl::Save() method must be called.
63          */
64         result Add(const Tizen::Base::String& key, const Tizen::Base::String& value);
65
66         /**
67          * Adds an integer value along with the specified key.
68          *
69          * @since               1.0
70          * @return      An error code
71          * @param[in]   key             A key corresponding to the value
72          * @param[in]   value   An integer value
73          * @exception   E_SUCCESS                               The method was successful.
74          * @exception   E_INVALID_ARG                   The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
75          * @exception   E_KEY_ALREADY_EXIST             The key has already been used in the application preferences.
76          * @exception   E_OUT_OF_MEMORY                 Insufficient memory.
77          * @remark      Call the _AppRegistryImpl::Save() method to save the value in the persistent storage.
78          */
79         result Add(const Tizen::Base::String& key, int value);
80
81         /**
82          * Adds a floating point value along with the specified key.
83          *
84          * @since               1.0
85          * @return      An error code
86          * @param[in]   key             A key corresponding to the value
87          * @param[in]   value   A floating point value
88          * @exception   E_SUCCESS                               The method was successful.
89          * @exception   E_INVALID_ARG                   The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
90          * @exception   E_KEY_ALREADY_EXIST             The key has already been used in the application preferences.
91          * @exception   E_OUT_OF_MEMORY                 Insufficient memory.
92          * @remark      Call the _AppRegistryImpl::Save() method to save the value in the persistent storage.
93          */
94         result Add(const Tizen::Base::String& key, double value);
95
96         /**
97          * Updates a string value associated with the specified key.
98          *
99          * @since               1.0
100          * @return      An error code
101          * @param[in]   key             A key corresponding to the value
102          * @param[in]   value   A string value
103          * @exception   E_SUCCESS                       The method was successful.
104          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
105          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
106          * @exception   E_OUT_OF_MEMORY         Insufficient memory.
107          * @remark      Call the _AppRegistryImpl::Save() method to save the value in the persistent storage.
108          */
109         result Set(const Tizen::Base::String& key, const Tizen::Base::String& value);
110
111         /**
112          * Updates an integer value associated with the specified key.
113          *
114          * @since               1.0
115          * @return      An error code
116          * @param[in]   key     A key corresponding to the value
117          * @param[in]   value   An integer value
118          * @exception   E_SUCCESS                       The method was successful.
119          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
120          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
121          * @exception   E_OUT_OF_MEMORY         Insufficient memory.
122          * @remark      Call the _AppRegistryImpl::Save() method to save the value in the persistent storage.
123          */
124         result Set(const Tizen::Base::String& key, int value);
125
126         /**
127          * Updates a floating point value associated with the specified key.
128          *
129          * @since               1.0
130          * @return      An error code
131          * @param[in]   key     A key corresponding to the value
132          * @param[in]   value   A floating point value
133          * @exception   E_SUCCESS                       The method was successful.
134          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
135          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
136          * @exception   E_OUT_OF_MEMORY         Insufficient memory.
137          * @remark      Call the _AppRegistryImpl::Save() method to save the value in the persistent storage.
138          */
139         result Set(const Tizen::Base::String& key, double value);
140
141         /**
142          * Saves the values temporarily in the persistent storage. @n
143          * This method is invoked internally when the instance of this class is deleted.
144          *
145          * @since               1.0
146          * @return      An error code
147          * @exception   E_SUCCESS                       The method was successful.
148          */
149         result Save(void);
150
151         /**
152          * Removes a preference associated with the specified key.
153          *
154          * @since               1.0
155          * @return      An error code
156          * @param[in]   key             The key of the value to be removed
157          * @exception   E_SUCCESS                               The method was successful.
158          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
159          */
160         result Remove(const Tizen::Base::String& key);
161
162         /**
163          * Retrieves a string value associated with the specified key.
164          *
165          * @since               1.0
166          * @return      An error code
167          * @param[in]   key             The key of the value to retrieve
168          * @param[out]  value   A string value to be retrieved
169          * @exception   E_SUCCESS                       The method was successful.
170          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
171          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
172          */
173         result Get(const Tizen::Base::String& key, Tizen::Base::String& value) const;
174
175         /**
176          * Retrieves an integer value associated with the specified key.
177          *
178          * @since               1.0
179          * @return      An error code
180          * @param[in]   key             The key of the value to retrieve
181          * @param[out]  value   An integer value to be retrieved
182          * @exception   E_SUCCESS                       The method was successful.
183          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
184          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
185          */
186         result Get(const Tizen::Base::String& key, int& value) const;
187
188         /**
189          * Retrieves a floating point value associated with the specified key.
190          *
191          * @since               1.0
192          * @return      An error code
193          * @param[in]   key             The key of the value to retrieve
194          * @param[out]  value   A floating point value to be retrieved
195          * @exception   E_SUCCESS                       The method was successful.
196          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to zero. Or, a @c null value or string with '\0' and '\n' was passed.
197          * @exception   E_KEY_NOT_FOUND         The specified key was not used in the application preferences.
198          */
199         result Get(const Tizen::Base::String& key, double& value) const;
200
201 private:
202         /**
203          * This is the default constructor for this class.
204          *
205          * @since 1.0
206          */
207         _AppRegistryImpl(void);
208
209         /**
210          * This is the copy constructor for this class.
211          *
212          * @since       1.0
213          */
214         _AppRegistryImpl(const _AppRegistryImpl& source);
215
216         /**
217          * Allocates memory for an _AppRegistryImpl object.
218          *
219          * @since       1.0
220          *
221          * @return      An error code
222          * @exception   E_SUCCESS       The method was successful.
223          */
224         result Construct(void);
225
226         /**
227          * This is the assignment operator for this class.
228          */
229         _AppRegistryImpl& operator =(const _AppRegistryImpl& source);
230
231 private:
232         Tizen::Io::Registry* __pRegistry;
233         const Tizen::Base::String __sectionName;
234
235         friend class AppRegistry;
236 }; // _AppRegistryImpl
237
238 } } // Tizen::App
239
240 #endif // _FAPP_INTERNAL_APP_REGISTRY_IMPL_H_