Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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