Doxygen
Loading...
Searching...
No Matches
filedef.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 *
4 *
5 * Copyright (C) 1997-2015 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
15 *
16 */
17
18#ifndef FILEDEF_H
19#define FILEDEF_H
20
21#include <memory>
22#include <unordered_set>
23
24#include "definition.h"
25#include "memberlist.h"
26#include "containers.h"
27
28class MemberList;
29class FileDef;
30class FileList;
31class ClassDef;
32class ConceptDef;
33class MemberDef;
34class OutputList;
35class NamespaceDef;
39class DirDef;
40class ClangTUParser;
41
42// --- Set of files
43
44using FileDefSet = std::unordered_set<const FileDef*>;
45
46enum class IncludeKind : uint32_t
47{
48 // bits
49 IncludeSystem = 0x0001,
50 IncludeLocal = 0x0002,
53 ImportSystem = 0x0010, // C++20 header import
54 ImportLocal = 0x0020, // C++20 header import
55 ImportModule = 0x0040 // C++20/Java module import
56};
57
58inline constexpr uint32_t operator|(IncludeKind a, IncludeKind b) { return static_cast<uint32_t>(a) | static_cast<uint32_t>(b); }
59inline constexpr uint32_t operator|(uint32_t a, IncludeKind b) { return a | static_cast<uint32_t>(b); }
60inline constexpr uint32_t operator&(IncludeKind a, uint32_t mask) { return static_cast<uint32_t>(a) & mask; }
61
62// masks
68
72
73/** Class representing the data associated with a \#include statement. */
83
84class IncludeInfoList : public std::vector<IncludeInfo>
85{
86};
87
88bool compareFileDefs(const FileDef *fd1, const FileDef *fd2);
89
90/** A model of a file symbol.
91 *
92 * An object of this class contains all file information that is gathered.
93 * This includes the members and compounds defined in the file.
94 *
95 * The member writeDocumentation() can be used to generate the page of
96 * documentation to HTML and LaTeX.
97 */
98class FileDef : public DefinitionMutable, public Definition
99{
100 public:
102 // ----------------------------------------------------------------------
103
104 /*! Returns the unique file name (this may include part of the path). */
105 virtual QCString fileName() const = 0;
106
107 /*! Returns the name of the verbatim copy of this file (if any). */
108 virtual QCString includeName() const = 0;
109
111
113
114 /*! Returns the absolute path including the file name. */
115 virtual QCString absFilePath() const = 0;
116
117 /*! Returns the name as it is used in the documentation */
118 virtual const QCString &docName() const = 0;
119
120 /*! Returns TRUE if this file is a source file. */
121 virtual bool isSource() const = 0;
122
123 virtual bool isDocumentationFile() const = 0;
124
125 virtual const Definition *getSourceDefinition(int lineNr) const = 0;
126 virtual const MemberDef *getSourceMember(int lineNr) const = 0;
127
128 /*! Returns the absolute path of this file. */
129 virtual QCString getPath() const = 0;
130
131 /*! Returns version of this file. */
132 virtual QCString getVersion() const = 0;
133
134 virtual bool isIncluded(const QCString &name) const = 0;
135
136 virtual DirDef *getDirDef() const = 0;
137 virtual ModuleDef *getModuleDef() const = 0;
138 virtual const LinkedRefMap<NamespaceDef> &getUsedNamespaces() const = 0;
139 virtual const LinkedRefMap<const Definition> &getUsedDefinitions() const = 0;
140 virtual const IncludeInfoList &includeFileList() const = 0;
141 virtual const IncludeInfoList &includedByFileList() const = 0;
142 virtual void getAllIncludeFilesRecursively(StringVector &incFiles) const = 0;
143
145 virtual const MemberLists &getMemberLists() const = 0;
146
147 /* user defined member groups */
148 virtual const MemberGroupList &getMemberGroups() const = 0;
149 virtual const NamespaceLinkedRefMap &getNamespaces() const = 0;
150 virtual const ConceptLinkedRefMap &getConcepts() const = 0;
151 virtual const ClassLinkedRefMap &getClasses() const = 0;
152
153 virtual QCString title() const = 0;
154 virtual bool hasDetailedDescription() const = 0;
155 virtual QCString fileVersion() const = 0;
156
157 virtual bool subGrouping() const = 0;
158
159 virtual void countMembers() = 0;
160 virtual int numDocMembers() const = 0;
161 virtual int numDecMembers() const = 0;
162
163 //---------------------------------
164
165 virtual void addSourceRef(int line,const Definition *d,const MemberDef *md) = 0;
166
167 virtual void writeDocumentation(OutputList &ol) = 0;
168 virtual void writeMemberPages(OutputList &ol) = 0;
169 virtual void writeTagFile(TextStream &t) = 0;
170
171 virtual void writeSourceHeader(OutputList &ol) = 0;
172 virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) = 0;
173 virtual void writeSourceFooter(OutputList &ol) = 0;
174 virtual void parseSource(ClangTUParser *clangParser) = 0;
175 virtual void setDiskName(const QCString &name) = 0;
176
177 virtual void insertMember(MemberDef *md) = 0;
178 virtual void insertClass(ClassDef *cd) = 0;
179 virtual void insertConcept(ConceptDef *cd) = 0;
180 virtual void insertNamespace(NamespaceDef *nd) = 0;
181 virtual void removeMember(MemberDef *md) = 0;
182 virtual void computeAnchors() = 0;
183
184 virtual void setDirDef(DirDef *dd) = 0;
185 virtual void setModuleDef(ModuleDef *mod) = 0;
186
187 virtual void addUsingDirective(NamespaceDef *nd) = 0;
188 virtual void addUsingDeclaration(const Definition *d) = 0;
189 virtual void combineUsingRelations() = 0;
190
191 virtual bool generateSourceFile() const = 0;
192 virtual void sortMemberLists() = 0;
193
194 virtual void addIncludeDependency(const FileDef *fd,const QCString &incName,IncludeKind kind) = 0;
195 virtual void addIncludedByDependency(const FileDef *fd,const QCString &incName,IncludeKind kind) = 0;
196
197 virtual void addMembersToMemberGroup() = 0;
199 virtual void findSectionsInDocumentation() = 0;
200 virtual void addIncludedUsingDirectives(FileDefSet &visitedFiles) = 0;
201
202 virtual void addListReferences() = 0;
203
204 // include graph related members
205 virtual bool hasIncludeGraph() const = 0;
206 virtual bool hasIncludedByGraph() const = 0;
207
208 virtual void overrideIncludeGraph(bool e) = 0;
209 virtual void overrideIncludedByGraph(bool e) = 0;
210};
211
212std::unique_ptr<FileDef> createFileDef(const QCString &p,const QCString &n,const QCString &ref=QCString(),const QCString &dn=QCString());
213
214
215// --- Cast functions
216
218const FileDef *toFileDef(const Definition *d);
219
220// ------------------
221
222class FileList : public std::vector<const FileDef *>
223{
224};
225
227{
228 FilesInDir(const QCString &p) : path(p) {}
230 std::vector<const FileDef *> files;
231};
232
233#endif
234
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition clangparser.h:25
A abstract class representing of a compound symbol.
Definition classdef.h:104
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
A model of a file symbol.
Definition filedef.h:99
virtual void addUsingDeclaration(const Definition *d)=0
virtual void removeMember(MemberDef *md)=0
virtual void setModuleDef(ModuleDef *mod)=0
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual void insertClass(ClassDef *cd)=0
virtual void findSectionsInDocumentation()=0
virtual void writeDocumentation(OutputList &ol)=0
virtual QCString includeName() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual void countMembers()=0
virtual void computeAnchors()=0
virtual void insertConcept(ConceptDef *cd)=0
virtual void addIncludedUsingDirectives(FileDefSet &visitedFiles)=0
virtual void addIncludedByDependency(const FileDef *fd, const QCString &incName, IncludeKind kind)=0
virtual QCString fileVersion() const =0
virtual QCString getVersion() const =0
virtual const Definition * getSourceDefinition(int lineNr) const =0
virtual bool hasDetailedDescription() const =0
virtual bool hasIncludedByGraph() const =0
virtual void writeTagFile(TextStream &t)=0
virtual void overrideIncludeGraph(bool e)=0
virtual const MemberDef * getSourceMember(int lineNr) const =0
virtual ModuleDef * getModuleDef() const =0
virtual QCString getPath() const =0
virtual void writeSourceHeader(OutputList &ol)=0
virtual bool generateSourceFile() const =0
virtual void addSourceRef(int line, const Definition *d, const MemberDef *md)=0
virtual bool isIncluded(const QCString &name) const =0
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual const LinkedRefMap< const Definition > & getUsedDefinitions() const =0
virtual int numDocMembers() const =0
virtual void sortMemberLists()=0
virtual QCString absFilePath() const =0
virtual void setDirDef(DirDef *dd)=0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual QCString includedByDependencyGraphFileName() const =0
virtual void addListReferences()=0
virtual bool isSource() const =0
virtual QCString fileName() const =0
virtual bool hasIncludeGraph() const =0
virtual QCString title() const =0
virtual void parseSource(ClangTUParser *clangParser)=0
virtual const IncludeInfoList & includeFileList() const =0
virtual void getAllIncludeFilesRecursively(StringVector &incFiles) const =0
virtual void setDiskName(const QCString &name)=0
virtual int numDecMembers() const =0
virtual void writeSourceFooter(OutputList &ol)=0
virtual void writeSourceBody(OutputList &ol, ClangTUParser *clangParser)=0
virtual void writeMemberPages(OutputList &ol)=0
virtual bool subGrouping() const =0
virtual const MemberLists & getMemberLists() const =0
virtual void addUsingDirective(NamespaceDef *nd)=0
virtual MemberList * getMemberList(MemberListType lt) const =0
virtual void addMembersToMemberGroup()=0
virtual void overrideIncludedByGraph(bool e)=0
virtual bool isDocumentationFile() const =0
virtual const QCString & docName() const =0
virtual void distributeMemberGroupDocumentation()=0
virtual QCString includeDependencyGraphFileName() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const IncludeInfoList & includedByFileList() const =0
virtual void combineUsingRelations()=0
virtual DirDef * getDirDef() const =0
virtual void insertMember(MemberDef *md)=0
virtual void addIncludeDependency(const FileDef *fd, const QCString &incName, IncludeKind kind)=0
virtual void insertNamespace(NamespaceDef *nd)=0
Container class representing a vector of objects with keys.
Definition linkedmap.h:232
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:108
Wrapper class for the MemberListType type.
Definition types.h:184
An abstract interface of a namespace symbol.
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
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
Definition construct.h:20
std::vector< std::string > StringVector
Definition containers.h:33
constexpr uint32_t IncludeKind_ObjCMask
Definition filedef.h:67
constexpr uint32_t operator|(IncludeKind a, IncludeKind b)
Definition filedef.h:58
QCString includeClose(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:86
QCString includeStatement(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:56
bool compareFileDefs(const FileDef *fd1, const FileDef *fd2)
Definition filedef.cpp:1887
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:1894
IncludeKind
Definition filedef.h:47
@ ImportLocal
Definition filedef.h:54
@ ImportModule
Definition filedef.h:55
@ IncludeLocal
Definition filedef.h:50
@ ImportSystemObjC
Definition filedef.h:51
@ ImportLocalObjC
Definition filedef.h:52
@ IncludeSystem
Definition filedef.h:49
@ ImportSystem
Definition filedef.h:53
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref=QCString(), const QCString &dn=QCString())
Definition filedef.cpp:267
constexpr uint32_t operator&(IncludeKind a, uint32_t mask)
Definition filedef.h:60
constexpr uint32_t IncludeKind_ImportMask
Definition filedef.h:65
QCString includeOpen(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:73
constexpr uint32_t IncludeKind_SystemMask
Definition filedef.h:64
constexpr uint32_t IncludeKind_LocalMask
Definition filedef.h:63
std::unordered_set< const FileDef * > FileDefSet
Definition filedef.h:44
QCString path
Definition filedef.h:229
FilesInDir(const QCString &p)
Definition filedef.h:228
std::vector< const FileDef * > files
Definition filedef.h:230
IncludeInfo()
Definition filedef.h:76
QCString includeName
Definition filedef.h:80
IncludeKind kind
Definition filedef.h:81
IncludeInfo(const FileDef *fd, const QCString &in, IncludeKind k)
Definition filedef.h:77
const FileDef * fileDef
Definition filedef.h:79
SrcLangExt
Language as given by extension.
Definition types.h:42