maint: added proper sample of Barry yum repo file for Fedora
[barry.git] / src / a_alxparser.h
blobde9ed0537cdfd08a8c1c22495155650783584878
1 ///
2 /// \file a_alxparser.h
3 /// ALX file parser (for one file)
4 ///
6 /*
7 Copyright (C) 2010, Nicolas VIVIEN
8 Copyright (C) 2005-2012, Net Direct Inc. (http://www.netdirect.ca/)
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
23 #ifndef __BARRY_A_ALX_PARSER_H__
24 #define __BARRY_A_ALX_PARSER_H__
26 #include <vector>
28 #include "dll.h"
29 #include "xmlparser.h"
30 #include "a_codsection.h"
31 #include "a_library.h"
32 #include "a_application.h"
33 #include "a_osloader.h"
34 #include <tr1/memory>
37 namespace Barry {
39 namespace ALX {
42 class BXEXPORT ALXParser : public XML::XMLParser
44 public:
45 enum MainNodeType {
46 MAIN_NONE,
47 IN_LOADER,
48 IN_SYSTEM,
49 IN_SYSTEM_APPLICATION,
50 IN_SYSTEM_LIBRARY,
51 IN_APPLICATION,
52 IN_APPLICATION_APPLICATION,
53 IN_LIBRARY
56 enum SubNodeType {
57 SUB_NONE,
58 IN_DIRECTORY,
59 IN_OSFILES,
60 IN_NAME,
61 IN_DESCRIPTION,
62 IN_VERSION,
63 IN_VENDOR,
64 IN_COPYRIGHT,
65 IN_LANGUAGE,
66 IN_LANGUAGE_SUPPORTED,
67 IN_REQUIRED,
68 IN_FILESET
71 private:
72 bool m_register;
73 OSLoader& osloader;
74 MainNodeType node;
75 SubNodeType subnode;
76 std::string buffdata;
78 std::tr1::shared_ptr<CODSection> m_codsection;
79 std::tr1::shared_ptr<CODSection> m_savecodsection;
81 public:
82 ALXParser(OSLoader& osloader, std::istream& input);
83 virtual ~ALXParser(void);
85 virtual bool Run(const bool enable);
87 protected:
88 // SaxParser overrides, also overridden in XMLParser
89 virtual void on_start_document();
90 virtual void on_end_document();
91 virtual void on_start_element(const Glib::ustring& name,
92 const xmlpp::SaxParser::AttributeList& attrs);
93 virtual void on_end_element(const Glib::ustring& name);
94 virtual void on_characters(const Glib::ustring& data);
95 virtual void on_comment(const Glib::ustring& text);
96 virtual void on_warning(const Glib::ustring& text);
97 virtual void on_error(const Glib::ustring& text);
98 virtual void on_fatal_error(const Glib::ustring& text);
102 } // namespace ALX
104 } // namespace Barry
106 #endif