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_
33 #include <dpl/optional_typedefs.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;
56 std::string m_libraryName;
57 FeatureContainer m_featureContainer;
60 class PluginObjectsDAO
63 typedef std::set<std::string> Objects;
64 typedef std::shared_ptr<Objects> ObjectsPtr;
67 explicit PluginObjectsDAO() {}
70 ObjectsPtr m_implemented;
71 ObjectsPtr m_dependent;
75 * @brief Widget id describes web-runtime global widget identifier.
77 * Notice that only up to one widget can exist at the same time.
78 * DbWidgetHandle can be translated into corresponding WidgetModel by invoking
79 * FindWidgetModel routine.
81 typedef int DbWidgetHandle;
82 typedef DPL::String TizenPkgId;
83 typedef DPL::String TizenAppId;
84 typedef DPL::String WidgetPkgName;
87 * Value of invalid widget handle
90 INVALID_WIDGET_HANDLE = -1
94 * @brief Structure to hold the information of widget's size
98 DPL::OptionalInt width;
99 DPL::OptionalInt height;
101 DbWidgetSize(DPL::OptionalInt w = DPL::OptionalInt::Null,
102 DPL::OptionalInt h = DPL::OptionalInt::Null) :
108 inline bool operator ==(const DbWidgetSize &objA, const DbWidgetSize &objB)
110 if (!objA.height || !objA.width || !objB.width || !objB.height) {
113 return *objA.height == *objB.height && *objA.width == *objB.width;
118 * Widget [G]lobal [U]nique [ID]entifier
119 * Orginated from appstore ID
121 typedef DPL::OptionalString WidgetGUID;
123 struct WidgetAccessInfo
125 DPL::String strIRI; /* origin iri */
126 bool bSubDomains; /* do we want access to subdomains ? */
128 bool operator ==(const WidgetAccessInfo& info) const
130 return info.strIRI == strIRI &&
131 info.bSubDomains == bSubDomains;
135 struct EncryptedFileInfo
137 DPL::String fileName;
140 bool operator==(const EncryptedFileInfo& info) const
142 return fileName == info.fileName;
145 bool operator==(const DPL::String& file) const
147 return fileName == file;
150 bool operator< (const EncryptedFileInfo& info) const
152 return fileName < info.fileName;
156 typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
158 typedef std::list<DPL::String> WindowModeList;
160 typedef std::list<DPL::String> PrivilegeList;
162 typedef std::set<EncryptedFileInfo> EncryptedFileList;
165 * @brief Widget feature host information about possible javascript extensions
166 * that widget may use
168 * Widget features are declared in configuration file in widget installation
169 * package. Each declared special feature is contained in some wrt-plugin that
170 * declares to implement it. After widget launch wrt searches for proper plugin
171 * libraries and load needed features.
173 * Widget features can be required or optional. It is possible to start widget
174 * without missing feature. When required feature cannot be loaded widget will
179 INVALID_PLUGIN_HANDLE = -1
181 typedef int DbPluginHandle;
183 struct DbWidgetFeature
185 DPL::String name; /// Feature name
186 bool rejected; /// Api feature was rejected by ace
187 DbPluginHandle pluginId; /// Plugin id that implement this feature
190 pluginId(INVALID_PLUGIN_HANDLE)
194 inline bool operator < (const DbWidgetFeature &objA,
195 const DbWidgetFeature &objB)
197 return objA.name.compare(objB.name) < 0;
200 inline bool operator==(const DbWidgetFeature &featureA,
201 const DbWidgetFeature &featureB)
203 return featureA.name == featureB.name &&
204 featureA.pluginId == featureB.pluginId;
208 * @brief Default container for features list
210 typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
213 * @brief Default container with DbWidgetHandle's
215 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
217 typedef std::list<WidgetPkgName> WidgetPkgNameList; //TODO: this cannot be null
218 // -> appropriate changes in
220 typedef std::list<TizenAppId> TizenAppIdList; //TODO: this cannot be null ->
221 // appropriate changes in db
224 class WidgetDAOReadOnly; //forward declaration
225 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
227 * @brief Default container with WidgetDAOReadOnly
229 typedef std::list<WidgetDAOReadOnlyPtr> DbWidgetDAOReadOnlyList;
232 * @brief Widget specific type
234 * Widget type describes belowed in WAC, TIZEN WebApp
238 APP_TYPE_UNKNOWN = 0, // unknown
239 APP_TYPE_WAC20, // WAC 2.0
240 APP_TYPE_TIZENWEBAPP // Tizen webapp
247 appType(APP_TYPE_UNKNOWN)
249 WidgetType(const AppType type) :
252 bool operator== (const AppType& other) const
254 return appType == other;
256 bool operator!= (const AppType& other) const
258 return appType != other;
260 std::string getApptypeToString()
263 #define X(x) case x: return #x;
266 X(APP_TYPE_TIZENWEBAPP)
277 * @brief Package specific type
279 * Package type describes belowed in Tizen webapp, C++ service App
283 PKG_TYPE_UNKNOWN = 0, // unknown
284 PKG_TYPE_NOMAL_WEB_APP,
285 PKG_TYPE_DIRECTORY_WEB_APP,
286 PKG_TYPE_HOSTED_WEB_APP, // request from browser
287 PKG_TYPE_HYBRID_WEB_APP // Tizen webapp with C++ service app
294 pkgType(PKG_TYPE_UNKNOWN)
296 PackagingType(const PkgType type) :
299 bool operator== (const PkgType& other) const
301 return pkgType == other;
303 bool operator!= (const PkgType& other) const
305 return pkgType != other;
307 std::string getPkgtypeToString()
310 #define X(x) case x: return #x;
312 X(PKG_TYPE_NOMAL_WEB_APP)
313 X(PKG_TYPE_DIRECTORY_WEB_APP)
314 X(PKG_TYPE_HOSTED_WEB_APP)
315 X(PKG_TYPE_HYBRID_WEB_APP)
327 SETTINGS_TYPE_UNKNOWN = 0,
329 SETTINGS_TYPE_ALWAYS_ASK,
336 DPL::String settingName;
337 DPL::String settingValue;
339 bool operator ==(const WidgetSetting& info) const
341 return (info.settingName == settingName &&
342 info.settingValue == settingValue);
344 bool operator !=(const WidgetSetting& info) const
346 return (info.settingName != settingName ||
347 info.settingValue != settingValue);
351 typedef std::list<WidgetSetting> WidgetSettings;
354 * @brief Widget Application Service
356 * Application sercvice describes details of behaviour
357 * when widget receives aul bundle data.
359 struct WidgetApplicationService
361 enum class Disposition {
366 DPL::String src; /* start uri */
367 DPL::String operation; /* service name */
368 DPL::String scheme; /* scheme type*/
369 DPL::String mime; /* mime type */
370 Disposition disposition;
372 bool operator== (const WidgetApplicationService& other) const
374 return src == other.src &&
375 operation == other.operation &&
376 scheme == other.scheme &&
377 mime == other.mime &&
378 disposition == other.disposition;
382 typedef std::list<WidgetApplicationService> WidgetApplicationServiceList;
384 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */