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>
37 class PluginMetafileData
43 std::set<std::string> m_deviceCapabilities;
45 bool operator< (const Feature& obj) const
47 return m_name < obj.m_name;
50 typedef std::set<Feature> FeatureContainer;
58 std::string m_libraryName;
59 FeatureContainer m_featureContainer;
62 class PluginObjectsDAO
65 typedef std::set<std::string> Objects;
66 typedef DPL::SharedPtr<Objects> ObjectsPtr;
69 explicit PluginObjectsDAO() {}
72 ObjectsPtr m_implemented;
73 ObjectsPtr m_dependent;
77 * @brief Widget id describes web-runtime global widget identifier.
79 * Notice that only up to one widget can exist at the same time.
80 * DbWidgetHandle can be translated into corresponding WidgetModel by invoking
81 * FindWidgetModel routine.
83 typedef int DbWidgetHandle;
86 * Value of invalid widget handle
89 INVALID_WIDGET_HANDLE = -1
93 * @brief Structure to hold the information of widget's size
97 DPL::OptionalInt width;
98 DPL::OptionalInt height;
100 DbWidgetSize(DPL::OptionalInt w = DPL::OptionalInt::Null,
101 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::set<EncryptedFileInfo> EncryptedFileList;
163 * @brief Widget configuration parameter key
165 typedef DPL::String WidgetParamKey;
168 * @brief Widget configuration parameter value
170 typedef DPL::String WidgetParamValue;
173 * @brief A map of widget configuration parameters.
175 * Widget configuration parameters are read from database and are stored
176 * along with feature that they describe.
178 typedef std::multimap<WidgetParamKey, WidgetParamValue> WidgetParamMap;
181 * @brief Widget feature host information about possible javascript extensions
182 * that widget may use
184 * Widget features are declared in configuration file in widget installation
185 * package. Each declared special feature is contained in some wrt-plugin that
186 * declares to implement it. After widget launch wrt searches for proper plugin
187 * libraries and load needed features.
189 * Widget features can be required or optional. It is possible to start widget
190 * without missing feature. When required feature cannot be loaded widget will
195 INVALID_PLUGIN_HANDLE = -1
197 typedef int DbPluginHandle;
199 struct DbWidgetFeature
201 DPL::String name; /// Feature name
202 bool required; /// Whether feature is required
203 bool rejected; /// Api feature was rejected by ace
204 DbPluginHandle pluginId; /// Plugin id that implement this feature
205 WidgetParamMap params; /// Widget's params
209 pluginId(INVALID_PLUGIN_HANDLE)
214 inline bool operator < (const DbWidgetFeature &objA,
215 const DbWidgetFeature &objB)
217 return objA.name.compare(objB.name) < 0;
220 inline bool operator==(const DbWidgetFeature &featureA,
221 const DbWidgetFeature &featureB)
223 return featureA.name == featureB.name &&
224 featureA.required == featureB.required &&
225 featureA.pluginId == featureB.pluginId;
229 * @brief Default container for features list
231 typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
234 * @brief Default container with DbWidgetHandle's
236 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
238 class WidgetDAOReadOnly; //forward declaration
239 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
241 * @brief Default container with WidgetDAOReadOnly
243 typedef std::list<WidgetDAOReadOnlyPtr> DbWidgetDAOReadOnlyList;
246 * @brief Widget specific type
248 * Widget type describes belowed in WAC, TIZEN WebApp
252 APP_TYPE_UNKNOWN = 0, // unknown
253 APP_TYPE_WAC20, // WAC 2.0
254 APP_TYPE_TIZENWEBAPP, // Tizen webapp
261 :appType(APP_TYPE_UNKNOWN)
264 WidgetType(const AppType type)
268 bool operator== (const AppType& other) const
270 return appType == other;
272 std::string getApptypeToString()
275 #define X(x) case x: return #x;
278 X(APP_TYPE_TIZENWEBAPP)
289 * @brief Package specific type
291 * Package type describes belowed in Tizen webapp, C++ service App
295 PKG_TYPE_UNKNOWN = 0, // unknown
296 PKG_TYPE_TIZEN_WEBAPP, // Tizen webapp
297 PKG_TYPE_TIZEN_WITHSVCAPP, // Tizen webapp with C++ service app
304 :pkgType(PKG_TYPE_UNKNOWN)
307 PkgType(const PackagingType type)
311 bool operator== (const PackagingType& other) const
313 return pkgType == other;
315 std::string getPkgtypeToString()
318 #define X(x) case x: return #x;
320 X(PKG_TYPE_TIZEN_WEBAPP)
321 X(PKG_TYPE_TIZEN_WITHSVCAPP)
328 PackagingType pkgType;
335 DPL::String settingName;
336 DPL::String settingValue;
338 bool operator ==(const WidgetSetting& info) const
340 return (info.settingName == settingName &&
341 info.settingValue == settingValue);
343 bool operator !=(const WidgetSetting& info) const
345 return (info.settingName != settingName ||
346 info.settingValue != settingValue);
350 typedef std::list<WidgetSetting> WidgetSettings;
353 * @brief Widget Application Service
355 * Application sercvice describes details of behaviour
356 * when widget receives aul bundle data.
358 struct WidgetApplicationService
361 DPL::String src; /* start uri */
362 DPL::String operation; /* service name */
363 DPL::String scheme; /* scheme type*/
364 DPL::String mime; /* mime type */
366 bool operator== (const WidgetApplicationService& other) const
368 return src == other.src &&
369 operation == other.operation &&
370 scheme == other.scheme &&
375 typedef std::list<WidgetApplicationService> WidgetApplicationServiceList;
377 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */