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>
38
39#include <iostream>
40#include <map>
41#include <string>
42#include <vector>
43
44namespace ogdf::tlp {
45enum class Attribute;
46} // namespace ogdf::tlp
47
48namespace ogdf {
49class GraphAttributes;
50
51namespace tlp {
52
53
54class Parser {
55private:
56 using Iterator = std::vector<Token>::const_iterator;
57 std::map<int, node> m_idNode;
58 std::map<int, edge> m_idEdge;
59
60 std::istream& m_istream;
62
63 bool readEdge(Graph& G);
67
71 std::string& nodeDefault, EdgeArray<bool>& edgeDone, std::string& edgeDefault);
72
74
75 inline bool applyNodes(Graph& G, ClusterGraph* C, cluster c, const std::string& str);
76 inline void tokenError(const char* str, bool got = true);
77 inline void tokenError(const std::string& str, bool got = true);
78
79public:
80 explicit Parser(std::istream& is);
81
82 bool read(Graph& G) { return readGraph(G, nullptr, nullptr); }
83
84 bool read(Graph& G, GraphAttributes& GA) { return readGraph(G, &GA, nullptr); }
85
86 bool read(Graph& G, ClusterGraph& C) { return readGraph(G, nullptr, &C); }
87
89 return readGraph(G, &CA, &C);
90 }
91};
92
93}
94}
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.
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.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
Parser(std::istream &is)
std::map< int, node > m_idNode
Definition TlpParser.h:57
std::vector< Token >::const_iterator Iterator
Definition TlpParser.h:56
bool readProperty(Graph &G, GraphAttributes *GA)
std::istream & m_istream
Definition TlpParser.h:60
void tokenError(const std::string &str, bool got=true)
Iterator m_begin
Definition TlpParser.h:61
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:58
bool read(Graph &G, ClusterGraph &C, ClusterGraphAttributes &CA)
Definition TlpParser.h:88
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:86
bool read(Graph &G, GraphAttributes &GA)
Definition TlpParser.h:84
bool read(Graph &G)
Definition TlpParser.h:82
bool readEdge(Graph &G)
Attribute
Definition Tlp.h:41
The namespace for all OGDF objects.