1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
/******************************************************************************
*
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef DOTNODE_H
#define DOTNODE_H
#include <vector>
#include "dotgraph.h"
class ClassDef;
class DotNode;
class FTextStream;
/** Attributes of an edge of a dot graph */
class EdgeInfo
{
public:
enum Colors { Blue=0, Green=1, Red=2, Purple=3, Grey=4, Orange=5, Orange2=6 };
enum Styles { Solid=0, Dashed=1 };
EdgeInfo(int color,int style,const QCString &lab,const QCString &url,int labColor)
: m_color(color), m_style(style), m_label(lab), m_url(url), m_labColor(labColor) {}
~EdgeInfo() {}
int color() const { return m_color; }
int style() const { return m_style; }
QCString label() const { return m_label; }
QCString url() const { return m_url; }
int labelColor() const { return m_labColor; }
private:
int m_color;
int m_style;
QCString m_label;
QCString m_url;
int m_labColor;
};
using DotNodeRefVector = std::vector<DotNode*>;
using EdgeInfoVector = std::vector<EdgeInfo>;
/** A node in a dot graph */
class DotNode
{
public:
static void deleteNodes(DotNode* node);
static QCString convertLabel(const QCString& l);
DotNode(int n,const char *lab,const char *tip,const char *url,
bool rootNode=FALSE,const ClassDef *cd=0);
~DotNode();
enum TruncState { Unknown, Truncated, Untruncated };
void addChild(DotNode *n,
int edgeColor=EdgeInfo::Purple,
int edgeStyle=EdgeInfo::Solid,
const char *edgeLab=0,
const char *edgeURL=0,
int edgeLabCol=-1);
void addParent(DotNode *n);
void deleteNode(DotNodeRefVector &deletedList);
void removeChild(DotNode *n);
void removeParent(DotNode *n);
int findParent( DotNode *n );
void write(FTextStream &t,GraphType gt,GraphOutputFormat f,
bool topDown,bool toChildren,bool backArrows) const;
void writeXML(FTextStream &t,bool isClassGraph) const;
void writeDocbook(FTextStream &t,bool isClassGraph) const;
void writeDEF(FTextStream &t) const;
void writeBox(FTextStream &t,GraphType gt,GraphOutputFormat f,
bool hasNonReachableChildren) const;
void writeArrow(FTextStream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn,
const EdgeInfo *ei,bool topDown, bool pointBack=TRUE) const;
QCString label() const { return m_label; }
int number() const { return m_number; }
bool isVisible() const { return m_visible; }
TruncState isTruncated() const { return m_truncated; }
int distance() const { return m_distance; }
int subgraphId() const { return m_subgraphId; }
bool isRenumbered() const { return m_renumbered; }
bool hasDocumentation() const { return m_hasDoc; }
bool isWritten() const { return m_written; }
void clearWriteFlag();
void renumberNodes(int &number);
void markRenumbered() { m_renumbered = true; }
void markHasDocumentation() { m_hasDoc = true; }
void setSubgraphId(int id) { m_subgraphId = id; }
void colorConnectedNodes(int curColor);
void setDistance(int distance);
const DotNode *findDocNode() const; // only works for acyclic graphs!
void markAsVisible(bool b=TRUE) { m_visible=b; }
void markAsTruncated(bool b=TRUE) { m_truncated=b ? Truncated : Untruncated; }
const DotNodeRefVector &children() const { return m_children; }
const DotNodeRefVector &parents() const { return m_parents; }
const EdgeInfoVector &edgeInfo() const { return m_edgeInfo; }
private:
int m_number;
QCString m_label; //!< label text
QCString m_tooltip; //!< node's tooltip
QCString m_url; //!< url of the node (format: remote$local)
DotNodeRefVector m_parents; //!< list of parent nodes (incoming arrows)
DotNodeRefVector m_children; //!< list of child nodes (outgoing arrows)
EdgeInfoVector m_edgeInfo; //!< edge info for each child
bool m_deleted = false; //!< used to mark a node as deleted
mutable bool m_written = false; //!< used to mark a node as written
bool m_hasDoc = false; //!< used to mark a node as documented
bool m_isRoot; //!< indicates if this is a root node
const ClassDef * m_classDef; //!< class representing this node (can be 0)
bool m_visible = false; //!< is the node visible in the output
TruncState m_truncated = Unknown; //!< does the node have non-visible children/parents
int m_distance = 1000; //!< shortest path to the root node
bool m_renumbered = false; //!< indicates if the node has been renumbered (to prevent endless loops)
int m_subgraphId = -1;
};
#endif
|