Update wrt-commons_0.2.53
[framework/web/wrt-commons.git] / modules / widget_dao / include / dpl / wrt-dao-ro / feature_dao_read_only.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file    feature_dao_read_only.h
18  * @author  Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
19  * @version 1.0
20  * @brief   This file contains the declaration of feature dao read only
21  */
22
23 #ifndef WRT_SRC_CONFIGURATION_FEATURE_DAO_READ_ONLY_H_
24 #define WRT_SRC_CONFIGURATION_FEATURE_DAO_READ_ONLY_H_
25
26 #include <set>
27 #include <string>
28 #include <dpl/exception.h>
29 #include <dpl/wrt-dao-ro/common_dao_types.h>
30 #include "feature_model.h"
31 #include <dpl/wrt-dao-ro/common_dao_types.h>
32 #include <dpl/wrt-dao-ro/WrtDatabase.h>
33
34 namespace WrtDB {
35
36 class FeatureDAOReadOnly
37 {
38   public:
39     /**
40      * Exception classes
41      */
42     class Exception
43     {
44       public:
45         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
46         DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
47         DECLARE_EXCEPTION_TYPE(Base, FeatureNotExist)
48     };
49
50     typedef std::set<std::string> DeviceCapabilitiesList;
51     typedef std::multimap<FeatureHandle, std::string> DeviceCapabilitiesMap;
52     typedef std::map<FeatureHandle, std::string> NameMap;
53
54     static bool isDeviceCapabilityInstalled(const std::string &deviceCapName);
55
56     FeatureDAOReadOnly(FeatureHandle);
57     FeatureDAOReadOnly(const std::string &featureName);
58
59     static FeatureHandleListPtr GetFeatureHandleListForPlugin(
60             DbPluginHandle pluginHandle);
61
62     static bool isFeatureInstalled(const std::string &featureName);
63     static bool isFeatureInstalled(FeatureHandle handle);
64     static FeatureHandleList GetHandleList();
65
66     std::string             GetName() const;
67     FeatureHandle           GetFeatureHandle() const;
68     std::string             GetLibraryPath() const;
69     std::string             GetLibraryName() const;
70     DeviceCapabilitiesList  GetDeviceCapabilities() const;
71     DbPluginHandle          GetPluginHandle() const;
72
73     static NameMap                 GetNames();
74     static DeviceCapabilitiesMap   GetDevCapWithFeatureHandle();
75
76   protected:
77     FeatureHandle m_featureHandle;
78 };
79
80 } // namespace WrtDB
81
82 #endif /* WRT_SRC_CONFIGURATION_FEATURE_DAO_READ_ONLY_H_ */