Doxygen
Loading...
Searching...
No Matches
dirdef.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2020 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 DIRDEF_H
17#define DIRDEF_H
18
19
20#include <vector>
21#include <map>
22
23#include "qcstring.h"
24#include "linkedmap.h"
25#include "definition.h"
26
27class FileList;
28class FileDef;
29class OutputList;
30class UsedDir;
31class FilePair;
32class FilePairDict;
33class DirDef;
34class DirList;
35
36bool compareDirDefs(const DirDef *item1, const DirDef *item2);
37
38// ------------------
39
40/** Class representing a pair of FileDef objects */
42{
43 public:
44 FilePair(const FileDef *src,const FileDef *dst) : m_src(src), m_dst(dst) {}
45 const FileDef *source() const { return m_src; }
46 const FileDef *destination() const { return m_dst; }
47 static QCString key(const FileDef *srcFd,const FileDef *dstFd);
48 private:
49 const FileDef *m_src;
50 const FileDef *m_dst;
51};
52
53// ------------------
54
55/** A linked map of file pairs */
56class FilePairLinkedMap : public LinkedMap<FilePair>
57{
58};
59
60// ------------------
61
62/** Usage information of a directory. */
64{
65 public:
66 UsedDir(const DirDef *dir);
67
68 /**
69 * Take up dependency between files.
70 * @param[in] srcFd dependent file which depends on dstFd
71 * @param[in] dstFd dependee file on which srcFd depends on
72 * @param[in] srcDirect true iff the source dependency was the direct (not inherited from a sub dir)
73 * @param[in] dstDirect true iff the destination dependency was direct (not inherited from a sub dir)
74 */
75 void addFileDep(const FileDef *srcFd,const FileDef *dstFd, bool srcDirect, bool dstDirect);
76 FilePair *findFilePair(const QCString &name);
77 const FilePairLinkedMap &filePairs() const { return m_filePairs; }
78 const DirDef *dir() const { return m_dir; }
79
80 /** Returns true iff any of the dependencies between source and destination files are
81 * direct (i.e. not "inherited" from sub directories)
82 */
83 bool hasDirectDeps() const { return m_hasDirectDeps; }
84
85 /** Returns true iff any of the dependencies from the source file to the destination file are
86 * directly coming from a file in the source directory (i.e. not inherited via sub directories)
87 */
88 bool hasDirectSrcDeps() const { return m_hasDirectSrcDeps; }
89
90 /** Returns true iff any of the dependencies from the source file to the destination file are
91 * directly targeting a file in the destination directory (i.e. not inherited via sub directories)
92 */
93 bool hasDirectDstDeps() const { return m_hasDirectDstDeps; }
94
95 void sort();
96
97 private:
98 const DirDef *m_dir;
100
101 bool m_hasDirectDeps = false;
102 bool m_hasDirectSrcDeps = false;
103 bool m_hasDirectDstDeps = false;
104};
105
106// ------------------
107
108/** A model of a directory symbol. */
109class DirDef : public DefinitionMutable, public Definition
110{
111 public:
112 class UsedDirLinkedMap : public LinkedMap<UsedDir> {};
113
114 // accessors
115 virtual const QCString shortName() const = 0;
116 virtual void addSubDir(DirDef *subdir) = 0;
117 virtual const FileList &getFiles() const = 0;
118 virtual void addFile(FileDef *fd) = 0;
119 virtual const DirList &subDirs() const = 0;
120 virtual bool hasSubdirs() const = 0;
121 virtual int level() const = 0;
122 virtual DirDef *parent() const = 0;
123 virtual int dirIndex() const = 0;
124 virtual const UsedDirLinkedMap &usedDirs() const = 0;
125 virtual bool isParentOf(const DirDef *dir) const = 0;
126 virtual bool depGraphIsTrivial() const = 0;
127 virtual QCString shortTitle() const = 0;
128 virtual bool hasDetailedDescription() const = 0;
129
130 // generate output
131 virtual void writeDocumentation(OutputList &ol) = 0;
132 virtual void writeTagFile(TextStream &t) = 0;
133
134 virtual void setDiskName(const QCString &name) = 0;
135 virtual void setDirIndex(int index) = 0;
136 virtual void sort() = 0;
137 virtual void setParent(DirDef *parent) = 0;
138 virtual void setLevel() = 0;
139 virtual void addUsesDependency(const DirDef *usedDir,const FileDef *srcFd,
140 const FileDef *dstFd,bool srcDirect, bool dstDirect) = 0;
141 virtual void computeDependencies() = 0;
142
143 // directory graph related members
144 virtual bool hasDirectoryGraph() const = 0;
145 virtual void overrideDirectoryGraph(bool e) = 0;
146};
147
148// --- Cast functions
149
151const DirDef *toDirDef(const Definition *d);
152
153/** A usage relation between two directories. */
155{
156 public:
157 DirRelation(const QCString &name,const DirDef *src,UsedDir *dst)
158 : m_name(name), m_src(src), m_dst(dst) {}
159 const DirDef *source() const { return m_src; }
160 UsedDir *destination() const { return m_dst; }
163
164 private:
166 const DirDef *m_src;
168};
169
170/** A linked map of directories */
171class DirLinkedMap : public LinkedMap<DirDef>
172{
173};
174
175/** A list of directories. */
176class DirList : public std::vector<const DirDef*>
177{
178};
179
180class DirRelationLinkedMap : public LinkedMap<DirRelation>
181{
182};
183
184// ------------------
185
186void buildDirectories();
189
190#endif
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual const QCString & name() const =0
A model of a directory symbol.
Definition dirdef.h:110
virtual int level() const =0
virtual void sort()=0
virtual bool isParentOf(const DirDef *dir) const =0
virtual void setLevel()=0
virtual void writeDocumentation(OutputList &ol)=0
virtual void addFile(FileDef *fd)=0
virtual void computeDependencies()=0
virtual void addSubDir(DirDef *subdir)=0
virtual int dirIndex() const =0
virtual DirDef * parent() const =0
virtual void writeTagFile(TextStream &t)=0
virtual void addUsesDependency(const DirDef *usedDir, const FileDef *srcFd, const FileDef *dstFd, bool srcDirect, bool dstDirect)=0
virtual bool hasDetailedDescription() const =0
virtual void setParent(DirDef *parent)=0
virtual bool hasDirectoryGraph() const =0
virtual bool depGraphIsTrivial() const =0
virtual const QCString shortName() const =0
virtual const DirList & subDirs() const =0
virtual void overrideDirectoryGraph(bool e)=0
virtual const UsedDirLinkedMap & usedDirs() const =0
virtual void setDirIndex(int index)=0
virtual const FileList & getFiles() const =0
virtual QCString shortTitle() const =0
virtual bool hasSubdirs() const =0
virtual void setDiskName(const QCString &name)=0
A linked map of directories.
Definition dirdef.h:172
A list of directories.
Definition dirdef.h:177
const DirDef * m_src
Definition dirdef.h:166
UsedDir * destination() const
Definition dirdef.h:160
UsedDir * m_dst
Definition dirdef.h:167
QCString m_name
Definition dirdef.h:165
void writeDocumentation(OutputList &ol)
Definition dirdef.cpp:919
QCString getOutputFileBase() const
Definition dirdef.h:162
const DirDef * source() const
Definition dirdef.h:159
DirRelation(const QCString &name, const DirDef *src, UsedDir *dst)
Definition dirdef.h:157
A model of a file symbol.
Definition filedef.h:99
Class representing a pair of FileDef objects.
Definition dirdef.h:42
const FileDef * m_dst
Definition dirdef.h:50
const FileDef * destination() const
Definition dirdef.h:46
FilePair(const FileDef *src, const FileDef *dst)
Definition dirdef.h:44
static QCString key(const FileDef *srcFd, const FileDef *dstFd)
Definition dirdef.cpp:883
const FileDef * source() const
Definition dirdef.h:45
const FileDef * m_src
Definition dirdef.h:49
A linked map of file pairs.
Definition dirdef.h:57
Container class representing a vector of objects with keys.
Definition linkedmap.h:36
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:314
This is an alternative implementation of QCString.
Definition qcstring.h:101
Text streaming class that buffers data.
Definition textstream.h:36
Usage information of a directory.
Definition dirdef.h:64
bool m_hasDirectDstDeps
Definition dirdef.h:103
void sort()
Definition dirdef.cpp:805
FilePairLinkedMap m_filePairs
Definition dirdef.h:99
bool hasDirectDstDeps() const
Returns true iff any of the dependencies from the source file to the destination file are directly ta...
Definition dirdef.h:93
bool m_hasDirectDeps
Definition dirdef.h:101
void addFileDep(const FileDef *srcFd, const FileDef *dstFd, bool srcDirect, bool dstDirect)
Take up dependency between files.
Definition dirdef.cpp:797
const DirDef * dir() const
Definition dirdef.h:78
UsedDir(const DirDef *dir)
Definition dirdef.cpp:792
bool hasDirectSrcDeps() const
Returns true iff any of the dependencies from the source file to the destination file are directly co...
Definition dirdef.h:88
bool hasDirectDeps() const
Returns true iff any of the dependencies between source and destination files are direct (i....
Definition dirdef.h:83
FilePair * findFilePair(const QCString &name)
Definition dirdef.cpp:818
const FilePairLinkedMap & filePairs() const
Definition dirdef.h:77
bool m_hasDirectSrcDeps
Definition dirdef.h:102
const DirDef * m_dir
Definition dirdef.h:98
bool compareDirDefs(const DirDef *item1, const DirDef *item2)
Definition dirdef.cpp:1168
void buildDirectories()
Definition dirdef.cpp:1055
void computeDirDependencies()
Definition dirdef.cpp:1129
DirDef * toDirDef(Definition *d)
Definition dirdef.cpp:1175
void generateDirDocs(OutputList &ol)
Definition dirdef.cpp:1146