Fawkes API  Fawkes Development Version
parser.h
1 
2 /***************************************************************************
3  * parser.h - Interface config parser
4  *
5  * Created: Tue Oct 10 17:29:33 2006
6  * Copyright 2006-2015 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __INTERFACES_GENERATOR_PARSER_H_
23 #define __INTERFACES_GENERATOR_PARSER_H_
24 
25 #include "field.h"
26 #include "constant.h"
27 #include "enum_constant.h"
28 #include "message.h"
29 #include "pseudomap.h"
30 
31 #include <vector>
32 #include <string>
33 
34 namespace xmlpp {
35  class DomParser;
36  class Node;
37 }
38 
40 {
41  public:
42  InterfaceParser(std::string config_filename);
44 
45  std::vector<InterfaceField> getFields(xmlpp::Node *node);
46  std::vector<InterfacePseudoMap> getPseudoMaps(xmlpp::Node *node,
47  std::vector<InterfaceField> &fields);
48  void parse();
49 
50  void printFields(std::vector<InterfaceField> &fields);
51  void printPseudoMaps(std::vector<InterfacePseudoMap> &pseudo_maps);
52  void print();
53  void printParsed(std::vector<InterfaceConstant> & constants,
54  std::vector<InterfaceEnumConstant> & enum_constants,
55  std::vector<InterfaceField> & data_fields,
56  std::vector<InterfacePseudoMap> & pseudo_maps,
57  std::vector<InterfaceMessage> & messages);
58 
59  std::string getInterfaceName();
60  std::string getInterfaceAuthor();
61  std::string getInterfaceYear();
62  std::string getInterfaceCreationDate();
63  std::vector<InterfaceConstant> getConstants();
64  std::vector<InterfaceEnumConstant> getEnumConstants();
65  std::vector<InterfaceField> getDataFields();
66  std::vector<InterfacePseudoMap> getPseudoMaps();
67  std::string getDataComment();
68  std::vector<InterfaceMessage> getMessages();
69 
70  private:
71  xmlpp::DomParser *dom;
72  xmlpp::Node *root;
73  std::string name;
74  std::string author;
75  std::string year;
76  std::string creation_date;
77  std::string data_comment;
78 
79  std::vector<InterfaceConstant> constants;
80  std::vector<InterfaceEnumConstant> enum_constants;
81  std::vector<InterfaceField> data_fields;
82  std::vector<InterfacePseudoMap> pseudo_maps;
83  std::vector<InterfaceMessage> messages;
84 
85 };
86 
87 
88 #endif
InterfaceParser(std::string config_filename)
Constructor.
Definition: parser.cpp:46
void printParsed(std::vector< InterfaceConstant > &constants, std::vector< InterfaceEnumConstant > &enum_constants, std::vector< InterfaceField > &data_fields, std::vector< InterfacePseudoMap > &pseudo_maps, std::vector< InterfaceMessage > &messages)
Print parsed config.
Definition: parser.cpp:296
void parse()
Parse config.
Definition: parser.cpp:339
void printPseudoMaps(std::vector< InterfacePseudoMap > &pseudo_maps)
Print pseudo maps.
Definition: parser.cpp:269
void printFields(std::vector< InterfaceField > &fields)
Print fields.
Definition: parser.cpp:236
Parser used to get information out of interface template.
Definition: parser.h:39
void print()
Print parsed data.
Definition: parser.cpp:331
std::vector< InterfacePseudoMap > getPseudoMaps()
Get data pseudo maps.
Definition: parser.cpp:736
std::vector< InterfaceField > getFields(xmlpp::Node *node)
Get parsed fields.
Definition: parser.cpp:72
~InterfaceParser()
Destructor.
Definition: parser.cpp:60
std::string getInterfaceAuthor()
Get interface author.
Definition: parser.cpp:670
std::string getDataComment()
Get data comment.
Definition: parser.cpp:747
Definition: parser.h:34
std::vector< InterfaceMessage > getMessages()
Get messages.
Definition: parser.cpp:758
std::vector< InterfaceField > getDataFields()
Get data fields.
Definition: parser.cpp:725
std::string getInterfaceCreationDate()
Get interface creation date as string Only valid after parse().
Definition: parser.cpp:692
std::string getInterfaceName()
Get interface name.
Definition: parser.cpp:659
std::vector< InterfaceEnumConstant > getEnumConstants()
Get enum constants.
Definition: parser.cpp:714
std::string getInterfaceYear()
Get interface copyright year.
Definition: parser.cpp:681
std::vector< InterfaceConstant > getConstants()
Get constants.
Definition: parser.cpp:703