upload tizen1.0 source
[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 <map>
33 #include <dpl/foreach.h>
34 #include <dpl/wrt-dao-ro/config_parser_data.h>
35
36 namespace ConfigurationNamespace {
37 static const DPL::String W3CWidgetNamespaceName =
38     L"http://www.w3.org/ns/widgets";
39 static const DPL::String JilWidgetNamespaceName =
40     L"http://www.jil.org/ns/widgets1.2";
41 static const DPL::String WacWidgetNamespaceNameForLinkElement =
42     L"http://wacapps.net/ns/widgets#";
43 static const DPL::String WacWidgetNamespaceName =
44     L"http://wacapps.net/ns/widgets";
45 static const DPL::String TizenWebAppNamespaceName =
46     L"http://tizen.org/ns/widgets";
47 }
48
49 namespace PluginsPrefix {
50 const char * const W3CPluginsPrefix = "http://www.w3.org/";
51 const char * const WACPluginsPrefix = "http://wacapps.net/api/";
52 const char * const TIZENPluginsPrefix = "http://tizen.org/api/";
53 }
54
55 namespace Unicode {
56 enum Direction
57 {
58     LRE,
59     RLE,
60     LRO,
61     RLO,
62     EMPTY
63 };
64 }
65
66 class WidgetParser : public ElementParser
67 {
68   public:
69     ElementParserPtr OnNameElement();
70     ElementParserPtr OnDescriptionElement();
71     ElementParserPtr OnAuthorElement();
72     ElementParserPtr OnLicenseElement();
73     ElementParserPtr OnIconElement();
74     ElementParserPtr OnContentElement();
75     ElementParserPtr OnFeatureElement();
76     ElementParserPtr OnPreferenceElement();
77     ElementParserPtr OnAccessElement();
78     ElementParserPtr OnFlashElement();
79     ElementParserPtr OnLinkElement();
80     ElementParserPtr OnPkgnameElement();
81     ElementParserPtr OnSettingElement();
82     ElementParserPtr OnServiceElement();
83
84     virtual ActionFunc GetElementParser(const DPL::String& ns,
85             const DPL::String& name);
86
87     virtual void Accept(const Element&);
88     virtual void Accept(const Text&);
89     virtual void Accept(const XmlAttribute&);
90     virtual void Verify();
91
92     //Typedef used by RootParser
93     typedef WrtDB::ConfigParserData& Data;
94
95     WidgetParser(Data&);
96
97   private:
98     Data& m_data;
99     Unicode::Direction m_textDirection;
100     FuncMap m_map;
101     DPL::Optional<DPL::String> m_version;
102     DPL::Optional<DPL::String> m_minVersion;
103     std::list<DPL::String> m_windowModes;
104     DPL::Optional<DPL::String> m_defaultlocale;
105     std::map<DPL::String, DPL::String> m_nameSpaces;
106 };
107
108 struct IconParser;
109 struct ContentParser;
110
111 #endif // WIDGET_PARSER_H_