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 <boost/optional.hpp>
30 #include <dpl/optional_typedefs.h>
31 #include <dpl/string.h>
32 #include <dpl/platform.h>
36 void NormalizeString(DPL::OptionalString& txt, bool isTrimSpace = false);
37 void NormalizeString(DPL::String& str);
38 DPL::String GetSingleAttributeValue(const DPL::String value);
39 void NormalizeAndTrimSpaceString(DPL::OptionalString& txt);
40 #if ENABLE(ELEMENT_ATTR_MAX_LENGTH)
41 void NormalizeString(DPL::String& str, const unsigned int length, bool showEllipsis = false);
42 void NormalizeString(DPL::OptionalString& str, const unsigned int length, bool showEllipsis = false);
43 void NormalizeAndTrimSpaceString(DPL::OptionalString& str, const unsigned int length);
44 #endif // ELEMENT_ATTR_MAX_LENGTH
46 class WidgetConfigurationManager;
48 class ConfigParserData
53 Feature(const DPL::String& _name) : name(_name)
57 bool operator==(const Feature&) const;
58 bool operator!=(const Feature&) const;
59 bool operator >(const Feature&) const;
60 bool operator>=(const Feature&) const;
61 bool operator <(const Feature&) const;
62 bool operator<=(const Feature&) const;
64 typedef std::set<Feature> FeaturesList;
68 Privilege(const DPL::String& _name) : name(_name)
72 bool operator==(const Privilege&) const;
73 bool operator!=(const Privilege&) const;
74 bool operator >(const Privilege&) const;
75 bool operator>=(const Privilege&) const;
76 bool operator <(const Privilege&) const;
77 bool operator<=(const Privilege&) const;
79 typedef std::set<Privilege> PrivilegeList;
83 Icon(const DPL::String& _src) : src(_src), isSmall(false)
86 DPL::OptionalInt width;
87 DPL::OptionalInt height;
89 bool operator==(const Icon&) const;
90 bool operator!=(const Icon&) const;
91 bool operator >(const Icon&) const;
92 bool operator>=(const Icon&) const;
93 bool operator <(const Icon&) const;
94 bool operator<=(const Icon&) const;
96 typedef std::list<Icon> IconsList;
100 DPL::OptionalString name;
101 DPL::OptionalString shortName;
103 DPL::OptionalString description;
105 DPL::OptionalString license;
106 DPL::OptionalString licenseFile;
107 DPL::OptionalString licenseHref;
109 typedef std::map<DPL::String, LocalizedData> LocalizedDataSet;
113 Preference(const DPL::String& _name,
114 bool _readonly = false) :
120 DPL::OptionalString value;
122 bool operator==(const Preference&) const;
123 bool operator!=(const Preference&) const;
124 bool operator >(const Preference&) const;
125 bool operator>=(const Preference&) const;
126 bool operator <(const Preference&) const;
127 bool operator<=(const Preference&) const;
129 typedef std::set<Preference> PreferencesList;
130 typedef std::set<DPL::String> StringsList;
134 AccessInfo(const DPL::String& strIRI,
135 bool bSubdomainAccess) : m_strIRI(strIRI),
136 m_bSubDomainAccess(bSubdomainAccess)
139 bool operator==(const AccessInfo&) const;
140 bool operator!=(const AccessInfo&) const;
141 bool operator <(const AccessInfo&) const;
143 DPL::String m_strIRI;
144 bool m_bSubDomainAccess;
146 typedef std::set<AccessInfo> AccessInfoSet;
150 Setting(const DPL::String& name,
151 const DPL::String& value) :
158 bool operator==(const Setting&) const;
159 bool operator!=(const Setting&) const;
160 bool operator >(const Setting&) const;
161 bool operator>=(const Setting&) const;
162 bool operator <(const Setting&) const;
163 bool operator<=(const Setting&) const;
166 typedef std::set<Setting> SettingsList;
168 struct AppControlInfo
170 AppControlInfo(const DPL::String& operation) :
171 m_operation(operation)
174 DPL::String m_operation;
175 std::set <DPL::String> m_uriList;
176 std::set <DPL::String> m_mimeList;
177 DPL::String m_reload;
179 bool operator==(const AppControlInfo&) const;
180 bool operator!=(const AppControlInfo&) const;
183 typedef std::list<AppControlInfo> AppControlInfoList;
185 #if USE(WEB_PROVIDER)
193 DPL::String m_preview;
194 DPL::String m_useDecoration;
196 typedef BoxSize BoxSizeInfo;
197 typedef std::list<BoxSizeInfo> BoxSizeList;
201 DPL::String m_boxSrc;
202 DPL::String m_boxMouseEvent;
203 DPL::String m_boxTouchEffect;
204 BoxSizeList m_boxSize;
206 DPL::String m_pdWidth;
207 DPL::String m_pdHeight;
208 DPL::String m_pdFastOpen;
210 typedef BoxContent BoxContentInfo;
212 typedef std::list<std::pair<DPL::String, DPL::String> > BoxLabelList;
214 BoxLabelList m_label;
216 DPL::String m_liveboxId;
217 DPL::String m_primary;
219 DPL::String m_autoLaunch;
220 DPL::String m_updatePeriod;
221 BoxContentInfo m_boxInfo;
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;
228 bool operator<=(const LiveboxInfo&) const;
230 typedef boost::optional<LiveboxInfo> OptionalLiveboxInfo;
231 typedef std::list<OptionalLiveboxInfo> LiveboxList;
240 typedef std::set<std::pair<IconSectionType, DPL::String>> IconSet;
241 typedef std::list<DPL::String> CapabilityList;
242 typedef std::set<std::pair<DPL::String, DPL::String>> DisplayNameSet;
244 struct AccountProvider
247 m_multiAccountSupport(false)
250 bool m_multiAccountSupport;
252 DisplayNameSet m_displayNameSet;
253 CapabilityList m_capabilityList;
256 typedef std::list<DPL::OptionalString> DependsPkgList;
257 typedef std::set<DPL::String> CategoryList;
258 typedef std::set<DPL::String> BackgroundCategoryList;
260 struct AllowNavigationInfo
262 AllowNavigationInfo(DPL::String scheme,
267 DPL::String m_scheme;
270 typedef std::list<AllowNavigationInfo> AllowNavigationInfoList;
274 Metadata(const DPL::OptionalString& _key,
275 const DPL::OptionalString& _value) :
279 DPL::OptionalString key;
280 DPL::OptionalString value;
282 bool operator==(const Metadata&) const;
283 bool operator!=(const Metadata&) const;
285 typedef std::list<Metadata> MetadataList;
290 typedef std::set<DPL::String> LanguageList;
291 LanguageList languageList;
293 typedef std::list<ImeAppInfo> ImeAppInfoList;
295 struct ServiceAppInfo
297 ServiceAppInfo() : onBoot(false), autoRestart(false) { }
299 DPL::String serviceId;
302 LocalizedDataSet m_localizedDataSet;
303 DPL::String serviceContent;
304 IconsList m_iconsList;
305 MetadataList m_metadataList;
306 CategoryList m_categoryList;
308 typedef std::list<ServiceAppInfo> ServiceAppInfoList;
310 enum class SecurityModelVersion {
311 SECURITY_MODEL_V1 = 0, // WARP
312 SECURITY_MODEL_V2 // CSP, allow-navigation
314 #if USE(WEB_PROVIDER)
315 LiveboxList m_livebox;
317 StringsList nameSpaces;
319 LocalizedDataSet localizedDataSet;
321 DPL::OptionalString authorName;
322 DPL::OptionalString authorHref;
323 DPL::OptionalString authorEmail;
325 FeaturesList featuresList;
326 PrivilegeList privilegeList;
328 SettingsList settingsList;
330 DPL::OptionalInt width;
331 DPL::OptionalInt height;
333 DPL::OptionalString widget_id;
334 DPL::OptionalString defaultlocale;
336 PreferencesList preferencesList;
338 DPL::OptionalString version;
339 StringsList windowModes;
341 AccessInfoSet accessInfoSet;
345 DPL::OptionalString minVersionRequired;
350 // Unlocalized data, to be processed by WidgetConfigurationManager
351 bool startFileEncountered;
352 DPL::OptionalString startFile;
353 DPL::OptionalString startFileEncoding;
354 DPL::OptionalString startFileContentType;
355 DPL::OptionalString startFileNamespace;
358 // tizen id / required platform min version for TIZEN webapp
359 DPL::OptionalString tizenMinVersionRequired;
360 DPL::OptionalString tizenPkgId;
361 DPL::OptionalString tizenAppId;
362 bool didFoundTizenApplicationElement;
364 // LaunchMode(caller, single)
365 DPL::OptionalString launchMode;
367 // Ambient Support(true, false)
368 DPL::OptionalString ambient;
371 bool allowNavigationEncountered;
372 AllowNavigationInfoList allowNavigationInfoList;
374 //csp polic for widget
375 bool cspPolicyEncountered;
376 DPL::OptionalString cspPolicy;
377 bool cspPolicyReportOnlyEncountered;
378 DPL::OptionalString cspPolicyReportOnly;
380 //AppControl model list
381 AppControlInfoList appControlList;
383 // For link shared directory
384 DependsPkgList dependsPkgList;
386 DPL::OptionalString splashImgSrc;
387 // Background page filename
388 DPL::OptionalString backgroundPage;
390 CategoryList categoryList;
391 // For background category
392 BackgroundCategoryList backgroundCategoryList;
394 AccountProvider accountProvider;
395 // security model version
396 SecurityModelVersion securityModelVersion;
397 // security model version
398 MetadataList metadataList;
400 ImeAppInfoList imeAppInfoList;
402 ServiceAppInfoList serviceAppInfoList;
406 minVersionRequired(),
407 backSupported(false),
408 accessNetwork(false),
409 startFileEncountered(false),
410 didFoundTizenApplicationElement(false),
411 allowNavigationEncountered(false),
412 cspPolicyEncountered(false),
413 cspPolicyReportOnlyEncountered(false),
414 securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1)
419 #endif //CONFIG_PARSER_DATA_H_