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 {
38 * Save pair key/value in local storage
41 * @param readOnly - if true, the value will be read only
42 * otherwise the value will be modificable
44 virtual void setItem(const std::string& key,
45 const std::string& value,
49 * Remove pair key/value from local storage
51 virtual void removeItem(const std::string& key) = 0;
57 virtual DPL::Optional<std::string> getValue(
58 const std::string& key) const = 0;
61 * Clears the local storage
62 * @param removeReadOnly - true -remove all elements
63 * false - ommit items which have read only flag
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
74 virtual size_t getStorageSize() const = 0;
77 * Get key name for index
79 virtual std::string getKeyByIndex(size_t index) const = 0;
84 virtual ~ILocalStorage()
88 typedef DPL::SharedPtr<ILocalStorage> ILocalStoragePtr;
93 #endif // WRTDEVICEAPIS_LOCALSTORAGE_LOACA_STORAGE_INTERFACE_H_