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>
31 #include <dpl/platform.h>
35 void NormalizeString(DPL::OptionalString& txt, bool isTrimSpace = false);
36 void NormalizeString(DPL::String& str);
37 DPL::String GetSingleAttributeValue(const DPL::String value);
38 void NormalizeAndTrimSpaceString(DPL::OptionalString& txt);
39 #if ENABLE(ELEMENT_ATTR_MAX_LENGTH)
40 void NormalizeString(DPL::String& str, const unsigned int length, bool showEllipsis = false);
41 void NormalizeString(DPL::OptionalString& str, const unsigned int length, bool showEllipsis = false);
42 void NormalizeAndTrimSpaceString(DPL::OptionalString& str, const unsigned int length);
43 #endif // ELEMENT_ATTR_MAX_LENGTH
44 class WidgetConfigurationManager;
46 class ConfigParserData
51 Feature(const DPL::String& _name) : name(_name)
55 bool operator==(const Feature&) const;
56 bool operator!=(const Feature&) const;
57 bool operator >(const Feature&) const;
58 bool operator>=(const Feature&) const;
59 bool operator <(const Feature&) const;
60 bool operator<=(const Feature&) const;
62 typedef std::set<Feature> FeaturesList;
66 Privilege(const DPL::String& _name) : name(_name)
70 bool operator==(const Privilege&) const;
71 bool operator!=(const Privilege&) const;
72 bool operator >(const Privilege&) const;
73 bool operator>=(const Privilege&) const;
74 bool operator <(const Privilege&) const;
75 bool operator<=(const Privilege&) const;
77 typedef std::set<Privilege> PrivilegeList;
81 Icon(const DPL::String& _src) : src(_src), isSmall(false)
84 DPL::OptionalInt width;
85 DPL::OptionalInt height;
87 bool operator==(const Icon&) const;
88 bool operator!=(const Icon&) const;
89 bool operator >(const Icon&) const;
90 bool operator>=(const Icon&) const;
91 bool operator <(const Icon&) const;
92 bool operator<=(const Icon&) const;
94 typedef std::list<Icon> IconsList;
98 DPL::OptionalString name;
99 DPL::OptionalString shortName;
101 DPL::OptionalString description;
103 DPL::OptionalString license;
104 DPL::OptionalString licenseFile;
105 DPL::OptionalString licenseHref;
107 typedef std::map<DPL::String, LocalizedData> LocalizedDataSet;
111 Preference(const DPL::String& _name,
112 bool _readonly = false) :
118 DPL::OptionalString value;
120 bool operator==(const Preference&) const;
121 bool operator!=(const Preference&) const;
122 bool operator >(const Preference&) const;
123 bool operator>=(const Preference&) const;
124 bool operator <(const Preference&) const;
125 bool operator<=(const Preference&) const;
127 typedef std::set<Preference> PreferencesList;
128 typedef std::set<DPL::String> StringsList;
132 AccessInfo(const DPL::String& strIRI,
133 bool bSubdomainAccess) : m_strIRI(strIRI),
134 m_bSubDomainAccess(bSubdomainAccess)
137 bool operator==(const AccessInfo&) const;
138 bool operator!=(const AccessInfo&) const;
139 bool operator <(const AccessInfo&) const;
141 DPL::String m_strIRI;
142 bool m_bSubDomainAccess;
144 typedef std::set<AccessInfo> AccessInfoSet;
148 Setting(const DPL::String& name,
149 const DPL::String& value) :
156 bool operator==(const Setting&) const;
157 bool operator!=(const Setting&) const;
158 bool operator >(const Setting&) const;
159 bool operator>=(const Setting&) const;
160 bool operator <(const Setting&) const;
161 bool operator<=(const Setting&) const;
164 typedef std::set<Setting> SettingsList;
166 struct AppControlInfo
168 enum class Disposition {
173 AppControlInfo(const DPL::String& operation) :
174 m_operation(operation),
175 m_disposition(Disposition::UNDEFINE),
179 DPL::String m_operation;
180 std::set <DPL::String> m_uriList;
181 std::set <DPL::String> m_mimeList;
182 Disposition m_disposition;
185 bool operator==(const AppControlInfo&) const;
186 bool operator!=(const AppControlInfo&) const;
189 typedef std::list<AppControlInfo> AppControlInfoList;
198 DPL::String m_preview;
199 DPL::String m_useDecoration;
201 typedef BoxSize BoxSizeInfo;
202 typedef std::list<BoxSizeInfo> BoxSizeList;
206 DPL::String m_boxSrc;
207 DPL::String m_boxMouseEvent;
208 DPL::String m_boxTouchEffect;
209 BoxSizeList m_boxSize;
211 DPL::String m_pdWidth;
212 DPL::String m_pdHeight;
213 DPL::String m_pdFastOpen;
215 typedef BoxContent BoxContentInfo;
217 typedef std::list<std::pair<DPL::String, DPL::String> > BoxLabelList;
219 BoxLabelList m_label;
221 DPL::String m_liveboxId;
222 DPL::String m_primary;
224 DPL::String m_autoLaunch;
225 DPL::String m_updatePeriod;
226 BoxContentInfo m_boxInfo;
228 bool operator==(const LiveboxInfo&) const;
229 bool operator!=(const LiveboxInfo&) const;
230 bool operator >(const LiveboxInfo&) const;
231 bool operator>=(const LiveboxInfo&) const;
232 bool operator <(const LiveboxInfo&) const;
233 bool operator<=(const LiveboxInfo&) const;
235 typedef DPL::Optional<LiveboxInfo> OptionalLiveboxInfo;
236 typedef std::list<OptionalLiveboxInfo> LiveboxList;
244 typedef std::set<std::pair<IconSectionType, DPL::String>> IconSet;
245 typedef std::list<DPL::String> CapabilityList;
246 typedef std::set<std::pair<DPL::String, DPL::String>> DisplayNameSet;
248 struct AccountProvider
251 m_multiAccountSupport(false)
254 bool m_multiAccountSupport;
256 DisplayNameSet m_displayNameSet;
257 CapabilityList m_capabilityList;
260 typedef std::list<DPL::OptionalString> DependsPkgList;
261 typedef std::set<DPL::String> CategoryList;
263 struct AllowNavigationInfo
265 AllowNavigationInfo(DPL::String scheme,
270 DPL::String m_scheme;
273 typedef std::list<AllowNavigationInfo> AllowNavigationInfoList;
277 Metadata(const DPL::OptionalString& _key,
278 const DPL::OptionalString& _value) :
282 DPL::OptionalString key;
283 DPL::OptionalString value;
285 bool operator==(const Metadata&) const;
286 bool operator!=(const Metadata&) const;
288 typedef std::list<Metadata> MetadataList;
293 typedef std::set<DPL::String> LanguageList;
294 LanguageList languageList;
296 typedef std::list<ImeAppInfo> ImeAppInfoList;
298 struct ServiceAppInfo
300 ServiceAppInfo() : onBoot(false), autoRestart(false) { }
302 DPL::String serviceId;
305 LocalizedDataSet m_localizedDataSet;
306 DPL::String serviceContent;
307 IconsList m_iconsList;
308 MetadataList m_metadataList;
309 CategoryList m_categoryList;
311 typedef std::list<ServiceAppInfo> ServiceAppInfoList;
313 enum class SecurityModelVersion {
314 SECURITY_MODEL_V1 = 0, // WARP
315 SECURITY_MODEL_V2 // CSP, allow-navigation
318 LiveboxList m_livebox;
319 StringsList nameSpaces;
321 LocalizedDataSet localizedDataSet;
323 DPL::OptionalString authorName;
324 DPL::OptionalString authorHref;
325 DPL::OptionalString authorEmail;
327 FeaturesList featuresList;
328 PrivilegeList privilegeList;
330 SettingsList settingsList;
332 DPL::OptionalInt width;
333 DPL::OptionalInt height;
335 DPL::OptionalString widget_id;
336 DPL::OptionalString defaultlocale;
338 PreferencesList preferencesList;
340 DPL::OptionalString version;
341 StringsList windowModes;
343 AccessInfoSet accessInfoSet;
347 DPL::OptionalString minVersionRequired;
352 // Unlocalized data, to be processed by WidgetConfigurationManager
353 bool startFileEncountered;
354 DPL::OptionalString startFile;
355 DPL::OptionalString startFileEncoding;
356 DPL::OptionalString startFileContentType;
357 DPL::OptionalString startFileNamespace;
360 // tizen id / required platform min version for TIZEN webapp
361 DPL::OptionalString tizenMinVersionRequired;
362 DPL::OptionalString tizenPkgId;
363 DPL::OptionalString tizenAppId;
364 bool didFoundTizenApplicationElement;
366 // Ambient Support(true, false)
367 DPL::OptionalString ambient;
370 bool allowNavigationEncountered;
371 AllowNavigationInfoList allowNavigationInfoList;
373 //csp polic for widget
374 bool cspPolicyEncountered;
375 DPL::OptionalString cspPolicy;
376 bool cspPolicyReportOnlyEncountered;
377 DPL::OptionalString cspPolicyReportOnly;
379 //AppControl model list
380 AppControlInfoList appControlList;
382 // For link shared directory
383 DependsPkgList dependsPkgList;
385 DPL::OptionalString splashImgSrc;
386 // Background page filename
387 DPL::OptionalString backgroundPage;
389 CategoryList categoryList;
391 AccountProvider accountProvider;
392 // security model version
393 SecurityModelVersion securityModelVersion;
394 // security model version
395 MetadataList metadataList;
397 ImeAppInfoList imeAppInfoList;
399 ServiceAppInfoList serviceAppInfoList;
403 minVersionRequired(),
404 backSupported(false),
405 accessNetwork(false),
406 startFileEncountered(false),
407 didFoundTizenApplicationElement(false),
408 allowNavigationEncountered(false),
409 cspPolicyEncountered(false),
410 cspPolicyReportOnlyEncountered(false),
411 securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1)
416 #endif //CONFIG_PARSER_DATA_H_