Initialize Tizen 2.3
[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 // TODO: Move to feature_model.h
36 typedef std::set<DPL::String> DeviceCapabilitySet;
37
38 class FeatureDAOReadOnly
39 {
40   public:
41     /**
42      * Exception classes
43      */
44     class Exception
45     {
46       public:
47         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
48         DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
49         DECLARE_EXCEPTION_TYPE(Base, FeatureNotExist)
50     };
51
52     // TODO: Move to feature_model.h
53     typedef std::set<std::string> DeviceCapabilitiesList;
54     typedef std::multimap<FeatureHandle, std::string> DeviceCapabilitiesMap;
55     typedef std::map<FeatureHandle, std::string> NameMap;
56     typedef std::map<FeatureHandle, FeatureData> FeatureMap;
57
58     static bool isDeviceCapabilityInstalled(const std::string &deviceCapName);
59
60     FeatureDAOReadOnly(FeatureHandle);
61     FeatureDAOReadOnly(const std::string &featureName);
62
63     static FeatureHandleListPtr GetFeatureHandleListForPlugin(
64         DbPluginHandle pluginHandle);
65
66     static bool isFeatureInstalled(const std::string &featureName);
67     static bool isFeatureInstalled(FeatureHandle handle);
68     static FeatureHandleList GetHandleList();
69
70     std::string             GetName() const;
71     FeatureHandle           GetFeatureHandle() const;
72     std::string             GetLibraryPath() const;
73     std::string             GetLibraryName() const;
74     DeviceCapabilitiesList  GetDeviceCapabilities() const;
75     DbPluginHandle          GetPluginHandle() const;
76
77     static NameMap                 GetNames();
78     static DeviceCapabilitiesMap   GetDevCapWithFeatureHandle();
79     static DeviceCapabilitySet GetDeviceCapability(const DPL::String &apifeature);
80
81     static FeatureMap GetFeatures(const std::list<std::string>& featureNames);
82
83   protected:
84     FeatureHandle m_featureHandle;
85 };
86 } // namespace WrtDB
87
88 #endif /* WRT_SRC_CONFIGURATION_FEATURE_DAO_READ_ONLY_H_ */