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 Lukasz Marek (l.marek@samsung.com)
22 #ifndef _WIDGET_INTERFACE_DAO_H_
23 #define _WIDGET_INTERFACE_DAO_H_
26 #include <boost/optional.hpp>
27 #include <dpl/wrt-dao-ro/common_dao_types.h>
28 #include <dpl/exception.h>
31 namespace WidgetInterfaceDB {
33 class WidgetInterfaceDAO : public WrtDB::SQLiteDAOBase
38 * WidgetInterfaceDAO Exception classes
43 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
44 DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
45 DECLARE_EXCEPTION_TYPE(Base, LocalStorageValueNoModifableException)
46 DECLARE_EXCEPTION_TYPE(Base, InvalidArgumentException)
48 WidgetInterfaceDAO(WrtDB::DbWidgetHandle widgetHandle);
49 virtual ~WidgetInterfaceDAO();
51 static std::string databaseFileName(WrtDB::DbWidgetHandle widgetHandle);
52 void setItem(const std::string& key,
53 const std::string& value,
56 void setItem(const std::string& key,
57 const std::string& value,
59 void removeItem(const std::string& key);
60 boost::optional<std::string> getValue(const std::string& key);
61 void clear(bool removeReadOnly);
62 size_t getStorageSize();
63 std::string getKeyByIndex(size_t index);
66 bool isReadOnly(const std::string& key);
68 typedef std::unique_ptr<WidgetInterfaceDAO> WidgetInterfaceDAOPtr;
70 #endif //_WIDGET_INTERFACE_DAO_H_