Unused fields in WidgetRegisterInfo
[framework/web/wrt-commons.git] / modules / widget_dao / include / dpl / wrt-dao-ro / config_parser_data.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file        config_parser_data.h
18  * @author      Lukasz Wrzosek (l.wrzosek@samsung.com)
19  * @version     0.1
20  * @brief
21  */
22 #ifndef CONFIG_PARSER_DATA_H_
23 #define CONFIG_PARSER_DATA_H_
24
25 #include <string>
26 #include <set>
27 #include <list>
28 #include <map>
29 #include <dpl/optional_typedefs.h>
30 #include <dpl/string.h>
31 #include <ctype.h>
32
33 namespace WrtDB {
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);
38
39 class WidgetConfigurationManager;
40
41 class ConfigParserData
42 {
43   public:
44     struct Param
45     {
46         Param(const DPL::String& _name) : name(_name)
47         {}
48         DPL::String name;
49         DPL::String value;
50         bool operator==(const Param&) const;
51         bool operator!=(const Param&) const;
52         bool operator >(const Param&) const;
53         bool operator>=(const Param&) const;
54         bool operator <(const Param&) const;
55         bool operator<=(const Param&) const;
56     };
57     typedef std::set<Param> ParamsList;
58
59     struct Feature
60     {
61         Feature(const DPL::String& _name,
62                 bool _required = true) : name(_name),
63             required(_required)
64         {}
65         DPL::String name;
66         bool required;
67         ParamsList paramsList;
68
69         bool operator==(const Feature&) const;
70         bool operator!=(const Feature&) const;
71         bool operator >(const Feature&) const;
72         bool operator>=(const Feature&) const;
73         bool operator <(const Feature&) const;
74         bool operator<=(const Feature&) const;
75     };
76     typedef std::set<Feature> FeaturesList;
77
78     struct Privilege
79     {
80         Privilege(const DPL::String& _name) : name(_name)
81         {}
82         DPL::String name;
83
84         bool operator==(const Privilege&) const;
85         bool operator!=(const Privilege&) const;
86         bool operator >(const Privilege&) const;
87         bool operator>=(const Privilege&) const;
88         bool operator <(const Privilege&) const;
89         bool operator<=(const Privilege&) const;
90     };
91     typedef std::set<Privilege> PrivilegeList;
92
93     struct Icon
94     {
95         Icon(const DPL::String& _src) : src(_src)
96         {}
97         DPL::String src;
98         DPL::OptionalInt width;
99         DPL::OptionalInt height;
100         bool operator==(const Icon&) const;
101         bool operator!=(const Icon&) const;
102         bool operator >(const Icon&) const;
103         bool operator>=(const Icon&) const;
104         bool operator <(const Icon&) const;
105         bool operator<=(const Icon&) const;
106     };
107     typedef std::list<Icon> IconsList;
108
109     struct LocalizedData
110     {
111         DPL::OptionalString name;
112         DPL::OptionalString shortName;
113
114         DPL::OptionalString description;
115
116         DPL::OptionalString license;
117         DPL::OptionalString licenseFile;
118         DPL::OptionalString licenseHref;
119     };
120     typedef std::map<DPL::String, LocalizedData> LocalizedDataSet;
121
122     struct Preference
123     {
124         Preference(const DPL::String& _name,
125                    bool _readonly = false) :
126             name(_name),
127             value(),
128             readonly(_readonly)
129         {}
130         DPL::String name;
131         DPL::OptionalString value;
132         bool readonly;
133         bool operator==(const Preference&) const;
134         bool operator!=(const Preference&) const;
135         bool operator >(const Preference&) const;
136         bool operator>=(const Preference&) const;
137         bool operator <(const Preference&) const;
138         bool operator<=(const Preference&) const;
139     };
140     typedef std::set<Preference> PreferencesList;
141     typedef std::set<DPL::String> StringsList;
142
143     struct AccessInfo
144     {
145         AccessInfo(const DPL::String& strIRI,
146                    bool bSubdomainAccess) : m_strIRI(strIRI),
147             m_bSubDomainAccess(bSubdomainAccess)
148         {}
149
150         bool operator==(const AccessInfo&) const;
151         bool operator!=(const AccessInfo&) const;
152         bool operator <(const AccessInfo&) const;
153
154         DPL::String m_strIRI;
155         bool m_bSubDomainAccess;
156     };
157     typedef std::set<AccessInfo> AccessInfoSet;
158
159     struct Setting
160     {
161         Setting(const DPL::String& name,
162                 const DPL::String& value) :
163             m_name(name),
164             m_value(value)
165         {}
166         DPL::String m_name;
167         DPL::String m_value;
168
169         bool operator==(const Setting&) const;
170         bool operator!=(const Setting&) const;
171         bool operator >(const Setting&) const;
172         bool operator>=(const Setting&) const;
173         bool operator <(const Setting&) const;
174         bool operator<=(const Setting&) const;
175     };
176
177     typedef std::set<Setting> SettingsList;
178
179     /* ServiceInfo will be removed.
180      * ServiceInfo will be changed AppControl
181      */
182     struct ServiceInfo
183     {
184         ServiceInfo(
185             const DPL::String& src,
186             const DPL::String& operation,
187             const DPL::String& scheme,
188             const DPL::String& mime) :
189             m_src(src),
190             m_operation(operation),
191             m_scheme(scheme),
192             m_mime(mime)
193         {}
194         DPL::String m_src;
195         DPL::String m_operation;
196         DPL::String m_scheme;
197         DPL::String m_mime;
198
199         bool operator==(const ServiceInfo&) const;
200         bool operator!=(const ServiceInfo&) const;
201     };
202
203     struct AppControlInfo
204     {
205         AppControlInfo(
206             const DPL::String& operation) :
207             m_operation(operation)
208         {}
209         DPL::String m_src;
210         DPL::String m_operation;
211         std::set <DPL::String> m_uriList;
212         std::set <DPL::String> m_mimeList;
213
214         bool operator==(const AppControlInfo&) const;
215         bool operator!=(const AppControlInfo&) const;
216     };
217
218     typedef std::list<ServiceInfo> ServiceInfoList; // It will be removed.
219     typedef std::list<AppControlInfo> AppControlInfoList;
220
221     typedef std::list<std::pair<DPL::String, DPL::String> > BoxSizeList;
222
223     struct LiveboxInfo
224     {
225         LiveboxInfo() { }
226
227         struct BoxContent
228         {
229             DPL::String m_boxSrc;
230             DPL::String m_boxMouseEvent;
231             BoxSizeList m_boxSize;
232             DPL::String m_pdSrc;
233             DPL::String m_pdWidth;
234             DPL::String m_pdHeight;
235         };
236         typedef BoxContent BoxContentInfo;
237
238         DPL::String m_label;
239         DPL::String m_icon;
240         DPL::String m_liveboxId;
241         DPL::String m_primary;
242         DPL::String m_type;
243         DPL::String m_autoLaunch;
244         DPL::String m_updatePeriod;
245         BoxContentInfo m_boxInfo;
246
247         bool operator==(const LiveboxInfo&) const;
248         bool operator!=(const LiveboxInfo&) const;
249         bool operator >(const LiveboxInfo&) const;
250         bool operator>=(const LiveboxInfo&) const;
251         bool operator <(const LiveboxInfo&) const;
252         bool operator<=(const LiveboxInfo&) const;
253     };
254     typedef std::list<DPL::Optional<LiveboxInfo> > LiveboxList;
255     LiveboxList m_livebox;
256
257     typedef std::list<DPL::OptionalString> DependsPkgList;
258
259     typedef std::set<DPL::String> CategoryList;
260
261     StringsList nameSpaces;
262
263     LocalizedDataSet localizedDataSet;
264
265     DPL::OptionalString authorName;
266     DPL::OptionalString authorHref;
267     DPL::OptionalString authorEmail;
268
269     FeaturesList featuresList;
270     PrivilegeList privilegeList;
271
272     SettingsList settingsList;
273
274     DPL::OptionalInt width;
275     DPL::OptionalInt height;
276
277     DPL::OptionalString widget_id;
278     DPL::OptionalString defaultlocale;
279
280     PreferencesList preferencesList;
281
282     DPL::OptionalString version;
283     StringsList windowModes;
284
285     AccessInfoSet accessInfoSet;
286
287     bool flashNeeded;
288
289     DPL::OptionalString minVersionRequired;
290
291     bool backSupported;
292     bool accessNetwork;
293
294     // Unlocalized data, to be processed by WidgetConfigurationManager
295     bool startFileEncountered;
296     DPL::OptionalString startFile;
297     DPL::OptionalString startFileEncoding;
298     DPL::OptionalString startFileContentType;
299     IconsList iconsList;
300
301     // tizen id / required platform min version for TIZEN webapp
302     DPL::OptionalString tizenMinVersionRequired;
303     DPL::OptionalString tizenPkgId;
304     DPL::OptionalString tizenAppId;
305
306     //csp polic for widget
307     DPL::OptionalString cspPolicy;
308
309     //Application service model list
310     ServiceInfoList appServiceList; //It will be removed.
311     AppControlInfoList appControlList;
312
313     // For link shared directory
314     DependsPkgList dependsPkgList;
315     // Splash image path
316     DPL::OptionalString splashImgSrc;
317     // Background page filename
318     DPL::OptionalString backgroundPage;
319     // For category
320     CategoryList categoryList;
321
322     ConfigParserData() :
323         flashNeeded(false),
324         minVersionRequired(),
325         backSupported(false),
326         accessNetwork(false),
327         startFileEncountered(false)
328     {}
329 };
330 } // namespace WrtDB
331
332 #endif  //CONFIG_PARSER_DATA_H_