Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
TlpParser.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
40
41#include <iostream>
42#include <map>
43#include <sstream>
44#include <string>
45
46namespace ogdf {
47
48namespace tlp {
49
50
51class Parser {
52private:
53 using Iterator = std::vector<Token>::const_iterator;
54 std::map<int, node> m_idNode;
55 std::map<int, edge> m_idEdge;
56
57 std::istream& m_istream;
59
60 bool readEdge(Graph& G);
64
68 std::string& nodeDefault, EdgeArray<bool>& edgeDone, std::string& edgeDefault);
69
71
72 inline bool applyNodes(Graph& G, ClusterGraph* C, cluster c, const std::string& str);
73 inline void tokenError(const char* str, bool got = true);
74 inline void tokenError(const std::string& str, bool got = true);
75
76public:
77 explicit Parser(std::istream& is);
78
79 bool read(Graph& G) { return readGraph(G, nullptr, nullptr); }
80
81 bool read(Graph& G, GraphAttributes& GA) { return readGraph(G, &GA, nullptr); }
82
83 bool read(Graph& G, ClusterGraph& C) { return readGraph(G, nullptr, &C); }
84
86 return readGraph(G, &CA, &C);
87 }
88};
89
90}
91}
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration of TLP string conversion functions.
Declares a TLP file format lexer class and related structures.
Representation of clusters in a clustered graph.
Stores additional attributes of a clustered graph (like layout information).
Representation of clustered graphs.
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Parser(std::istream &is)
std::map< int, node > m_idNode
Definition TlpParser.h:54
std::vector< Token >::const_iterator Iterator
Definition TlpParser.h:53
bool readProperty(Graph &G, GraphAttributes *GA)
std::istream & m_istream
Definition TlpParser.h:57
void tokenError(const std::string &str, bool got=true)
Iterator m_begin
Definition TlpParser.h:58
bool readCluster(Graph &G, ClusterGraph *C, cluster c)
bool readStatement(Graph &G, GraphAttributes *GA, ClusterGraph *C)
bool readPropertyStatement(GraphAttributes *GA, const Attribute &attr, NodeArray< bool > &nodeDone, std::string &nodeDefault, EdgeArray< bool > &edgeDone, std::string &edgeDefault)
void tokenError(const char *str, bool got=true)
std::map< int, edge > m_idEdge
Definition TlpParser.h:55
bool read(Graph &G, ClusterGraph &C, ClusterGraphAttributes &CA)
Definition TlpParser.h:85
bool readNodes(Graph &G, ClusterGraph *C, cluster c)
bool readClusterStatement(Graph &G, ClusterGraph *C, cluster c)
bool applyNodes(Graph &G, ClusterGraph *C, cluster c, const std::string &str)
bool readGraph(Graph &G, GraphAttributes *GA, ClusterGraph *C)
bool read(Graph &G, ClusterGraph &C)
Definition TlpParser.h:83
bool read(Graph &G, GraphAttributes &GA)
Definition TlpParser.h:81
bool read(Graph &G)
Definition TlpParser.h:79
bool readEdge(Graph &G)
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
Attribute
Definition Tlp.h:41
The namespace for all OGDF objects.