Doxygen
dotgraph.h
浏览该文件的文档.
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 
21 #include "qcstring.h"
22 #include "dir.h"
23 
24 class DotNode;
25 class TextStream;
26 
30 
31 /** A dot graph */
32 class DotGraph
33 {
34  public:
37  virtual ~DotGraph() {}
38 
39  protected:
40  /** returns node numbers. The Counter is reset by the constructor */
41  int getNextNodeNumber() { return ++m_curNodeNumber; }
42 
46  const QCString &path,
47  const QCString &fileName,
48  const QCString &relPath,
49  bool writeImageMap=TRUE,
50  int graphId=-1
51  );
52 
53  static void writeGraphHeader(TextStream& t, const QCString& title = QCString());
54  static void writeGraphFooter(TextStream& t);
55  static void computeGraph(DotNode* root,
56  GraphType gt,
57  GraphOutputFormat format,
58  const QCString& rank, // either "LR", "RL", or ""
59  bool renderParents,
60  bool backArrows,
61  const QCString& title,
62  QCString& graphStr
63  );
64 
65  virtual QCString getBaseName() const = 0;
66  virtual QCString absMapName() const { return m_absPath + m_baseName + ".map"; }
67  virtual QCString getMapLabel() const = 0;
68  virtual QCString getImgAltText() const { return ""; }
69 
70  virtual void computeTheGraph() = 0;
71 
72  QCString absBaseName() const { return m_absPath + m_baseName; }
73  QCString absDotName() const { return m_absPath + m_baseName + ".dot"; }
74  QCString imgName() const;
75  QCString absImgName() const { return m_absPath + imgName(); }
76  QCString relImgName() const { return m_relPath + imgName(); }
77 
78  // the following variables are used while writing the graph to a .dot file
84  bool m_generateImageMap = false;
85  int m_graphId = 0;
86 
90  bool m_regenerate = false;
91  bool m_doNotAddImageToIndex = false;
92  bool m_noDivTag = false;
93  bool m_zoomable = true;
94  bool m_urlOnly = false;
95 
96  private:
97  DotGraph(const DotGraph &);
98  DotGraph &operator=(const DotGraph &);
99 
100  bool prepareDotFile();
101  void generateCode(TextStream &t);
102 
104 };
105 
106 #endif
DotGraph::m_graphId
int m_graphId
Definition: dotgraph.h:85
DotGraph::m_urlOnly
bool m_urlOnly
Definition: dotgraph.h:94
DotGraph::computeGraph
static void computeGraph(DotNode *root, GraphType gt, GraphOutputFormat format, const QCString &rank, bool renderParents, bool backArrows, const QCString &title, QCString &graphStr)
Definition: dotgraph.cpp:305
DotGraph::m_theGraph
QCString m_theGraph
Definition: dotgraph.h:89
DotGraph::m_dir
Dir m_dir
Definition: dotgraph.h:81
DotGraph::m_doNotAddImageToIndex
bool m_doNotAddImageToIndex
Definition: dotgraph.h:91
Dir
Class representing a directory in the file system
Definition: dir.h:68
DotGraph::getImgAltText
virtual QCString getImgAltText() const
Definition: dotgraph.h:68
DotGraph::operator=
DotGraph & operator=(const DotGraph &)
DotGraph::relImgName
QCString relImgName() const
Definition: dotgraph.h:76
DotGraph::m_regenerate
bool m_regenerate
Definition: dotgraph.h:90
DotGraph::absBaseName
QCString absBaseName() const
Definition: dotgraph.h:72
DotGraph::getMapLabel
virtual QCString getMapLabel() const =0
DotGraph::generateCode
void generateCode(TextStream &t)
Definition: dotgraph.cpp:204
DotGraph::writeGraphFooter
static void writeGraphFooter(TextStream &t)
Definition: dotgraph.cpp:300
DotGraph::absDotName
QCString absDotName() const
Definition: dotgraph.h:73
EOF_Rtf
@ EOF_Rtf
Definition: dotgraph.h:28
DotGraph::getNextNodeNumber
int getNextNodeNumber()
returns node numbers.
Definition: dotgraph.h:41
TextStream
Text streaming class that buffers data.
Definition: textstream.h:33
DotGraph::writeGraphHeader
static void writeGraphHeader(TextStream &t, const QCString &title=QCString())
Definition: dotgraph.cpp:268
qcstring.h
EOF_LaTeX
@ EOF_LaTeX
Definition: dotgraph.h:28
DotGraph::m_absPath
QCString m_absPath
Definition: dotgraph.h:87
DotGraph::DotGraph
DotGraph()
Definition: dotgraph.h:35
DotNode
A node in a dot graph
Definition: dotnode.h:56
DotGraph::absMapName
virtual QCString absMapName() const
Definition: dotgraph.h:66
DotGraph::m_textFormat
EmbeddedOutputFormat m_textFormat
Definition: dotgraph.h:80
DotGraph::m_curNodeNumber
int m_curNodeNumber
Definition: dotgraph.h:103
EOF_DocBook
@ EOF_DocBook
Definition: dotgraph.h:28
GraphType
GraphType
Definition: dotgraph.h:29
Dependency
@ Dependency
Definition: dotgraph.h:29
DotGraph::m_graphFormat
GraphOutputFormat m_graphFormat
Definition: dotgraph.h:79
TRUE
#define TRUE
Definition: qcstring.h:36
Collaboration
@ Collaboration
Definition: dotgraph.h:29
Hierarchy
@ Hierarchy
Definition: dotgraph.h:29
DotGraph::writeGraph
QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
Definition: dotgraph.cpp:111
DotGraph::m_zoomable
bool m_zoomable
Definition: dotgraph.h:93
GOF_BITMAP
@ GOF_BITMAP
Definition: dotgraph.h:27
CallGraph
@ CallGraph
Definition: dotgraph.h:29
DotGraph::m_fileName
QCString m_fileName
Definition: dotgraph.h:82
DotGraph::absImgName
QCString absImgName() const
Definition: dotgraph.h:75
DotGraph::computeTheGraph
virtual void computeTheGraph()=0
DotGraph::imgName
QCString imgName() const
Definition: dotgraph.cpp:105
DotGraph::getBaseName
virtual QCString getBaseName() const =0
Inheritance
@ Inheritance
Definition: dotgraph.h:29
DotGraph::~DotGraph
virtual ~DotGraph()
Definition: dotgraph.h:37
EmbeddedOutputFormat
EmbeddedOutputFormat
Definition: dotgraph.h:28
GraphOutputFormat
GraphOutputFormat
Definition: dotgraph.h:27
DotGraph::m_noDivTag
bool m_noDivTag
Definition: dotgraph.h:92
DotGraph::prepareDotFile
bool prepareDotFile()
Definition: dotgraph.cpp:143
EOF_Html
@ EOF_Html
Definition: dotgraph.h:28
GOF_EPS
@ GOF_EPS
Definition: dotgraph.h:27
DotGraph::m_generateImageMap
bool m_generateImageMap
Definition: dotgraph.h:84
DotGraph
A dot graph
Definition: dotgraph.h:32
DotGraph::m_relPath
QCString m_relPath
Definition: dotgraph.h:83
dir.h
DotGraph::m_baseName
QCString m_baseName
Definition: dotgraph.h:88
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108