2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FApp_AppRegistryImpl.h
20 * @brief This is the header file of the _AppRegistryImpl class.
23 #ifndef _FAPP_INTERNAL_APP_REGISTRY_IMPL_H_
24 #define _FAPP_INTERNAL_APP_REGISTRY_IMPL_H_
26 #include <FBaseObject.h>
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
30 namespace Tizen { namespace Io { class Registry; } }
32 namespace Tizen { namespace App
36 * @class _AppRegistryImpl
37 * @brief This class manages an application's preferences.
40 class _AppRegistryImpl
41 : public Tizen::Base::Object
45 * This is the destructor for this class.
49 virtual ~_AppRegistryImpl(void);
52 * Adds a string value along with the specified key.
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.
64 result Add(const Tizen::Base::String& key, const Tizen::Base::String& value);
67 * Adds an integer value along with the specified key.
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.
79 result Add(const Tizen::Base::String& key, int value);
82 * Adds a floating point value along with the specified key.
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.
94 result Add(const Tizen::Base::String& key, double value);
97 * Updates a string value associated with the specified key.
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.
109 result Set(const Tizen::Base::String& key, const Tizen::Base::String& value);
112 * Updates an integer value associated with the specified key.
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.
124 result Set(const Tizen::Base::String& key, int value);
127 * Updates a floating point value associated with the specified key.
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.
139 result Set(const Tizen::Base::String& key, double value);
142 * Saves the values temporarily in the persistent storage. @n
143 * This method is invoked internally when the instance of this class is deleted.
146 * @return An error code
147 * @exception E_SUCCESS The method was successful.
152 * Removes a preference associated with the specified key.
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.
160 result Remove(const Tizen::Base::String& key);
163 * Retrieves a string value associated with the specified key.
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.
173 result Get(const Tizen::Base::String& key, Tizen::Base::String& value) const;
176 * Retrieves an integer value associated with the specified key.
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.
186 result Get(const Tizen::Base::String& key, int& value) const;
189 * Retrieves a floating point value associated with the specified key.
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.
199 result Get(const Tizen::Base::String& key, double& value) const;
203 * This is the default constructor for this class.
207 _AppRegistryImpl(void);
210 * This is the copy constructor for this class.
214 _AppRegistryImpl(const _AppRegistryImpl& source);
217 * Allocates memory for an _AppRegistryImpl object.
221 * @return An error code
222 * @exception E_SUCCESS The method was successful.
224 result Construct(void);
227 * This is the assignment operator for this class.
229 _AppRegistryImpl& operator =(const _AppRegistryImpl& source);
232 Tizen::Io::Registry* __pRegistry;
233 const Tizen::Base::String __sectionName;
235 friend class AppRegistry;
236 }; // _AppRegistryImpl
240 #endif // _FAPP_INTERNAL_APP_REGISTRY_IMPL_H_