Changeset View
Changeset View
Standalone View
Standalone View
src/part/graphnode.h
Show All 18 Lines | |||||
19 | /* This file was callgraphview.h, part of KCachegrind. | 19 | /* This file was callgraphview.h, part of KCachegrind. | ||
20 | Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | 20 | Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | ||
21 | 21 | | |||
22 | KCachegrind is free software; you can redistribute it and/or | 22 | KCachegrind is free software; you can redistribute it and/or | ||
23 | modify it under the terms of the GNU General Public | 23 | modify it under the terms of the GNU General Public | ||
24 | License as published by the Free Software Foundation, version 2. | 24 | License as published by the Free Software Foundation, version 2. | ||
25 | */ | 25 | */ | ||
26 | 26 | | |||
27 | | ||||
28 | /* | 27 | /* | ||
29 | * Graph Node model | 28 | * Graph Node model | ||
30 | */ | 29 | */ | ||
31 | 30 | | |||
32 | #ifndef GRAPH_NODE_H | 31 | #ifndef GRAPH_NODE_H | ||
33 | #define GRAPH_NODE_H | 32 | #define GRAPH_NODE_H | ||
34 | 33 | | |||
35 | #include <QVector> | | |||
36 | #include <QList> | 34 | #include <QList> | ||
37 | #include <QMap> | 35 | #include <QMap> | ||
38 | #include <QTextStream> | 36 | #include <QTextStream> | ||
37 | #include <QVector> | ||||
39 | 38 | | |||
40 | #include <graphviz/gvc.h> | 39 | #include <graphviz/gvc.h> | ||
41 | 40 | | |||
42 | #include "dotrenderop.h" | | |||
43 | #include "dotgrammar.h" | | |||
44 | #include "graphelement.h" | | |||
45 | #include "canvaselement.h" | 41 | #include "canvaselement.h" | ||
46 | #include "canvasnode.h" | 42 | #include "canvasnode.h" | ||
43 | #include "dotgrammar.h" | ||||
44 | #include "dotrenderop.h" | ||||
45 | #include "graphelement.h" | ||||
47 | 46 | | |||
48 | namespace KGraphViewer | 47 | namespace KGraphViewer | ||
49 | { | 48 | { | ||
50 | | ||||
51 | class CanvasNode; | 49 | class CanvasNode; | ||
52 | 50 | | |||
53 | /** | 51 | /** | ||
54 | * Colors and styles are DOT names | 52 | * Colors and styles are DOT names | ||
55 | */ | 53 | */ | ||
56 | class GraphNode : public GraphElement | 54 | class GraphNode : public GraphElement | ||
57 | { | 55 | { | ||
58 | Q_OBJECT | 56 | Q_OBJECT | ||
59 | public: | 57 | public: | ||
60 | GraphNode(); | 58 | GraphNode(); | ||
61 | explicit GraphNode(const GraphNode& gn); | 59 | explicit GraphNode(const GraphNode &gn); | ||
62 | explicit GraphNode(node_t* gn); | 60 | explicit GraphNode(node_t *gn); | ||
63 | 61 | | |||
64 | ~GraphNode() override {} | 62 | ~GraphNode() override | ||
63 | { | ||||
64 | } | ||||
65 | 65 | | |||
66 | inline CanvasNode* canvasNode() { return dynamic_cast<CanvasNode*>(canvasElement()); } | 66 | inline CanvasNode *canvasNode() | ||
67 | inline const CanvasNode* canvasNode() const { return dynamic_cast<const CanvasNode*>(canvasElement()); } | 67 | { | ||
68 | inline void setCanvasNode(CanvasNode* cn) { setCanvasElement((CanvasElement*)cn); } | 68 | return dynamic_cast<CanvasNode *>(canvasElement()); | ||
69 | } | ||||
70 | inline const CanvasNode *canvasNode() const | ||||
71 | { | ||||
72 | return dynamic_cast<const CanvasNode *>(canvasElement()); | ||||
73 | } | ||||
74 | inline void setCanvasNode(CanvasNode *cn) | ||||
75 | { | ||||
76 | setCanvasElement((CanvasElement *)cn); | ||||
77 | } | ||||
69 | 78 | | |||
70 | void updateWithNode(const GraphNode& node); | 79 | void updateWithNode(const GraphNode &node); | ||
71 | void updateWithNode(node_t* node); | 80 | void updateWithNode(node_t *node); | ||
72 | 81 | | |||
73 | | ||||
74 | private: | 82 | private: | ||
75 | }; | 83 | }; | ||
76 | 84 | | |||
77 | /** A map associating the ids of a graph's nodes to these nodes */ | 85 | /** A map associating the ids of a graph's nodes to these nodes */ | ||
78 | typedef QMap<QString, GraphNode*> GraphNodeMap; | 86 | typedef QMap<QString, GraphNode *> GraphNodeMap; | ||
79 | 87 | | |||
80 | QTextStream& operator<<(QTextStream& s, const GraphNode& n); | 88 | QTextStream &operator<<(QTextStream &s, const GraphNode &n); | ||
81 | 89 | | |||
82 | } | 90 | } | ||
83 | 91 | | |||
84 | #endif | 92 | #endif | ||
85 | | ||||
86 | | ||||
87 | |