Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
GdfParser.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
36
37#include <cstddef>
38#include <istream>
39#include <string>
40#include <vector>
41
42namespace ogdf::gdf {
43enum class EdgeAttribute;
44enum class NodeAttribute;
45} // namespace ogdf::gdf
46
47namespace ogdf {
48class GraphAttributes;
49
50namespace gdf {
51
52
53class Parser {
54private:
55 std::istream& m_istream;
57 std::vector<NodeAttribute> m_nodeAttrs;
58 std::vector<EdgeAttribute> m_edgeAttrs;
59
60 bool readAttributes(GraphAttributes& GA, node v, const std::vector<std::string>& values);
61 bool readAttributes(GraphAttributes& GA, edge e, const std::vector<std::string>& values);
62
63 bool readNodeDef(const std::string& str);
64 bool readEdgeDef(const std::string& str);
65
66 bool readNodeStmt(Graph& G, GraphAttributes* GA, const std::string& str, size_t line);
67 bool readEdgeStmt(Graph& G, GraphAttributes* GA, const std::string& str, size_t line);
68
70
71public:
72 explicit Parser(std::istream& is);
73
74 bool read(Graph& G) { return readGraph(G, nullptr); }
75
76 bool read(Graph& G, GraphAttributes& GA) { return readGraph(G, &GA); }
77};
78
79}
80}
Includes declaration of graph class.
Declaration and implementation of HashArray class.
Class for the representation of edges.
Definition Graph_d.h:364
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Indexed arrays using hashing for element access.
Definition HashArray.h:93
Class for the representation of nodes.
Definition Graph_d.h:241
bool readNodeStmt(Graph &G, GraphAttributes *GA, const std::string &str, size_t line)
HashArray< std::string, node > m_nodeId
Definition GdfParser.h:56
bool read(Graph &G, GraphAttributes &GA)
Definition GdfParser.h:76
bool readAttributes(GraphAttributes &GA, edge e, const std::vector< std::string > &values)
bool readEdgeStmt(Graph &G, GraphAttributes *GA, const std::string &str, size_t line)
std::vector< NodeAttribute > m_nodeAttrs
Definition GdfParser.h:57
Parser(std::istream &is)
bool readAttributes(GraphAttributes &GA, node v, const std::vector< std::string > &values)
bool read(Graph &G)
Definition GdfParser.h:74
std::istream & m_istream
Definition GdfParser.h:55
bool readEdgeDef(const std::string &str)
bool readGraph(Graph &G, GraphAttributes *GA)
bool readNodeDef(const std::string &str)
std::vector< EdgeAttribute > m_edgeAttrs
Definition GdfParser.h:58
EdgeAttribute
Definition GDF.h:67
NodeAttribute
Definition GDF.h:43
The namespace for all OGDF objects.