Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
dotgraph.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2019 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#ifndef DOTGRAPH_H
17
#define DOTGRAPH_H
18
19
#include <iostream>
20
#include <map>
21
22
#include "
construct.h
"
23
#include "
dir.h
"
24
#include "
dstring.h
"
25
26
class
DotNode
;
27
class
TextStream
;
28
29
enum class
GraphOutputFormat
{
BITMAP
,
EPS
};
30
enum class
EmbeddedOutputFormat
{
Html
,
LaTeX
,
Rtf
,
DocBook
};
31
enum class
GraphType
{
Dependency
,
Inheritance
,
Collaboration
,
Hierarchy
,
CallGraph
};
32
33
/** A dot graph */
34
class
DotGraph
35
{
36
friend
class
DotNode
;
37
public
:
38
DotGraph
() :
m_doNotAddImageToIndex
(false),
m_noDivTag
(false),
39
m_zoomable
(true),
m_urlOnly
(false) {}
40
virtual
~DotGraph
() =
default
;
41
NON_COPYABLE
(
DotGraph
)
42
43
protected
:
44
/** returns the node number. */
45
int
getNextNodeNumber
() {
return
++
m_curNodeNumber
; }
46
/** returns the edge number. */
47
int
getNextEdgeNumber
() {
return
++
m_curEdgeNumber
; }
48
49
DString
writeGraph
(
TextStream
&t,
50
GraphOutputFormat
gf,
51
EmbeddedOutputFormat
ef,
52
const
DString
&path,
53
const
DString
&fileName,
54
const
DString
&relPath,
55
bool
writeImageMap=
true
,
56
int
graphId=-1
57
);
58
59
static
void
writeGraphHeader
(
TextStream
& t,
const
DString
& title =
DString
());
60
static
void
writeGraphFooter
(
TextStream
& t);
61
static
void
computeGraph
(
DotNode
* root,
62
GraphType
gt,
63
GraphOutputFormat
format,
64
const
DString
& rank,
// either "LR", "RL", or ""
65
bool
renderParents,
66
bool
backArrows,
67
const
DString
& title,
68
DString
& graphStr
69
);
70
71
virtual
DString
getBaseName
()
const
= 0;
72
virtual
DString
absMapName
()
const
{
return
m_absPath
+
m_baseName
+
".map"
; }
73
virtual
DString
getMapLabel
()
const
= 0;
74
virtual
DString
getImgAltText
()
const
{
return
""
; }
75
76
virtual
void
computeTheGraph
() = 0;
77
78
DString
absBaseName
()
const
{
return
m_absPath
+
m_baseName
; }
79
DString
absDotName
()
const
{
return
m_absPath
+
m_baseName
+
".dot"
; }
80
DString
imgName
()
const
;
81
DString
absImgName
()
const
{
return
m_absPath
+
imgName
(); }
82
DString
relImgName
()
const
{
return
m_relPath
+
imgName
(); }
83
84
// the following variables are used while writing the graph to a .dot file
85
GraphOutputFormat
m_graphFormat
=
GraphOutputFormat::BITMAP
;
86
EmbeddedOutputFormat
m_textFormat
=
EmbeddedOutputFormat::Html
;
87
Dir
m_dir
;
88
DString
m_fileName
;
89
DString
m_relPath
;
90
bool
m_generateImageMap
=
false
;
91
int
m_graphId
= 0;
92
93
DString
m_absPath
;
94
DString
m_baseName
;
95
DString
m_theGraph
;
96
bool
m_regenerate
=
false
;
97
bool
m_doNotAddImageToIndex
=
false
;
98
bool
m_noDivTag
=
false
;
99
bool
m_zoomable
=
true
;
100
bool
m_urlOnly
=
false
;
101
102
private
:
103
104
bool
prepareDotFile
();
105
void
generateCode
(
TextStream
&t);
106
107
int
m_curNodeNumber
= 0;
108
int
m_curEdgeNumber
= 0;
109
};
110
111
#endif
DString
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition
dstring.h:88
DString::DString
DString()=default
Dir
Class representing a directory in the file system.
Definition
dir.h:73
DotGraph::computeGraph
static void computeGraph(DotNode *root, GraphType gt, GraphOutputFormat format, const DString &rank, bool renderParents, bool backArrows, const DString &title, DString &graphStr)
Definition
dotgraph.cpp:299
DotGraph::m_baseName
DString m_baseName
Definition
dotgraph.h:94
DotGraph::m_noDivTag
bool m_noDivTag
Definition
dotgraph.h:98
DotGraph::m_dir
Dir m_dir
Definition
dotgraph.h:87
DotGraph::m_graphId
int m_graphId
Definition
dotgraph.h:91
DotGraph::m_textFormat
EmbeddedOutputFormat m_textFormat
Definition
dotgraph.h:86
DotGraph::m_theGraph
DString m_theGraph
Definition
dotgraph.h:95
DotGraph::writeGraphFooter
static void writeGraphFooter(TextStream &t)
Definition
dotgraph.cpp:294
DotGraph::m_urlOnly
bool m_urlOnly
Definition
dotgraph.h:100
DotGraph::absDotName
DString absDotName() const
Definition
dotgraph.h:79
DotGraph::m_graphFormat
GraphOutputFormat m_graphFormat
Definition
dotgraph.h:85
DotGraph::m_fileName
DString m_fileName
Definition
dotgraph.h:88
DotGraph::~DotGraph
virtual ~DotGraph()=default
DotGraph::DotGraph
DotGraph()
Definition
dotgraph.h:38
DotGraph::generateCode
void generateCode(TextStream &t)
Definition
dotgraph.cpp:204
DotGraph::prepareDotFile
bool prepareDotFile()
Definition
dotgraph.cpp:150
DotGraph::absImgName
DString absImgName() const
Definition
dotgraph.h:81
DotGraph::m_curNodeNumber
int m_curNodeNumber
Definition
dotgraph.h:107
DotGraph::getImgAltText
virtual DString getImgAltText() const
Definition
dotgraph.h:74
DotGraph::getBaseName
virtual DString getBaseName() const =0
DotGraph::m_relPath
DString m_relPath
Definition
dotgraph.h:89
DotGraph::m_doNotAddImageToIndex
bool m_doNotAddImageToIndex
Definition
dotgraph.h:97
DotGraph::relImgName
DString relImgName() const
Definition
dotgraph.h:82
DotGraph::getMapLabel
virtual DString getMapLabel() const =0
DotGraph::m_regenerate
bool m_regenerate
Definition
dotgraph.h:96
DotGraph::getNextEdgeNumber
int getNextEdgeNumber()
returns the edge number.
Definition
dotgraph.h:47
DotGraph::absMapName
virtual DString absMapName() const
Definition
dotgraph.h:72
DotGraph::m_zoomable
bool m_zoomable
Definition
dotgraph.h:99
DotGraph::writeGraph
DString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool writeImageMap=true, int graphId=-1)
Definition
dotgraph.cpp:114
DotGraph::getNextNodeNumber
int getNextNodeNumber()
returns the node number.
Definition
dotgraph.h:45
DotGraph::m_absPath
DString m_absPath
Definition
dotgraph.h:93
DotGraph::absBaseName
DString absBaseName() const
Definition
dotgraph.h:78
DotGraph::imgName
DString imgName() const
Definition
dotgraph.cpp:106
DotGraph::m_curEdgeNumber
int m_curEdgeNumber
Definition
dotgraph.h:108
DotGraph::writeGraphHeader
static void writeGraphHeader(TextStream &t, const DString &title=DString())
Definition
dotgraph.cpp:269
DotGraph::computeTheGraph
virtual void computeTheGraph()=0
DotGraph::DotNode
friend class DotNode
Definition
dotgraph.h:36
DotGraph::m_generateImageMap
bool m_generateImageMap
Definition
dotgraph.h:90
DotNode
A node in a dot graph.
Definition
dotnode.h:67
TextStream
Text streaming class that buffers data.
Definition
textstream.h:36
construct.h
NON_COPYABLE
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition
construct.h:37
DiaOutputFormat::BITMAP
@ BITMAP
Definition
dia.h:21
DiaOutputFormat::EPS
@ EPS
Definition
dia.h:21
dir.h
GraphType
GraphType
Definition
dotgraph.h:31
GraphType::Hierarchy
@ Hierarchy
Definition
dotgraph.h:31
GraphType::Collaboration
@ Collaboration
Definition
dotgraph.h:31
GraphType::Dependency
@ Dependency
Definition
dotgraph.h:31
GraphType::CallGraph
@ CallGraph
Definition
dotgraph.h:31
GraphType::Inheritance
@ Inheritance
Definition
dotgraph.h:31
EmbeddedOutputFormat
EmbeddedOutputFormat
Definition
dotgraph.h:30
EmbeddedOutputFormat::Html
@ Html
Definition
dotgraph.h:30
EmbeddedOutputFormat::DocBook
@ DocBook
Definition
dotgraph.h:30
EmbeddedOutputFormat::LaTeX
@ LaTeX
Definition
dotgraph.h:30
EmbeddedOutputFormat::Rtf
@ Rtf
Definition
dotgraph.h:30
GraphOutputFormat
GraphOutputFormat
Definition
dotgraph.h:29
GraphOutputFormat::BITMAP
@ BITMAP
Definition
dotgraph.h:29
dstring.h
src
dotgraph.h
Generated by
1.19.0