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 FeatureContainer m_featureContainer;
61 class PluginObjectsDAO
64 typedef std::set<std::string> Objects;
65 typedef DPL::SharedPtr<Objects> ObjectsPtr;
68 explicit PluginObjectsDAO() {}
71 ObjectsPtr m_implemented;
72 ObjectsPtr m_dependent;
76 * @brief Widget id describes web-runtime global widget identifier.
78 * Notice that only up to one widget can exist at the same time.
79 * DbWidgetHandle can be translated into corresponding WidgetModel by invoking
80 * FindWidgetModel routine.
82 typedef int DbWidgetHandle;
85 * Value of invalid widget handle
88 INVALID_WIDGET_HANDLE = -1
92 * @brief Structure to hold the information of widget's size
96 DPL::OptionalInt width;
97 DPL::OptionalInt height;
99 DbWidgetSize(DPL::OptionalInt w = DPL::OptionalInt::Null,
100 DPL::OptionalInt h = DPL::OptionalInt::Null) :
107 inline bool operator ==(const DbWidgetSize &objA, const DbWidgetSize &objB)
109 if (!objA.height || !objA.width || !objB.width || !objB.height) {
112 return *objA.height == *objB.height && *objA.width == *objB.width;
117 * Widget [G]lobal [U]nique [ID]entifier
118 * Orginated from appstore ID
120 typedef DPL::OptionalString WidgetGUID;
122 struct WidgetAccessInfo
124 DPL::String strIRI; /* origin iri */
125 bool bSubDomains; /* do we want access to subdomains ? */
127 bool operator ==(const WidgetAccessInfo& info) const
129 return info.strIRI == strIRI &&
130 info.bSubDomains == bSubDomains;
134 typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
136 typedef std::list<DPL::String> WindowModeList;
139 * @brief Widget configuration parameter key
141 typedef DPL::String WidgetParamKey;
144 * @brief Widget configuration parameter value
146 typedef DPL::String WidgetParamValue;
149 * @brief A map of widget configuration parameters.
151 * Widget configuration parameters are read from database and are stored
152 * along with feature that they describe.
154 typedef std::multimap<WidgetParamKey, WidgetParamValue> WidgetParamMap;
157 * @brief Widget feature host information about possible javascript extensions
158 * that widget may use
160 * Widget features are declared in configuration file in widget installation
161 * package. Each declared special feature is contained in some wrt-plugin that
162 * declares to implement it. After widget launch wrt searches for proper plugin
163 * libraries and load needed features.
165 * Widget features can be required or optional. It is possible to start widget
166 * without missing feature. When required feature cannot be loaded widget will
171 INVALID_PLUGIN_HANDLE = -1
173 typedef int DbPluginHandle;
175 struct DbWidgetFeature
177 DPL::String name; /// Feature name
178 bool required; /// Whether feature is required
179 bool rejected; /// Api feature was rejected by ace
180 DbPluginHandle pluginId; /// Plugin id that implement this feature
181 WidgetParamMap params; /// Widget's params
185 pluginId(INVALID_PLUGIN_HANDLE)
190 inline bool operator < (const DbWidgetFeature &objA,
191 const DbWidgetFeature &objB)
193 return objA.name.compare(objB.name) < 0;
196 inline bool operator==(const DbWidgetFeature &featureA,
197 const DbWidgetFeature &featureB)
199 return featureA.name == featureB.name &&
200 featureA.required == featureB.required &&
201 featureA.pluginId == featureB.pluginId;
205 * @brief Default container for features list
207 typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
210 * @brief Default container with DbWidgetHandle's
212 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
215 * @brief Widget specific type
217 * Widget type describes belowed in WAC, TIZEN WebApp
221 APP_TYPE_UNKNOWN = 0, // unknown
222 APP_TYPE_WAC20, // WAC 2.0
223 APP_TYPE_TIZENWEBAPP, // Tizen webapp
230 :appType(APP_TYPE_UNKNOWN)
233 WidgetType(const AppType type)
237 bool operator== (const AppType& other) const
239 return appType == other;
241 std::string getApptypeToString()
244 #define X(x) case x: return #x;
247 X(APP_TYPE_TIZENWEBAPP)
258 * @brief Package specific type
260 * Package type describes belowed in Tizen webapp, C++ service App
264 PKG_TYPE_UNKNOWN = 0, // unknown
265 PKG_TYPE_TIZEN_WEBAPP, // Tizen webapp
266 PKG_TYPE_TIZEN_WITHSVCAPP, // Tizen webapp with C++ service app
273 :pkgType(PKG_TYPE_UNKNOWN)
276 PkgType(const PackagingType type)
280 bool operator== (const PackagingType& other) const
282 return pkgType == other;
284 std::string getPkgtypeToString()
287 #define X(x) case x: return #x;
289 X(PKG_TYPE_TIZEN_WEBAPP)
290 X(PKG_TYPE_TIZEN_WITHSVCAPP)
297 PackagingType pkgType;
304 DPL::String settingName;
305 DPL::String settingValue;
307 bool operator ==(const WidgetSetting& info) const
309 return (info.settingName == settingName &&
310 info.settingValue == settingValue);
312 bool operator !=(const WidgetSetting& info) const
314 return (info.settingName != settingName ||
315 info.settingValue != settingValue);
319 typedef std::list<WidgetSetting> WidgetSettings;
322 * @brief Widget Application Service
324 * Application sercvice describes details of behaviour
325 * when widget receives aul bundle data.
327 struct WidgetApplicationService
330 DPL::String src; /* start uri */
331 DPL::String operation; /* service name */
332 DPL::String scheme; /* scheme type*/
333 DPL::String mime; /* mime type */
335 bool operator== (const WidgetApplicationService& other) const
337 return src == other.src &&
338 operation == other.operation &&
339 scheme == other.scheme &&
344 typedef std::list<WidgetApplicationService> WidgetApplicationServiceList;
346 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */