Doxygen
filedef.h
浏览该文件的文档.
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 <set>
22 
23 #include "index.h"
24 #include "definition.h"
25 #include "memberlist.h"
26 #include "containers.h"
27 
28 class MemberList;
29 class FileDef;
30 class FileList;
31 class ClassDef;
32 class ConceptDef;
33 class MemberDef;
34 class OutputList;
35 class NamespaceDef;
38 class ClassLinkedRefMap;
39 class PackageDef;
40 class DirDef;
41 class ClangTUParser;
42 
43 // --- Set of files
44 
45 using FileDefSet = std::set<const FileDef*>;
46 
47 /** Class representing the data associated with a \#include statement. */
49 {
51  IncludeInfo(const FileDef *fd,const QCString &in,bool loc,bool imp)
52  : fileDef(fd), includeName(in), local(loc), imported(imp) {}
53  const FileDef *fileDef = 0;
55  bool local = false;
56  bool imported = false;
57 };
58 
59 class IncludeInfoList : public std::vector<IncludeInfo>
60 {
61 };
62 
63 bool compareFileDefs(const FileDef *fd1, const FileDef *fd2);
64 
65 /** A model of a file symbol.
66  *
67  * An object of this class contains all file information that is gathered.
68  * This includes the members and compounds defined in the file.
69  *
70  * The member writeDocumentation() can be used to generate the page of
71  * documentation to HTML and LaTeX.
72  */
73 class FileDef : public DefinitionMutable, public Definition
74 {
75  public:
76  ~FileDef() {}
77 
78  // ----------------------------------------------------------------------
79 
80  virtual DefType definitionType() const = 0;
81 
82  /*! Returns the unique file name (this may include part of the path). */
83  virtual QCString name() const = 0;
84  virtual QCString displayName(bool=TRUE) const = 0;
85  virtual QCString fileName() const = 0;
86 
87  virtual QCString getOutputFileBase() const = 0;
88 
89  virtual QCString anchor() const = 0;
90 
91  virtual QCString getSourceFileBase() const = 0;
92 
93  /*! Returns the name of the verbatim copy of this file (if any). */
94  virtual QCString includeName() const = 0;
95 
96  virtual QCString includeDependencyGraphFileName() const = 0;
97 
98  virtual QCString includedByDependencyGraphFileName() const = 0;
99 
100  /*! Returns the absolute path including the file name. */
101  virtual QCString absFilePath() const = 0;
102 
103  /*! Returns the name as it is used in the documentation */
104  virtual const QCString &docName() const = 0;
105 
106  /*! Returns TRUE if this file is a source file. */
107  virtual bool isSource() const = 0;
108 
109  virtual bool isDocumentationFile() const = 0;
110 
111  virtual const Definition *getSourceDefinition(int lineNr) const = 0;
112  virtual const MemberDef *getSourceMember(int lineNr) const = 0;
113 
114  /*! Returns the absolute path of this file. */
115  virtual QCString getPath() const = 0;
116 
117  /*! Returns version of this file. */
118  virtual QCString getVersion() const = 0;
119 
120  virtual bool isLinkableInProject() const = 0;
121 
122  virtual bool isLinkable() const = 0;
123  virtual bool isIncluded(const QCString &name) const = 0;
124 
125  virtual PackageDef *packageDef() const = 0;
126  virtual DirDef *getDirDef() const = 0;
128  virtual LinkedRefMap<const ClassDef> getUsedClasses() const = 0;
129  virtual const IncludeInfoList &includeFileList() const = 0;
130  virtual const IncludeInfoList &includedByFileList() const = 0;
131  virtual void getAllIncludeFilesRecursively(StringVector &incFiles) const = 0;
132 
133  virtual MemberList *getMemberList(MemberListType lt) const = 0;
134  virtual const MemberLists &getMemberLists() const = 0;
135 
136  /* user defined member groups */
137  virtual const MemberGroupList &getMemberGroups() const = 0;
138  virtual const NamespaceLinkedRefMap &getNamespaces() const = 0;
139  virtual const ConceptLinkedRefMap &getConcepts() const = 0;
140  virtual const ClassLinkedRefMap &getClasses() const = 0;
141 
142  virtual QCString title() const = 0;
143  virtual bool hasDetailedDescription() const = 0;
144  virtual QCString fileVersion() const = 0;
145 
146  virtual bool subGrouping() const = 0;
147 
148  virtual void countMembers() = 0;
149  virtual int numDocMembers() const = 0;
150  virtual int numDecMembers() const = 0;
151 
152  //---------------------------------
153 
154  virtual void addSourceRef(int line,const Definition *d,const MemberDef *md) = 0;
155 
156  virtual void writeDocumentation(OutputList &ol) = 0;
157  virtual void writeMemberPages(OutputList &ol) = 0;
158  virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0;
159  virtual void writeSummaryLinks(OutputList &ol) const = 0;
160  virtual void writeTagFile(TextStream &t) = 0;
161 
162  virtual void writeSourceHeader(OutputList &ol) = 0;
163  virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) = 0;
164  virtual void writeSourceFooter(OutputList &ol) = 0;
165  virtual void parseSource(ClangTUParser *clangParser) = 0;
166  virtual void setDiskName(const QCString &name) = 0;
167 
168  virtual void insertMember(MemberDef *md) = 0;
169  virtual void insertClass(const ClassDef *cd) = 0;
170  virtual void insertConcept(const ConceptDef *cd) = 0;
171  virtual void insertNamespace(const NamespaceDef *nd) = 0;
172  virtual void computeAnchors() = 0;
173 
174  virtual void setPackageDef(PackageDef *pd) = 0;
175  virtual void setDirDef(DirDef *dd) = 0;
176 
177  virtual void addUsingDirective(const NamespaceDef *nd) = 0;
178  virtual void addUsingDeclaration(const ClassDef *cd) = 0;
179  virtual void combineUsingRelations() = 0;
180 
181  virtual bool generateSourceFile() const = 0;
182  virtual void sortMemberLists() = 0;
183 
184  virtual void addIncludeDependency(const FileDef *fd,const QCString &incName,bool local,bool imported) = 0;
185  virtual void addIncludedByDependency(const FileDef *fd,const QCString &incName,bool local,bool imported) = 0;
186 
187  virtual void addMembersToMemberGroup() = 0;
188  virtual void distributeMemberGroupDocumentation() = 0;
189  virtual void findSectionsInDocumentation() = 0;
190  virtual void addIncludedUsingDirectives(FileDefSet &visitedFiles) = 0;
191 
192  virtual void addListReferences() = 0;
193 };
194 
195 FileDef *createFileDef(const QCString &p,const QCString &n,const QCString &ref=QCString(),const QCString &dn=QCString());
196 
197 
198 // --- Cast functions
199 
201 const FileDef *toFileDef(const Definition *d);
202 
203 // ------------------
204 
205 class FileList : public std::vector<const FileDef *>
206 {
207 };
208 
210 {
211  FilesInDir(const QCString &p) : path(p) {}
213  std::vector<const FileDef *> files;
214 };
215 
216 #endif
217 
StringVector
std::vector< std::string > StringVector
Definition: containers.h:32
FileDef::title
virtual QCString title() const =0
FileDefSet
std::set< const FileDef * > FileDefSet
Definition: filedef.h:45
FileDef::getAllIncludeFilesRecursively
virtual void getAllIncludeFilesRecursively(StringVector &incFiles) const =0
FileDef::getMemberLists
virtual const MemberLists & getMemberLists() const =0
FileDef::setDiskName
virtual void setDiskName(const QCString &name)=0
FileDef::insertNamespace
virtual void insertNamespace(const NamespaceDef *nd)=0
FileDef::packageDef
virtual PackageDef * packageDef() const =0
LinkedRefMap< const NamespaceDef >
FileDef::getSourceFileBase
virtual QCString getSourceFileBase() const =0
ConceptDef
Definition: conceptdef.h:22
IncludeInfo::fileDef
const FileDef * fileDef
Definition: filedef.h:53
FileDef::anchor
virtual QCString anchor() const =0
FileDef::addIncludedUsingDirectives
virtual void addIncludedUsingDirectives(FileDefSet &visitedFiles)=0
FileDef::addListReferences
virtual void addListReferences()=0
FileDef::addMembersToMemberGroup
virtual void addMembersToMemberGroup()=0
FileDef::generateSourceFile
virtual bool generateSourceFile() const =0
FileDef::addUsingDirective
virtual void addUsingDirective(const NamespaceDef *nd)=0
MemberListType
MemberListType
Definition: types.h:100
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
NamespaceDef
An abstract interface of a namespace symbol.
Definition: namespacedef.h:54
FilesInDir::FilesInDir
FilesInDir(const QCString &p)
Definition: filedef.h:211
FileDef::setPackageDef
virtual void setPackageDef(PackageDef *pd)=0
DirDef
A model of a directory symbol.
Definition: dirdef.h:110
FileDef::addIncludeDependency
virtual void addIncludeDependency(const FileDef *fd, const QCString &incName, bool local, bool imported)=0
index.h
FileDef::getNamespaces
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
FileDef::countMembers
virtual void countMembers()=0
FileDef::numDocMembers
virtual int numDocMembers() const =0
FileDef::getUsedClasses
virtual LinkedRefMap< const ClassDef > getUsedClasses() const =0
FileDef::definitionType
virtual DefType definitionType() const =0
compareFileDefs
bool compareFileDefs(const FileDef *fd1, const FileDef *fd2)
Definition: filedef.cpp:1771
FileDef::insertClass
virtual void insertClass(const ClassDef *cd)=0
FileDef::getVersion
virtual QCString getVersion() const =0
FileDef::isLinkableInProject
virtual bool isLinkableInProject() const =0
FileDef::includedByFileList
virtual const IncludeInfoList & includedByFileList() const =0
FileDef::isLinkable
virtual bool isLinkable() const =0
FileDef::subGrouping
virtual bool subGrouping() const =0
MemberLists
Definition: memberlist.h:138
TextStream
Text streaming class that buffers data.
Definition: textstream.h:33
FileDef::getSourceMember
virtual const MemberDef * getSourceMember(int lineNr) const =0
FileDef::getSourceDefinition
virtual const Definition * getSourceDefinition(int lineNr) const =0
FileDef::docName
virtual const QCString & docName() const =0
NamespaceLinkedRefMap
Definition: namespacedef.h:45
FileDef::getUsedNamespaces
virtual LinkedRefMap< const NamespaceDef > getUsedNamespaces() const =0
FileDef::getClasses
virtual const ClassLinkedRefMap & getClasses() const =0
FileDef::includeName
virtual QCString includeName() const =0
OutputList
Class representing a list of output generators that are written to in parallel.
Definition: outputlist.h:37
FileDef::isSource
virtual bool isSource() const =0
MemberDef
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
ClassDef
A abstract class representing of a compound symbol.
Definition: classdef.h:103
FileDef::computeAnchors
virtual void computeAnchors()=0
FileDef::setDirDef
virtual void setDirDef(DirDef *dd)=0
FileDef::name
virtual QCString name() const =0
FileDef::includeDependencyGraphFileName
virtual QCString includeDependencyGraphFileName() const =0
IncludeInfo
Class representing the data associated with a #include statement.
Definition: filedef.h:48
FileDef::addUsingDeclaration
virtual void addUsingDeclaration(const ClassDef *cd)=0
DefinitionMutable
Definition: definition.h:308
FileList
Definition: filedef.h:205
FileDef::writeSourceHeader
virtual void writeSourceHeader(OutputList &ol)=0
FileDef::combineUsingRelations
virtual void combineUsingRelations()=0
FileDef::getMemberList
virtual MemberList * getMemberList(MemberListType lt) const =0
IncludeInfo::IncludeInfo
IncludeInfo()
Definition: filedef.h:50
FileDef::addIncludedByDependency
virtual void addIncludedByDependency(const FileDef *fd, const QCString &incName, bool local, bool imported)=0
FileDef::includedByDependencyGraphFileName
virtual QCString includedByDependencyGraphFileName() const =0
FileDef::hasDetailedDescription
virtual bool hasDetailedDescription() const =0
FileDef::sortMemberLists
virtual void sortMemberLists()=0
FileDef::addSourceRef
virtual void addSourceRef(int line, const Definition *d, const MemberDef *md)=0
FileDef::writeSourceFooter
virtual void writeSourceFooter(OutputList &ol)=0
TRUE
#define TRUE
Definition: qcstring.h:36
FileDef::fileVersion
virtual QCString fileVersion() const =0
FileDef::fileName
virtual QCString fileName() const =0
FileDef::isIncluded
virtual bool isIncluded(const QCString &name) const =0
FileDef::getPath
virtual QCString getPath() const =0
FilesInDir::files
std::vector< const FileDef * > files
Definition: filedef.h:213
Definition::DefType
DefType
Definition: definition.h:85
FileDef::insertConcept
virtual void insertConcept(const ConceptDef *cd)=0
memberlist.h
FileDef::findSectionsInDocumentation
virtual void findSectionsInDocumentation()=0
IncludeInfo::imported
bool imported
Definition: filedef.h:56
FileDef::writeQuickMemberLinks
virtual void writeQuickMemberLinks(OutputList &ol, const MemberDef *currentMd) const =0
containers.h
IncludeInfoList
Definition: filedef.h:59
FileDef::getConcepts
virtual const ConceptLinkedRefMap & getConcepts() const =0
FileDef::isDocumentationFile
virtual bool isDocumentationFile() const =0
FileDef::writeSummaryLinks
virtual void writeSummaryLinks(OutputList &ol) const =0
definition.h
FilesInDir::path
QCString path
Definition: filedef.h:212
FileDef::writeTagFile
virtual void writeTagFile(TextStream &t)=0
MemberGroupList
Definition: membergroup.h:109
FileDef::absFilePath
virtual QCString absFilePath() const =0
IncludeInfo::IncludeInfo
IncludeInfo(const FileDef *fd, const QCString &in, bool loc, bool imp)
Definition: filedef.h:51
ConceptLinkedRefMap
Definition: conceptdef.h:67
toFileDef
FileDef * toFileDef(Definition *d)
Definition: filedef.cpp:1778
FileDef::writeMemberPages
virtual void writeMemberPages(OutputList &ol)=0
ClangTUParser
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition: clangparser.h:21
createFileDef
FileDef * createFileDef(const QCString &p, const QCString &n, const QCString &ref=QCString(), const QCString &dn=QCString())
Definition: filedef.cpp:190
FileDef
A model of a file symbol.
Definition: filedef.h:73
FileDef::getMemberGroups
virtual const MemberGroupList & getMemberGroups() const =0
FileDef::numDecMembers
virtual int numDecMembers() const =0
FileDef::parseSource
virtual void parseSource(ClangTUParser *clangParser)=0
FileDef::writeDocumentation
virtual void writeDocumentation(OutputList &ol)=0
IncludeInfo::includeName
QCString includeName
Definition: filedef.h:54
FileDef::distributeMemberGroupDocumentation
virtual void distributeMemberGroupDocumentation()=0
FilesInDir
Definition: filedef.h:209
FileDef::writeSourceBody
virtual void writeSourceBody(OutputList &ol, ClangTUParser *clangParser)=0
FileDef::getDirDef
virtual DirDef * getDirDef() const =0
FileDef::getOutputFileBase
virtual QCString getOutputFileBase() const =0
FileDef::~FileDef
~FileDef()
Definition: filedef.h:76
MemberList
A list of MemberDef objects as shown in documentation sections.
Definition: memberlist.h:81
ClassLinkedRefMap
Definition: classlist.h:30
FileDef::displayName
virtual QCString displayName(bool=TRUE) const =0
FileDef::insertMember
virtual void insertMember(MemberDef *md)=0
FileDef::includeFileList
virtual const IncludeInfoList & includeFileList() const =0
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108