tizen beta release
[framework/web/wrt-installer.git] / src / configuration_parser / powder_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  * @file        powder_parser.h
18  * @author      Piotr Marcinkiewicz (p.marcinkiew@samsung.com)
19  * @version     0.1
20  * @brief       Parser for WAC defined POWDER
21  */
22
23 #ifndef _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_
24 #define _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_
25
26 #include <dpl/exception.h>
27 #include "element_parser.h"
28 #include <dpl/wrt-dao-ro/common_dao_types.h>
29
30 //TODO: Move to separate header
31 namespace PowderParserException {
32 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
33 DECLARE_EXCEPTION_TYPE(Base, ParserFailed)
34 }
35
36 struct PowderParserData
37 {
38     WrtDB::Powder::Description* description;
39     const DPL::String& host;
40     const DPL::String& path;
41     PowderParserData(WrtDB::Powder::Description* a_description,
42             const DPL::String& a_host,
43             const DPL::String& a_path) :
44         description(a_description),
45         host(a_host),
46         path(a_path)
47     {
48     }
49 };
50 //TODO: Move to other header
51 typedef std::set<DPL::String>  StringSet;
52
53 class PowderParser : public ElementParser
54 {
55   public:
56     //Typedef used by RootParser
57     typedef PowderParserData* Data;
58
59     explicit PowderParser(PowderParserData* data);
60
61     ElementParserPtr OnNameElement();
62
63     //TODO: Remove not implemented methods
64     virtual ActionFunc GetElementParser(const DPL::String& ns,
65             const DPL::String& name);
66     virtual void Accept(const Element& /*element*/);
67     virtual void Accept(const XmlAttribute& attribute);
68     virtual void Accept(const Text& text);
69     virtual void Verify();
70
71     ElementParserPtr OnIgnoredElement();
72     ElementParserPtr OnElement_dr();
73     ElementParserPtr OnDenyElement();
74
75   private:
76     WrtDB::Powder::Description* m_data;
77     const DPL::String& m_host;
78     const DPL::String& m_path;
79     FuncMap m_map;
80 };
81 #endif // _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_POWDER_PARSER_H_