2 // Copyright (c) 2012 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.
18 * @file FAppMapDataControl.h
19 * @brief This is the header file for the %MapDataControl class.
21 * This header file contains the declarations of the %MapDataControl class.
24 #ifndef _FAPP_MAP_DATA_CONTROL_H_
25 #define _FAPP_MAP_DATA_CONTROL_H_
27 #include <FBaseDataType.h>
28 #include <FBaseObject.h>
30 namespace Tizen { namespace Base
35 namespace Tizen { namespace App
38 class IMapDataControlResponseListener;
41 * @class MapDataControl
42 * @brief This class represents the key-value structured data control behavior.
46 * @final This class is not intended for extension.
48 * The %MapDataControl class represents the key-value structured data control behavior, that provides a standard mechanism
49 * for accessing specific data exported by other applications.
50 * Data control provider can share its own data to data control consumers.
52 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/app/data_controls.htm">Data Controls</a>.
54 * @see Tizen::App::AppManager
56 * The following example demonstrates how to use the %MapDataControl class.
63 * using namespace Tizen::Base;
64 * using namespace Tizen::App;
66 * class MyMapDataControlResponseListener:
67 * : public Tizen::App::IMapDataControlResponseListener
70 * void OnMapDataControlGetValueResponseReceived(RequestId reqId, const String& providerId, const String& dataId, IList& resultValueList, bool providerResult, const String* pErrorMsg)
72 * int count = resultValueList.GetCount();
73 * for (int i = 0; i < count; i++)
75 * String pPerson = static_cast< String* >(resultValueList.GetAt(i));
76 * AppLog("%dth person: %ls", i, pPerson->GetPointer());
82 * MyClass::Execute(void)
84 * String providerId(L"http://tizen.org/datacontrol/provider/example");
85 * MapDataControl* pDc = AppManager::GetMapDataControlN(providerId);
87 * MyMapDataControlResponseListener* pResponseListener = new MyMapDataControlResponseListener();
89 * pDc->SetMapDataControlResponseListener(pResponseListener);
91 * String dataId(L"test");
92 * String person(L"person");
95 * pDc->GetValue(dataId, person, reqId);
101 class _OSP_EXPORT_ MapDataControl
102 : public Tizen::Base::Object
107 * This destructor overrides Tizen::Base::Object::~Object().
111 virtual ~MapDataControl(void);
114 * Gets the value list associated with the specified @c key, from a key-values map owned by key-value structured data control provider. @n
115 * The %GetValue() method is asynchronous.
116 * For receiving the response from data control provider, set the listener
117 * with MapDataControl::SetMapDataControlResponseListener(). @n
118 * When the requested value list has been received from data control provider,
119 * the IMapDataControlResponseListener::OnMapDataControlGetValueResponseReceived() method is called.
123 * @return An error code
124 * @param[in] dataId A string for identifying specific data, usually a registry section to get from @n
125 * The string consists of one or more components, separated by a slash('/').
126 * @param[in] key A key of the value list to obtain
127 * @param[out] reqId The ID of the request
128 * @param[in] pageNo The page number of the value set @n
129 * It starts from @c 1.
130 * @param[in] countPerPage The desired maximum count of the data item on the page
131 * @exception E_SUCCESS The method is successful.
132 * @exception E_INVALID_STATE This instance has not been properly constructed as yet.
133 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
134 * - The specified @c pageNo parameter is less than @c 1.
135 * - The specified @c countPerPage parameter is less than @c 1.
136 * @exception E_ILLEGAL_ACCESS Either of the following conditions has occurred: @n
137 * - Access is denied due to insufficient permission.
138 * - The application using this method is not signed with the same certificate of provider application. @b Since: @b 2.1
139 * @exception E_MAX_EXCEEDED Either of the following conditions has occurred: @n
140 * - The total size of method arguments has exceeded the maximum limit.
141 * - The number of requests sent has exceeded the maximum limit.
142 * @exception E_SYSTEM A system error has occurred.
143 * @remarks The total size of method arguments is under 16KB because severe system performance degradation may occur for large messages. @c E_MAX_EXCEEDED may be returned for messages over 16KB size.
145 result GetValue(const Tizen::Base::String& dataId, const Tizen::Base::String& key, RequestId& reqId, int pageNo = 1, int countPerPage = 20);
148 * Adds the value associated with the specified @c key, to a key-values map owned by key-value structured data control provider. @n
149 * The %AddValue() method is asynchronous.
150 * For receiving the response from data control provider, set the listener
151 * with MapDataControl::SetMapDataControlResponseListener(). @n
152 * When the response has been received from the data control provider,
153 * the IMapDataControlResponseListener::OnMapDataControlAddValueResponseReceived() method is called.
157 * @return An error code
158 * @param[in] dataId A string for identifying specific data, usually a registry section to add to @n
159 * The string consists of one or more components, separated by a slash('/').
160 * @param[in] key A key of the value list to add
161 * @param[in] value A value to add
162 * @param[out] reqId The ID of the request
163 * @exception E_SUCCESS The method is successful.
164 * @exception E_INVALID_STATE This instance has not been properly constructed as yet.
165 * @exception E_ILLEGAL_ACCESS Either of the following conditions has occurred: @n
166 * - Access is denied due to insufficient permission.
167 * - The application using this method is not signed with the same certificate of provider application. @b Since: @b 2.1
168 * @exception E_MAX_EXCEEDED Either of the following conditions has occurred: @n
169 * - The total size of method arguments has exceeded the maximum limit.
170 * - The number of requests sent has exceeded the maximum limit.
171 * @exception E_SYSTEM A system error has occurred.
172 * @remarks The total size of method arguments is under 16KB because severe system performance degradation may occur for large messages. @c E_MAX_EXCEEDED may be returned for messages over 16KB size.
174 result AddValue(const Tizen::Base::String& dataId, const Tizen::Base::String& key, const Tizen::Base::String& value, RequestId& reqId);
177 * Sets the value associated with the specified @c key with a new value. @n
178 * The key-values map is owned by key-value structured data control provider. @n
179 * The %SetValue() method is asynchronous.
180 * For receiving the response from data control provider, set the listener
181 * with MapDataControl::SetMapDataControlResponseListener(). @n
182 * When the response has been received from the data control provider,
183 * the IMapDataControlResponseListener::OnMapDataControlSetValueResponseReceived() method is called.
187 * @return An error code
188 * @param[in] dataId A string for identifying specific data, usually a registry section to update @n
189 * The string consists of one or more components, separated by a slash('/').
190 * @param[in] key A key of the value to replace
191 * @param[in] oldValue A value to replace
192 * @param[in] newValue A new value to replace the existing value
193 * @param[out] reqId The ID of the request
194 * @exception E_SUCCESS The method is successful.
195 * @exception E_INVALID_STATE This instance has not been properly constructed as yet.
196 * @exception E_ILLEGAL_ACCESS Either of the following conditions has occurred: @n
197 * - Access is denied due to insufficient permission.
198 * - The application using this method is not signed with the same certificate of provider application. @b Since: @b 2.1
199 * @exception E_MAX_EXCEEDED Either of the following conditions has occurred: @n
200 * - The total size of method arguments has exceeded the maximum limit.
201 * - The number of requests sent has exceeded the maximum limit.
202 * @exception E_SYSTEM A system error has occurred.
203 * @remarks The total size of method arguments is under 16KB because severe system performance degradation may occur for large messages. @c E_MAX_EXCEEDED may be returned for messages over 16KB size.
205 result SetValue(const Tizen::Base::String& dataId, const Tizen::Base::String& key, const Tizen::Base::String& oldValue, const Tizen::Base::String& newValue, RequestId& reqId);
208 * Removes the value associated with the specified @c key, from a key-values map owned by key-value structured data control provider. @n
209 * The %RemoveValue() method is asynchronous.
210 * For receiving the response from data control provider, set the listener
211 * with MapDataControl::SetMapDataControlResponseListener(). @n
212 * When the response has been received from the data control provider,
213 * the IMapDataControlResponseListener::OnMapDataControlRemoveValueResponseReceived() method is called.
217 * @return An error code
218 * @param[in] dataId A string for identifying specific data, usually a registry section to remove from @n
219 * The string consists of one or more components, separated by a slash('/').
220 * @param[in] key A key of the value to remove
221 * @param[in] value A value to remove
222 * @param[out] reqId The ID of the request
223 * @exception E_SUCCESS The method is successful.
224 * @exception E_INVALID_STATE This instance has not been properly constructed as yet.
225 * @exception E_ILLEGAL_ACCESS Either of the following conditions has occurred: @n
226 * - Access is denied due to insufficient permission.
227 * - The application using this method is not signed with the same certificate of provider application. @b Since: @b 2.1
228 * @exception E_MAX_EXCEEDED Either of the following conditions has occurred: @n
229 * - The total size of method arguments has exceeded the maximum limit.
230 * - The number of requests sent has exceeded the maximum limit.
231 * @exception E_SYSTEM A system error has occurred.
232 * @remarks The total size of method arguments is under 16KB because severe system performance degradation may occur for large messages. @c E_MAX_EXCEEDED may be returned for messages over 16KB size.
234 result RemoveValue(const Tizen::Base::String& dataId, const Tizen::Base::String& key, const Tizen::Base::String& value, RequestId& reqId);
237 * Sets the MAP-based data control listener to this instance.
241 * @return An error code
242 * @param[in] pListener The data control callback listener @n
243 * Some data controls need to get the callback result by implementing
244 * the IMapDataControlResponseListener interface.
245 * @exception E_SUCCESS The method is successful.
246 * @exception E_INVALID_STATE This instance has not been properly constructed.
247 * @exception E_SYSTEM A system error has occurred.
249 result SetMapDataControlResponseListener(IMapDataControlResponseListener* pListener);
253 * This default constructor is intentionally declared as private so that only the platform can create an instance.
257 MapDataControl(void);
260 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
263 * @remarks This constructor is hidden.
265 MapDataControl(const MapDataControl& mapDataControl);
268 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
271 * @remarks This operator is hidden.
273 MapDataControl& operator =(const MapDataControl& mapDataControl);
276 class _MapDataControlImpl * __pMapDataControlImpl;
278 friend class _MapDataControlImpl;
283 #endif // _FAPP_MAP_DATA_CONTROL_H_