parser.h

00001  
00002 /***************************************************************************
00003  *  parser.h - Interface config parser
00004  *
00005  *  Generated: Tue Oct 10 17:29:33 2006
00006  *  Copyright  2006  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
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.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __INTERFACES_GENERATOR_PARSER_H_
00024 #define __INTERFACES_GENERATOR_PARSER_H_
00025 
00026 #include "field.h"
00027 #include "constant.h"
00028 #include "enum_constant.h"
00029 #include "message.h"
00030 #include "pseudomap.h"
00031 
00032 #include <vector>
00033 #include <string>
00034 
00035 namespace xmlpp {
00036   class DomParser;
00037   class Node;
00038 }
00039 
00040 class InterfaceParser
00041 {
00042  public:
00043   InterfaceParser(std::string config_filename);
00044   ~InterfaceParser();
00045 
00046   std::vector<InterfaceField>  getFields(xmlpp::Node *node);
00047   std::vector<InterfacePseudoMap> getPseudoMaps(xmlpp::Node *node,
00048                                                 std::vector<InterfaceField> &fields);
00049   void parse();
00050 
00051   void printFields(std::vector<InterfaceField> &fields);
00052   void printPseudoMaps(std::vector<InterfacePseudoMap> &pseudo_maps);
00053   void print();
00054   void printParsed(std::vector<InterfaceConstant> &     constants,
00055                    std::vector<InterfaceEnumConstant> & enum_constants,
00056                    std::vector<InterfaceField> &        data_fields,
00057                    std::vector<InterfacePseudoMap> &    pseudo_maps,
00058                    std::vector<InterfaceMessage> &      messages);
00059 
00060   std::string                         getInterfaceName();
00061   std::string                         getInterfaceAuthor();
00062   std::string                         getInterfaceYear();
00063   std::string                         getInterfaceCreationDate();
00064   std::vector<InterfaceConstant>      getConstants();
00065   std::vector<InterfaceEnumConstant>  getEnumConstants();
00066   std::vector<InterfaceField>         getDataFields();
00067   std::vector<InterfacePseudoMap>     getPseudoMaps();
00068   std::string                         getDataComment();
00069   std::vector<InterfaceMessage>       getMessages();
00070 
00071  private:
00072   xmlpp::DomParser *dom;
00073   xmlpp::Node      *root;
00074   std::string       name;
00075   std::string       author;
00076   std::string       year;
00077   std::string       creation_date;
00078   std::string       data_comment;
00079 
00080   std::vector<InterfaceConstant>     constants;
00081   std::vector<InterfaceEnumConstant> enum_constants;
00082   std::vector<InterfaceField>        data_fields;
00083   std::vector<InterfacePseudoMap>    pseudo_maps;
00084   std::vector<InterfaceMessage>      messages;
00085 
00086 };
00087 
00088 
00089 #endif