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 struct EncryptedFileInfo
136 DPL::String fileName;
139 bool operator==(const EncryptedFileInfo& info) const
141 return fileName == info.fileName;
144 bool operator==(const DPL::String& file) const
146 return fileName == file;
149 bool operator< (const EncryptedFileInfo& info) const
151 return fileName < info.fileName;
155 typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
157 typedef std::list<DPL::String> WindowModeList;
159 typedef std::set<EncryptedFileInfo> EncryptedFileList;
162 * @brief Widget configuration parameter key
164 typedef DPL::String WidgetParamKey;
167 * @brief Widget configuration parameter value
169 typedef DPL::String WidgetParamValue;
172 * @brief A map of widget configuration parameters.
174 * Widget configuration parameters are read from database and are stored
175 * along with feature that they describe.
177 typedef std::multimap<WidgetParamKey, WidgetParamValue> WidgetParamMap;
180 * @brief Widget feature host information about possible javascript extensions
181 * that widget may use
183 * Widget features are declared in configuration file in widget installation
184 * package. Each declared special feature is contained in some wrt-plugin that
185 * declares to implement it. After widget launch wrt searches for proper plugin
186 * libraries and load needed features.
188 * Widget features can be required or optional. It is possible to start widget
189 * without missing feature. When required feature cannot be loaded widget will
194 INVALID_PLUGIN_HANDLE = -1
196 typedef int DbPluginHandle;
198 struct DbWidgetFeature
200 DPL::String name; /// Feature name
201 bool required; /// Whether feature is required
202 bool rejected; /// Api feature was rejected by ace
203 DbPluginHandle pluginId; /// Plugin id that implement this feature
204 WidgetParamMap params; /// Widget's params
208 pluginId(INVALID_PLUGIN_HANDLE)
213 inline bool operator < (const DbWidgetFeature &objA,
214 const DbWidgetFeature &objB)
216 return objA.name.compare(objB.name) < 0;
219 inline bool operator==(const DbWidgetFeature &featureA,
220 const DbWidgetFeature &featureB)
222 return featureA.name == featureB.name &&
223 featureA.required == featureB.required &&
224 featureA.pluginId == featureB.pluginId;
228 * @brief Default container for features list
230 typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
233 * @brief Default container with DbWidgetHandle's
235 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
238 * @brief Widget specific type
240 * Widget type describes belowed in WAC, TIZEN WebApp
244 APP_TYPE_UNKNOWN = 0, // unknown
245 APP_TYPE_WAC20, // WAC 2.0
246 APP_TYPE_TIZENWEBAPP, // Tizen webapp
253 :appType(APP_TYPE_UNKNOWN)
256 WidgetType(const AppType type)
260 bool operator== (const AppType& other) const
262 return appType == other;
264 std::string getApptypeToString()
267 #define X(x) case x: return #x;
270 X(APP_TYPE_TIZENWEBAPP)
281 * @brief Package specific type
283 * Package type describes belowed in Tizen webapp, C++ service App
287 PKG_TYPE_UNKNOWN = 0, // unknown
288 PKG_TYPE_TIZEN_WEBAPP, // Tizen webapp
289 PKG_TYPE_TIZEN_WITHSVCAPP, // Tizen webapp with C++ service app
296 :pkgType(PKG_TYPE_UNKNOWN)
299 PkgType(const PackagingType type)
303 bool operator== (const PackagingType& other) const
305 return pkgType == other;
307 std::string getPkgtypeToString()
310 #define X(x) case x: return #x;
312 X(PKG_TYPE_TIZEN_WEBAPP)
313 X(PKG_TYPE_TIZEN_WITHSVCAPP)
320 PackagingType pkgType;
327 DPL::String settingName;
328 DPL::String settingValue;
330 bool operator ==(const WidgetSetting& info) const
332 return (info.settingName == settingName &&
333 info.settingValue == settingValue);
335 bool operator !=(const WidgetSetting& info) const
337 return (info.settingName != settingName ||
338 info.settingValue != settingValue);
342 typedef std::list<WidgetSetting> WidgetSettings;
345 * @brief Widget Application Service
347 * Application sercvice describes details of behaviour
348 * when widget receives aul bundle data.
350 struct WidgetApplicationService
353 DPL::String src; /* start uri */
354 DPL::String operation; /* service name */
355 DPL::String scheme; /* scheme type*/
356 DPL::String mime; /* mime type */
358 bool operator== (const WidgetApplicationService& other) const
360 return src == other.src &&
361 operation == other.operation &&
362 scheme == other.scheme &&
367 typedef std::list<WidgetApplicationService> WidgetApplicationServiceList;
369 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */