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.
17 * @file config_parser_data.h
18 * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
22 #ifndef CONFIG_PARSER_DATA_H_
23 #define CONFIG_PARSER_DATA_H_
29 #include <dpl/optional_typedefs.h>
30 #include <dpl/string.h>
34 void NormalizeString(DPL::OptionalString& txt, bool isTrimSpace = false);
35 void NormalizeString(DPL::String& str);
36 DPL::String GetSingleAttributeValue(const DPL::String value);
37 void NormalizeAndTrimSpaceString(DPL::OptionalString& txt);
39 class WidgetConfigurationManager;
41 class ConfigParserData
46 Feature(const DPL::String& _name) : name(_name)
50 bool operator==(const Feature&) const;
51 bool operator!=(const Feature&) const;
52 bool operator >(const Feature&) const;
53 bool operator>=(const Feature&) const;
54 bool operator <(const Feature&) const;
55 bool operator<=(const Feature&) const;
57 typedef std::set<Feature> FeaturesList;
61 Privilege(const DPL::String& _name) : name(_name)
65 bool operator==(const Privilege&) const;
66 bool operator!=(const Privilege&) const;
67 bool operator >(const Privilege&) const;
68 bool operator>=(const Privilege&) const;
69 bool operator <(const Privilege&) const;
70 bool operator<=(const Privilege&) const;
72 typedef std::set<Privilege> PrivilegeList;
76 Icon(const DPL::String& _src) : src(_src)
79 DPL::OptionalInt width;
80 DPL::OptionalInt height;
81 bool operator==(const Icon&) const;
82 bool operator!=(const Icon&) const;
83 bool operator >(const Icon&) const;
84 bool operator>=(const Icon&) const;
85 bool operator <(const Icon&) const;
86 bool operator<=(const Icon&) const;
88 typedef std::list<Icon> IconsList;
92 DPL::OptionalString name;
93 DPL::OptionalString shortName;
95 DPL::OptionalString description;
97 DPL::OptionalString license;
98 DPL::OptionalString licenseFile;
99 DPL::OptionalString licenseHref;
101 typedef std::map<DPL::String, LocalizedData> LocalizedDataSet;
105 Preference(const DPL::String& _name,
106 bool _readonly = false) :
112 DPL::OptionalString value;
114 bool operator==(const Preference&) const;
115 bool operator!=(const Preference&) const;
116 bool operator >(const Preference&) const;
117 bool operator>=(const Preference&) const;
118 bool operator <(const Preference&) const;
119 bool operator<=(const Preference&) const;
121 typedef std::set<Preference> PreferencesList;
122 typedef std::set<DPL::String> StringsList;
126 AccessInfo(const DPL::String& strIRI,
127 bool bSubdomainAccess) : m_strIRI(strIRI),
128 m_bSubDomainAccess(bSubdomainAccess)
131 bool operator==(const AccessInfo&) const;
132 bool operator!=(const AccessInfo&) const;
133 bool operator <(const AccessInfo&) const;
135 DPL::String m_strIRI;
136 bool m_bSubDomainAccess;
138 typedef std::set<AccessInfo> AccessInfoSet;
142 Setting(const DPL::String& name,
143 const DPL::String& value) :
150 bool operator==(const Setting&) const;
151 bool operator!=(const Setting&) const;
152 bool operator >(const Setting&) const;
153 bool operator>=(const Setting&) const;
154 bool operator <(const Setting&) const;
155 bool operator<=(const Setting&) const;
158 typedef std::set<Setting> SettingsList;
160 struct AppControlInfo
162 enum class Disposition {
166 AppControlInfo(const DPL::String& operation) :
167 m_operation(operation),
171 DPL::String m_operation;
172 std::set <DPL::String> m_uriList;
173 std::set <DPL::String> m_mimeList;
174 Disposition m_disposition;
177 bool operator==(const AppControlInfo&) const;
178 bool operator!=(const AppControlInfo&) const;
181 typedef std::list<AppControlInfo> AppControlInfoList;
183 typedef std::list<std::pair<DPL::String, DPL::String> > BoxSizeList;
191 DPL::String m_boxSrc;
192 DPL::String m_boxMouseEvent;
193 DPL::String m_boxTouchEffect;
194 BoxSizeList m_boxSize;
196 DPL::String m_pdWidth;
197 DPL::String m_pdHeight;
198 DPL::String m_pdFastOpen;
200 typedef BoxContent BoxContentInfo;
204 DPL::String m_liveboxId;
205 DPL::String m_primary;
207 DPL::String m_autoLaunch;
208 DPL::String m_updatePeriod;
209 BoxContentInfo m_boxInfo;
211 bool operator==(const LiveboxInfo&) const;
212 bool operator!=(const LiveboxInfo&) const;
213 bool operator >(const LiveboxInfo&) const;
214 bool operator>=(const LiveboxInfo&) const;
215 bool operator <(const LiveboxInfo&) const;
216 bool operator<=(const LiveboxInfo&) const;
218 typedef std::list<DPL::Optional<LiveboxInfo> > LiveboxList;
226 typedef std::set<std::pair<IconSectionType, DPL::String>> IconSet;
227 typedef std::list<DPL::String> CapabilityList;
228 typedef std::set<std::pair<DPL::String, DPL::String>> DisplayNameSet;
230 struct AccountProvider
233 m_multiAccountSupport(false)
236 bool m_multiAccountSupport;
238 DisplayNameSet m_displayNameSet;
239 CapabilityList m_capabilityList;
242 typedef std::list<DPL::OptionalString> DependsPkgList;
243 typedef std::set<DPL::String> CategoryList;
245 struct AllowNavigationInfo
247 AllowNavigationInfo(DPL::String scheme,
252 DPL::String m_scheme;
255 typedef std::list<AllowNavigationInfo> AllowNavigationInfoList;
257 enum class SecurityModelVersion {
258 SECURITY_MODEL_V1 = 0, // WARP
259 SECURITY_MODEL_V2 // CSP, allow-navigation
262 LiveboxList m_livebox;
263 StringsList nameSpaces;
265 LocalizedDataSet localizedDataSet;
267 DPL::OptionalString authorName;
268 DPL::OptionalString authorHref;
269 DPL::OptionalString authorEmail;
271 FeaturesList featuresList;
272 PrivilegeList privilegeList;
274 SettingsList settingsList;
276 DPL::OptionalInt width;
277 DPL::OptionalInt height;
279 DPL::OptionalString widget_id;
280 DPL::OptionalString defaultlocale;
282 PreferencesList preferencesList;
284 DPL::OptionalString version;
285 StringsList windowModes;
287 AccessInfoSet accessInfoSet;
291 DPL::OptionalString minVersionRequired;
296 // Unlocalized data, to be processed by WidgetConfigurationManager
297 bool startFileEncountered;
298 DPL::OptionalString startFile;
299 DPL::OptionalString startFileEncoding;
300 DPL::OptionalString startFileContentType;
303 // tizen id / required platform min version for TIZEN webapp
304 DPL::OptionalString tizenMinVersionRequired;
305 DPL::OptionalString tizenPkgId;
306 DPL::OptionalString tizenAppId;
309 AllowNavigationInfoList allowNavigationInfoList;
311 //csp polic for widget
312 DPL::OptionalString cspPolicy;
313 DPL::OptionalString cspPolicyReportOnly;
315 //AppControl model list
316 AppControlInfoList appControlList;
318 // For link shared directory
319 DependsPkgList dependsPkgList;
321 DPL::OptionalString splashImgSrc;
322 // Background page filename
323 DPL::OptionalString backgroundPage;
325 CategoryList categoryList;
327 AccountProvider accountProvider;
328 // security model version
329 SecurityModelVersion securityModelVersion;
333 minVersionRequired(),
334 backSupported(false),
335 accessNetwork(false),
336 startFileEncountered(false),
337 securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1)
342 #endif //CONFIG_PARSER_DATA_H_