2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
18 * @author Andrzej Surdej (a.surdej@samsung.com)
20 * @brief Local storage interface file
23 #ifndef WRTDEVICEAPIS_LOCALSTORAGE_LOCAL_STORAGE_INTERFACE_H_
24 #define WRTDEVICEAPIS_LOCALSTORAGE_LOCAL_STORAGE_INTERFACE_H_
27 #include <dpl/shared_ptr.h>
28 #include <dpl/optional.h>
30 namespace WrtDeviceApis {
31 namespace LocalStorage {
39 * Save pair key/value in local storage
42 * @param readOnly - if true, the value will be read only
43 * otherwise the value will be modificable
45 virtual void setItem(const std::string& key,
46 const std::string& value,
50 * Remove pair key/value from local storage
52 virtual void removeItem(const std::string& key) = 0;
58 virtual DPL::Optional<std::string> getValue(
59 const std::string& key) const = 0;
62 * Clears the local storage
63 * @param removeReadOnly - true -remove all elements
64 * false - ommit items which have read only flag set
66 virtual void clear(bool removeReadOnly) = 0;
69 * Get number of elements in local storage
70 * @param removeReadOnly - true -remove all elements
71 * false - ommit items which have read only flag set
73 virtual size_t getStorageSize() const = 0;
78 virtual std::string getValueByIndex(size_t index) const = 0;
83 virtual ~ILocalStorage()
89 typedef DPL::SharedPtr<ILocalStorage> ILocalStoragePtr;
95 #endif // WRTDEVICEAPIS_LOCALSTORAGE_LOACA_STORAGE_INTERFACE_H_