tizen beta release
[framework/web/wrt-installer.git] / src / configuration_parser / widget_parser.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  * This file  have been implemented in compliance with  W3C WARP SPEC.
18  * but there are some patent issue between  W3C WARP SPEC and APPLE.
19  * so if you want to use this file, refer to the README file in root directory
20  */
21 /**
22  * @file        widget_parser.h
23  * @author      Lukasz Wrzosek (l.wrzosek@samsung.com)
24  * @version     0.1
25  * @brief
26  */
27 #ifndef WIDGET_PARSER_H_
28 #define WIDGET_PARSER_H_
29
30 #include "element_parser.h"
31 #include <list>
32 #include <dpl/foreach.h>
33 #include <dpl/wrt-dao-ro/config_parser_data.h>
34
35 namespace ConfigurationNamespace {
36 static const DPL::String W3CWidgetNamespaceName =
37     L"http://www.w3.org/ns/widgets";
38 static const DPL::String JilWidgetNamespaceName =
39     L"http://www.jil.org/ns/widgets1.2";
40 static const DPL::String WacWidgetNamespaceNameForLinkElement =
41     L"http://wacapps.net/ns/widgets#";
42 static const DPL::String WacWidgetNamespaceName =
43     L"http://wacapps.net/ns/widgets";
44 static const DPL::String TizenWebAppNamespaceName =
45     L"http://tizen.org/ns/widgets";
46 }
47
48 namespace PluginsPrefix {
49 const char * const W3CPluginsPrefix = "http://www.w3.org/";
50 const char * const WACPluginsPrefix = "http://wacapps.net/api/";
51 const char * const TIZENPluginsPrefix = "http://tizen.org/api/";
52 }
53
54 namespace Unicode {
55 enum Direction
56 {
57     LRE,
58     RLE,
59     LRO,
60     RLO,
61     EMPTY
62 };
63 }
64
65 class WidgetParser : public ElementParser
66 {
67   public:
68     ElementParserPtr OnNameElement();
69     ElementParserPtr OnDescriptionElement();
70     ElementParserPtr OnAuthorElement();
71     ElementParserPtr OnLicenseElement();
72     ElementParserPtr OnIconElement();
73     ElementParserPtr OnContentElement();
74     ElementParserPtr OnFeatureElement();
75     ElementParserPtr OnPreferenceElement();
76     ElementParserPtr OnAccessElement();
77     ElementParserPtr OnFlashElement();
78     ElementParserPtr OnLinkElement();
79     ElementParserPtr OnMinVersionElement();
80     ElementParserPtr OnBackElement();
81     ElementParserPtr OnPkgnameElement();
82     ElementParserPtr OnSettingElement();
83     ElementParserPtr OnServiceElement();
84
85     virtual ActionFunc GetElementParser(const DPL::String& ns,
86             const DPL::String& name);
87
88     virtual void Accept(const Element&);
89     virtual void Accept(const Text&);
90     virtual void Accept(const XmlAttribute&);
91     virtual void Verify();
92
93     //Typedef used by RootParser
94     typedef WrtDB::ConfigParserData& Data;
95
96     WidgetParser(Data&);
97
98   private:
99     Data& m_data;
100     Unicode::Direction m_textDirection;
101     FuncMap m_map;
102     DPL::Optional<DPL::String> m_version;
103     std::list<DPL::String> m_windowModes;
104     DPL::Optional<DPL::String> m_defaultlocale;
105     std::list<DPL::String> m_nameSpaces;
106 };
107
108 struct IconParser;
109 struct ContentParser;
110
111 #endif // WIDGET_PARSER_H_