libgexf  0.1.3
gexfparser.h
Go to the documentation of this file.
1 
7 /*
8 # Copyright (c) <2009> <Sebastien Heymann>
9 #
10 # Permission is hereby granted, free of charge, to any person obtaining a copy
11 # of this software and associated documentation files (the "Software"), to deal
12 # in the Software without restriction, including without limitation the rights
13 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 # copies of the Software, and to permit persons to whom the Software is
15 # furnished to do so, subject to the following conditions:
16 #
17 # The above copyright notice and this permission notice shall be included in
18 # all copies or substantial portions of the Software.
19 #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 # THE SOFTWARE.
27 */
28 
29 #ifndef _GEXF_PARSER_H
30 #define _GEXF_PARSER_H
31 
32 #include "gexf.h"
33 #include "typedefs.h"
34 #include "abstractparser.h"
35 #include <libxml/xmlreader.h>
36 #include <string>
37 
38 namespace libgexf {
39 
40 class Reader;
41 
45 class GexfParser: public AbstractParser {
46 public:
47  GexfParser();
48 
52  GexfParser(const GexfParser& orig);
53 
54  virtual ~GexfParser();
55 
56  void bind(libgexf::GEXF* gexf);
57  void processNode(xmlTextReaderPtr reader, const xmlChar* const name);
58 private:
59  void processGEXFNode(xmlTextReaderPtr reader);
60  void processMetaNode(xmlTextReaderPtr reader);
61  void processCreatorNode(xmlTextReaderPtr reader);
62  void processDescriptionNode(xmlTextReaderPtr reader);
63 
64  void processGraphNode(xmlTextReaderPtr reader);
65  void processNodesNode(xmlTextReaderPtr reader);
66  void processNodeNode(xmlTextReaderPtr reader);
67  void processEdgesNode(xmlTextReaderPtr reader);
68  void processEdgeNode(xmlTextReaderPtr reader);
69 
70  void processAttributesNode(xmlTextReaderPtr reader);
71  void processAttributeNode(xmlTextReaderPtr reader);
72  void processAttributeDefaultNode(xmlTextReaderPtr reader);
73  void processAttributeOptionsNode(xmlTextReaderPtr reader);
74  void processAttvaluesNode(xmlTextReaderPtr reader);
75  void processAttvalueNode(xmlTextReaderPtr reader);
76 
77  bool isProcessableNode(xmlTextReaderPtr reader);
78 private:
79  enum ElemType { NODE, EDGE, ATTR_NODE, ATTR_EDGE };
80  GEXF* _gexf;
81  ElemType _last_node_type;
82  libgexf::t_id _last_id;
83 };
84 
85 } /* namespace libgexf */
86 
87 #endif /* _GEXF_PARSER_H */
88 
std::string t_id
Definition: typedefs.h:35
Definition: abstractiter.h:32
Parse a GEXF file.
Definition: gexfparser.h:45
void processNode(xmlTextReaderPtr reader, const xmlChar *const name)
Start a process on an XML element.
Definition: gexfparser.cpp:55
GEXF class, just a container.
Definition: gexf.h:53
void bind(libgexf::GEXF *gexf)
Bind itself to a GEXF instance.
Definition: gexfparser.cpp:49
Parser Interface.
Definition: abstractparser.h:40