Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

TsplibXmlParser.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/HashArray.h>
36 
38 
39 #include <sstream>
40 #include <unordered_map>
41 
42 namespace ogdf {
43 
55 private:
56  pugi::xml_document m_xml; // hold as a class member, so it gets desctructed at the same time as the parser.
58 
59  bool m_hasError;
60 
61  // Called on constructing, to initially load the file.
62  // Basic errors are catched, like missing essential tags.
63  // Parsing is done on read, which might also raise errors.
64  bool load(std::istream& in, std::string& error);
65 
66  // Unified read with all the logic.
67  bool read(Graph& G, GraphAttributes* GA);
68 
69 public:
70  explicit TsplibXmlParser(std::istream& in);
71  ~TsplibXmlParser() = default;
72 
73  bool read(Graph& G);
74  bool read(Graph& G, GraphAttributes& GA);
75 };
76 
77 }
HashArray.h
Declaration and implementation of HashArray class.
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
ogdf::TsplibXmlParser::TsplibXmlParser
TsplibXmlParser(std::istream &in)
pugixml.h
ogdf::TsplibXmlParser::load
bool load(std::istream &in, std::string &error)
ogdf::TsplibXmlParser::m_graphTag
pugi::xml_node m_graphTag
Definition: TsplibXmlParser.h:57
ogdf::TsplibXmlParser::m_hasError
bool m_hasError
Definition: TsplibXmlParser.h:59
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
pugi::xml_node
Definition: pugixml.h:401
ogdf::TsplibXmlParser::~TsplibXmlParser
~TsplibXmlParser()=default
ogdf::TsplibXmlParser::m_xml
pugi::xml_document m_xml
Definition: TsplibXmlParser.h:56
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::TsplibXmlParser
Parses tsplib files in xml format.
Definition: TsplibXmlParser.h:54
ogdf::TsplibXmlParser::read
bool read(Graph &G, GraphAttributes *GA)
pugi::xml_document
Definition: pugixml.h:943