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.
18 * @file common_dao_types.h
19 * @author Michal Ciepielski (m.ciepielski@samsung.com)
21 * @brief This file contains the declaration of common data types for wrtdb
24 #ifndef WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_
25 #define WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_
32 #include <dpl/optional_typedefs.h>
33 #include <dpl/shared_ptr.h>
36 class PluginMetafileData
42 std::set<std::string> m_deviceCapabilities;
44 bool operator< (const Feature& obj) const
46 return m_name < obj.m_name;
49 typedef std::set<Feature> FeatureContainer;
57 std::string m_libraryName;
58 std::string m_featuresInstallURI;
59 std::string m_featuresKeyCN;
60 std::string m_featuresRootCN;
61 std::string m_featuresRootFingerprint;
63 FeatureContainer m_featureContainer;
66 class PluginObjectsDAO
69 typedef std::set<std::string> Objects;
70 typedef DPL::SharedPtr<Objects> ObjectsPtr;
73 explicit PluginObjectsDAO() {}
76 ObjectsPtr m_implemented;
77 ObjectsPtr m_dependent;
81 * @brief Widget id describes web-runtime global widget identifier.
83 * Notice that only up to one widget can exist at the same time.
84 * DbWidgetHandle can be translated into corresponding WidgetModel by invoking
85 * FindWidgetModel routine.
87 typedef int DbWidgetHandle;
90 * @brief Structure to hold the information of widget's size
94 DPL::OptionalInt width;
95 DPL::OptionalInt height;
97 DbWidgetSize(DPL::OptionalInt w = DPL::OptionalInt::Null,
98 DPL::OptionalInt h = DPL::OptionalInt::Null) :
105 inline bool operator ==(const DbWidgetSize &objA, const DbWidgetSize &objB)
107 if (!objA.height || !objA.width || !objB.width || !objB.height) {
110 return *objA.height == *objB.height && *objA.width == *objB.width;
115 * Widget [G]lobal [U]nique [ID]entifier
116 * Orginated from appstore ID
118 typedef DPL::OptionalString WidgetGUID;
120 struct WidgetAccessInfo
122 DPL::String strIRI; /* origin iri */
123 bool bSubDomains; /* do we want access to subdomains ? */
125 bool operator ==(const WidgetAccessInfo& info) const
127 return info.strIRI == strIRI &&
128 info.bSubDomains == bSubDomains;
132 typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
134 typedef std::list<DPL::String> WindowModeList;
137 * @brief Widget configuration parameter key
139 typedef DPL::String WidgetParamKey;
142 * @brief Widget configuration parameter value
144 typedef DPL::String WidgetParamValue;
147 * @brief A map of widget configuration parameters.
149 * Widget configuration parameters are read from database and are stored
150 * along with feature that they describe.
152 typedef std::multimap<WidgetParamKey, WidgetParamValue> WidgetParamMap;
155 * @brief Widget feature host information about possible javascript extensions
156 * that widget may use
158 * Widget features are declared in configuration file in widget installation
159 * package. Each declared special feature is contained in some wrt-plugin that
160 * declares to implement it. After widget launch wrt searches for proper plugin
161 * libraries and load needed features.
163 * Widget features can be required or optional. It is possible to start widget
164 * without missing feature. When required feature cannot be loaded widget will
169 INVALID_PLUGIN_HANDLE = -1
171 typedef int DbPluginHandle;
173 struct DbWidgetFeature
175 DPL::String name; /// Feature name
176 bool required; /// Whether feature is required
177 bool rejected; /// Api feature was rejected by ace
178 DbPluginHandle pluginId; /// Plugin id that implement this feature
179 WidgetParamMap params; /// Widget's params
183 pluginId(INVALID_PLUGIN_HANDLE)
188 inline bool operator < (const DbWidgetFeature &objA,
189 const DbWidgetFeature &objB)
191 return objA.name.compare(objB.name) < 0;
194 inline bool operator==(const DbWidgetFeature &featureA,
195 const DbWidgetFeature &featureB)
197 return featureA.name == featureB.name &&
198 featureA.required == featureB.required &&
199 featureA.pluginId == featureB.pluginId;
203 * @brief Default container for features list
205 typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
208 * @brief Default container with DbWidgetHandle's
210 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
213 * @brief Widget specific type
215 * Widget type describes belowed in WAC, TIZEN WebApp
219 APP_TYPE_UNKNOWN = 0, // unknown
220 APP_TYPE_WAC10, // WAC 1.0
221 APP_TYPE_WAC20, // WAC 2.0
222 APP_TYPE_TIZENWEBAPP, // Tizen webapp
229 :appType(APP_TYPE_UNKNOWN)
232 WidgetType(const AppType type)
236 bool operator== (const AppType& other) const
238 return appType == other;
240 std::string getApptypeToString()
243 #define X(x) case x: return #x;
247 X(APP_TYPE_TIZENWEBAPP)
261 DPL::String settingName;
262 DPL::String settingValue;
264 bool operator ==(const WidgetSetting& info) const
266 return (info.settingName == settingName &&
267 info.settingValue == settingValue);
269 bool operator !=(const WidgetSetting& info) const
271 return (info.settingName != settingName ||
272 info.settingValue != settingValue);
276 typedef std::list<WidgetSetting> WidgetSettings;
279 * @brief Widget Application Service
281 * Application sercvice describes details of behaviour
282 * when widget receives aul bundle data.
284 struct WidgetApplicationService
287 DPL::String src; /* start uri */
288 DPL::String operation; /* service name */
289 DPL::String scheme; /* scheme type*/
290 DPL::String mime; /* mime type */
292 bool operator== (const WidgetApplicationService& other) const
294 return src == other.src &&
295 operation == other.operation &&
296 scheme == other.scheme &&
301 typedef std::list<WidgetApplicationService> WidgetApplicationServiceList;
303 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */