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 {
167 AppControlInfo(const DPL::String& operation) :
168 m_operation(operation),
169 m_disposition(Disposition::UNDEFINE),
173 DPL::String m_operation;
174 std::set <DPL::String> m_uriList;
175 std::set <DPL::String> m_mimeList;
176 Disposition m_disposition;
179 bool operator==(const AppControlInfo&) const;
180 bool operator!=(const AppControlInfo&) const;
183 typedef std::list<AppControlInfo> AppControlInfoList;
192 DPL::String m_preview;
193 DPL::String m_useDecoration;
195 typedef BoxSize BoxSizeInfo;
196 typedef std::list<BoxSizeInfo> BoxSizeList;
200 DPL::String m_boxSrc;
201 DPL::String m_boxMouseEvent;
202 DPL::String m_boxTouchEffect;
203 BoxSizeList m_boxSize;
205 DPL::String m_pdWidth;
206 DPL::String m_pdHeight;
207 DPL::String m_pdFastOpen;
209 typedef BoxContent BoxContentInfo;
211 typedef std::list<std::pair<DPL::String, DPL::String> > BoxLabelList;
213 BoxLabelList m_label;
215 DPL::String m_liveboxId;
216 DPL::String m_primary;
218 DPL::String m_autoLaunch;
219 DPL::String m_updatePeriod;
220 BoxContentInfo m_boxInfo;
222 bool operator==(const LiveboxInfo&) const;
223 bool operator!=(const LiveboxInfo&) const;
224 bool operator >(const LiveboxInfo&) const;
225 bool operator>=(const LiveboxInfo&) const;
226 bool operator <(const LiveboxInfo&) const;
227 bool operator<=(const LiveboxInfo&) const;
229 typedef std::list<DPL::Optional<LiveboxInfo> > LiveboxList;
237 typedef std::set<std::pair<IconSectionType, DPL::String>> IconSet;
238 typedef std::list<DPL::String> CapabilityList;
239 typedef std::set<std::pair<DPL::String, DPL::String>> DisplayNameSet;
241 struct AccountProvider
244 m_multiAccountSupport(false)
247 bool m_multiAccountSupport;
249 DisplayNameSet m_displayNameSet;
250 CapabilityList m_capabilityList;
253 typedef std::list<DPL::OptionalString> DependsPkgList;
254 typedef std::set<DPL::String> CategoryList;
256 struct AllowNavigationInfo
258 AllowNavigationInfo(DPL::String scheme,
263 DPL::String m_scheme;
266 typedef std::list<AllowNavigationInfo> AllowNavigationInfoList;
270 Metadata(const DPL::OptionalString& _key,
271 const DPL::OptionalString& _value) :
275 DPL::OptionalString key;
276 DPL::OptionalString value;
278 bool operator==(const Metadata&) const;
279 bool operator!=(const Metadata&) const;
281 typedef std::list<Metadata> MetadataList;
283 enum class SecurityModelVersion {
284 SECURITY_MODEL_V1 = 0, // WARP
285 SECURITY_MODEL_V2 // CSP, allow-navigation
288 LiveboxList m_livebox;
289 StringsList nameSpaces;
291 LocalizedDataSet localizedDataSet;
293 DPL::OptionalString authorName;
294 DPL::OptionalString authorHref;
295 DPL::OptionalString authorEmail;
297 FeaturesList featuresList;
298 PrivilegeList privilegeList;
300 SettingsList settingsList;
302 DPL::OptionalInt width;
303 DPL::OptionalInt height;
305 DPL::OptionalString widget_id;
306 DPL::OptionalString defaultlocale;
308 PreferencesList preferencesList;
310 DPL::OptionalString version;
311 StringsList windowModes;
313 AccessInfoSet accessInfoSet;
317 DPL::OptionalString minVersionRequired;
322 // Unlocalized data, to be processed by WidgetConfigurationManager
323 bool startFileEncountered;
324 DPL::OptionalString startFile;
325 DPL::OptionalString startFileEncoding;
326 DPL::OptionalString startFileContentType;
327 DPL::OptionalString startFileNamespace;
330 // tizen id / required platform min version for TIZEN webapp
331 DPL::OptionalString tizenMinVersionRequired;
332 DPL::OptionalString tizenPkgId;
333 DPL::OptionalString tizenAppId;
336 bool allowNavigationEncountered;
337 AllowNavigationInfoList allowNavigationInfoList;
339 //csp polic for widget
340 DPL::OptionalString cspPolicy;
341 DPL::OptionalString cspPolicyReportOnly;
343 //AppControl model list
344 AppControlInfoList appControlList;
346 // For link shared directory
347 DependsPkgList dependsPkgList;
349 DPL::OptionalString splashImgSrc;
350 // Background page filename
351 DPL::OptionalString backgroundPage;
353 CategoryList categoryList;
355 AccountProvider accountProvider;
356 // security model version
357 SecurityModelVersion securityModelVersion;
358 // security model version
359 MetadataList metadataList;
363 minVersionRequired(),
364 backSupported(false),
365 accessNetwork(false),
366 startFileEncountered(false),
367 allowNavigationEncountered(false),
368 securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1)
373 #endif //CONFIG_PARSER_DATA_H_