# a_alxparser.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       a_alxparser.h
    00003 ///             ALX file parser (for one file)
    00004 ///
    00005
    00006 /*
    00007     Copyright (C) 2010, Nicolas VIVIEN
    00008     Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00009
    00010     This program is free software; you can redistribute it and/or modify
    00011     it under the terms of the GNU General Public License as published by
    00012     the Free Software Foundation; either version 2 of the License, or
    00013     (at your option) any later version.
    00014
    00015     This program is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00018
    00019     See the GNU General Public License in the COPYING file at the
    00020     root directory of this project for more details.
    00021 */
    00022
    00023 #ifndef __BARRY_A_ALX_PARSER_H__
    00024 #define __BARRY_A_ALX_PARSER_H__
    00025
    00026 #include <vector>
    00027
    00028 #include "dll.h"
    00029 #include "xmlparser.h"
    00030 #include "a_codsection.h"
    00031 #include "a_library.h"
    00032 #include "a_application.h"
    00033 #include "a_osloader.h"
    00034 #include <tr1/memory>
    00035
    00036
    00037 namespace Barry {
    00038
    00039 namespace ALX {
    00040
    00041
    00042 class BXEXPORT ALXParser : public XML::XMLParser
    00043 {
    00044 public:
    00045         enum MainNodeType {
    00046                 MAIN_NONE,
    00047                 IN_LOADER,
    00048                 IN_SYSTEM,
    00049                 IN_SYSTEM_APPLICATION,
    00050                 IN_SYSTEM_LIBRARY,
    00051                 IN_APPLICATION,
    00052                 IN_APPLICATION_APPLICATION,
    00053                 IN_LIBRARY
    00054         };
    00055
    00056         enum SubNodeType {
    00057                 SUB_NONE,
    00058                 IN_DIRECTORY,
    00059                 IN_OSFILES,
    00060                 IN_NAME,
    00061                 IN_DESCRIPTION,
    00062                 IN_VERSION,
    00063                 IN_VENDOR,
    00064                 IN_COPYRIGHT,
    00065                 IN_LANGUAGE,
    00066                 IN_LANGUAGE_SUPPORTED,
    00067                 IN_REQUIRED,
    00068                 IN_FILESET
    00069         };
    00070
    00071 private:
    00072         bool m_register;
    00073         OSLoader& osloader;
    00074         MainNodeType node;
    00075         SubNodeType subnode;
    00076         std::string buffdata;
    00077
    00078         std::tr1::shared_ptr<CODSection> m_codsection;
    00079         std::tr1::shared_ptr<CODSection> m_savecodsection;
    00080
    00081 public:
    00082         ALXParser(OSLoader& osloader, std::istream& input);
    00083         virtual ~ALXParser(void);
    00084
    00085         virtual bool Run(const bool enable);
    00086
    00087 protected:
    00088         // SaxParser overrides, also overridden in XMLParser
    00089         virtual void on_start_document();
    00090         virtual void on_end_document();
    00091         virtual void on_start_element(const Glib::ustring& name,
    00092                 const xmlpp::SaxParser::AttributeList& attrs);
    00093         virtual void on_end_element(const Glib::ustring& name);
    00094         virtual void on_characters(const Glib::ustring& data);
    00095         virtual void on_comment(const Glib::ustring& text);
    00096         virtual void on_warning(const Glib::ustring& text);
    00097         virtual void on_error(const Glib::ustring& text);
    00098         virtual void on_fatal_error(const Glib::ustring& text);
    00099 };
    00100
    00101
    00102 } // namespace ALX
    00103
    00104 } // namespace Barry
    00105
    00106 #endif
    00107
    00108