Root/
Source at commit 1322 created 12 years 7 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: filedef.h,v 1.32 2001/03/19 19:27:40 root Exp $␊ |
4 | *␊ |
5 | * Copyright (C) 1997-2011 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 "index.h"␊ |
22 | #include <qlist.h>␊ |
23 | #include <qintdict.h>␊ |
24 | #include <qdict.h>␊ |
25 | #include "config.h"␊ |
26 | #include "definition.h"␊ |
27 | #include "memberlist.h"␊ |
28 | #include "util.h"␊ |
29 | ␊ |
30 | class FileDef;␊ |
31 | class FileList;␊ |
32 | class ClassSDict;␊ |
33 | class ClassDef;␊ |
34 | class ClassList;␊ |
35 | class MemberDef;␊ |
36 | class OutputList;␊ |
37 | class NamespaceDef;␊ |
38 | class NamespaceSDict;␊ |
39 | class MemberGroupSDict;␊ |
40 | class PackageDef;␊ |
41 | class DirDef;␊ |
42 | ␊ |
43 | struct IncludeInfo␊ |
44 | {␊ |
45 | IncludeInfo() { fileDef=0; local=FALSE; }␊ |
46 | ~IncludeInfo() {}␊ |
47 | FileDef *fileDef;␊ |
48 | QCString includeName;␊ |
49 | bool local;␊ |
50 | bool imported;␊ |
51 | };␊ |
52 | ␊ |
53 | /*! \class FileDef filedef.h␊ |
54 | \brief A File definition.␊ |
55 | ␊ |
56 | An object of this class contains all file information that is gathered.␊ |
57 | This includes the members and compounds defined in the file.␊ |
58 | ␊ |
59 | The member writeDocumentation() can be used to generate the page of␊ |
60 | documentation to HTML and LaTeX.␊ |
61 | */␊ |
62 | ␊ |
63 | class FileDef : public Definition␊ |
64 | {␊ |
65 | friend class FileName;␊ |
66 | ␊ |
67 | public:␊ |
68 | //enum FileType { Source, Header, Unknown };␊ |
69 | ␊ |
70 | FileDef(const char *p,const char *n,const char *ref=0,const char *dn=0);␊ |
71 | ~FileDef();␊ |
72 | DefType definitionType() const { return TypeFile; }␊ |
73 | ␊ |
74 | /*! Returns the unique file name (this may include part of the path). */␊ |
75 | QCString name() const ␊ |
76 | { ␊ |
77 | if (Config_getBool("FULL_PATH_NAMES")) ␊ |
78 | return filename; ␊ |
79 | else ␊ |
80 | return Definition::name(); ␊ |
81 | } ␊ |
82 | ␊ |
83 | QCString fileName() const␊ |
84 | {␊ |
85 | return filename;␊ |
86 | }␊ |
87 | ␊ |
88 | QCString getOutputFileBase() const ␊ |
89 | { return convertNameToFile(diskname); }␊ |
90 | ␊ |
91 | QCString getFileBase() const␊ |
92 | { return diskname; }␊ |
93 | ␊ |
94 | QCString getSourceFileBase() const;␊ |
95 | ␊ |
96 | /*! Returns the name of the verbatim copy of this file (if any). */␊ |
97 | QCString includeName() const;␊ |
98 | ␊ |
99 | /*! Returns the absolute path including the file name. */␊ |
100 | QCString absFilePath() const { return filepath; }␊ |
101 | ␊ |
102 | ␊ |
103 | /*! Returns the name as it is used in the documentation */␊ |
104 | QCString docName() const { return docname; }␊ |
105 | ␊ |
106 | void addSourceRef(int line,Definition *d,MemberDef *md);␊ |
107 | Definition *getSourceDefinition(int lineNr);␊ |
108 | MemberDef *getSourceMember(int lineNr);␊ |
109 | ␊ |
110 | /* Sets the name of the include file to \a n. */␊ |
111 | //void setIncludeName(const char *n_) { incName=n_; }␊ |
112 | ␊ |
113 | /*! Returns the absolute path of this file. */ ␊ |
114 | QCString getPath() const { return path; }␊ |
115 | ␊ |
116 | /*! Returns version of this file. */␊ |
117 | QCString getVersion() const { return fileVersion; }␊ |
118 | ␊ |
119 | bool isLinkableInProject() const;␊ |
120 | ␊ |
121 | bool isLinkable() const␊ |
122 | {␊ |
123 | return isLinkableInProject() || isReference();␊ |
124 | }␊ |
125 | bool isIncluded(const QCString &name) const;␊ |
126 | ␊ |
127 | bool isJava() const { return m_isJava; }␊ |
128 | bool isCSharp() const { return m_isCSharp; }␊ |
129 | ␊ |
130 | void writeDocumentation(OutputList &ol);␊ |
131 | void writeMemberPages(OutputList &ol);␊ |
132 | void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;␊ |
133 | void writeSummaryLinks(OutputList &ol);␊ |
134 | ␊ |
135 | void writeSource(OutputList &ol);␊ |
136 | void parseSource();␊ |
137 | friend void generatedFileNames();␊ |
138 | void insertMember(MemberDef *md);␊ |
139 | void insertClass(ClassDef *cd);␊ |
140 | void insertNamespace(NamespaceDef *nd);␊ |
141 | void computeAnchors();␊ |
142 | ␊ |
143 | void setPackageDef(PackageDef *pd) { package=pd; }␊ |
144 | PackageDef *packageDef() const { return package; }␊ |
145 | ␊ |
146 | void setDirDef(DirDef *dd) { dir=dd; }␊ |
147 | DirDef *getDirDef() const { return dir; }␊ |
148 | ␊ |
149 | void addUsingDirective(NamespaceDef *nd);␊ |
150 | NamespaceSDict *getUsedNamespaces() const;␊ |
151 | void addUsingDeclaration(Definition *def);␊ |
152 | SDict<Definition> *getUsedClasses() const { return usingDeclList; }␊ |
153 | void combineUsingRelations();␊ |
154 | ␊ |
155 | bool generateSourceFile() const;␊ |
156 | void sortMemberLists();␊ |
157 | ␊ |
158 | void addIncludeDependency(FileDef *fd,const char *incName,bool local,bool imported);␊ |
159 | void addIncludedByDependency(FileDef *fd,const char *incName,bool local,bool imported);␊ |
160 | QList<IncludeInfo> *includeFileList() const { return includeList; }␊ |
161 | QList<IncludeInfo> *includedByFileList() const { return includedByList; }␊ |
162 | ␊ |
163 | void addMembersToMemberGroup();␊ |
164 | void distributeMemberGroupDocumentation();␊ |
165 | void findSectionsInDocumentation();␊ |
166 | void addIncludedUsingDirectives();␊ |
167 | ␊ |
168 | void addListReferences();␊ |
169 | bool isDocumentationFile() const;␊ |
170 | bool includes(FileDef *incFile,QDict<FileDef> *includedFiles) const;␊ |
171 | ␊ |
172 | MemberList *getMemberList(MemberList::ListType lt) const;␊ |
173 | const QList<MemberList> &getMemberLists() const { return m_memberLists; }␊ |
174 | ␊ |
175 | /* user defined member groups */␊ |
176 | MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }␊ |
177 | NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }␊ |
178 | ClassSDict *getClassSDict() const { return classSDict; }␊ |
179 | ␊ |
180 | bool visited;␊ |
181 | ␊ |
182 | protected:␊ |
183 | /**␊ |
184 | * Retrieves the file version from version control system.␊ |
185 | */␊ |
186 | void acquireFileVersion();␊ |
187 | ␊ |
188 | private: ␊ |
189 | MemberList *createMemberList(MemberList::ListType lt);␊ |
190 | void addMemberToList(MemberList::ListType lt,MemberDef *md);␊ |
191 | void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title);␊ |
192 | void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title);␊ |
193 | void writeIncludeFiles(OutputList &ol);␊ |
194 | void writeIncludeGraph(OutputList &ol);␊ |
195 | void writeIncludedByGraph(OutputList &ol);␊ |
196 | void writeMemberGroups(OutputList &ol);␊ |
197 | void writeAuthorSection(OutputList &ol);␊ |
198 | void writeSourceLink(OutputList &ol);␊ |
199 | void writeNamespaceDeclarations(OutputList &ol,const QCString &title);␊ |
200 | void writeClassDeclarations(OutputList &ol,const QCString &title);␊ |
201 | void startMemberDeclarations(OutputList &ol);␊ |
202 | void endMemberDeclarations(OutputList &ol);␊ |
203 | void startMemberDocumentation(OutputList &ol);␊ |
204 | void endMemberDocumentation(OutputList &ol);␊ |
205 | void writeDetailedDescription(OutputList &ol,const QCString &title);␊ |
206 | void writeBriefDescription(OutputList &ol);␊ |
207 | ␊ |
208 | QDict<IncludeInfo> *includeDict;␊ |
209 | QList<IncludeInfo> *includeList;␊ |
210 | QDict<IncludeInfo> *includedByDict;␊ |
211 | QList<IncludeInfo> *includedByList;␊ |
212 | NamespaceSDict *usingDirList;␊ |
213 | SDict<Definition> *usingDeclList;␊ |
214 | QCString path;␊ |
215 | QCString filepath;␊ |
216 | QCString diskname;␊ |
217 | QCString filename;␊ |
218 | QCString docname;␊ |
219 | QIntDict<Definition> *srcDefDict;␊ |
220 | QIntDict<MemberDef> *srcMemberDict;␊ |
221 | bool isSource;␊ |
222 | bool m_isJava;␊ |
223 | bool m_isCSharp;␊ |
224 | QCString fileVersion;␊ |
225 | PackageDef *package;␊ |
226 | DirDef *dir;␊ |
227 | QList<MemberList> m_memberLists;␊ |
228 | MemberGroupSDict *memberGroupSDict;␊ |
229 | NamespaceSDict *namespaceSDict;␊ |
230 | ClassSDict *classSDict;␊ |
231 | bool m_subGrouping;␊ |
232 | };␊ |
233 | ␊ |
234 | ␊ |
235 | class FileList : public QList<FileDef>␊ |
236 | {␊ |
237 | public:␊ |
238 | FileList() : m_pathName("tmp") {}␊ |
239 | FileList(const char *path) : QList<FileDef>(), m_pathName(path) {}␊ |
240 | ~FileList() {}␊ |
241 | QCString path() const { return m_pathName; }␊ |
242 | int compareItems(GCI item1,GCI item2)␊ |
243 | {␊ |
244 | FileDef *md1 = (FileDef *)item1;␊ |
245 | FileDef *md2 = (FileDef *)item2;␊ |
246 | return stricmp(md1->name(),md2->name());␊ |
247 | }␊ |
248 | private:␊ |
249 | QCString m_pathName;␊ |
250 | };␊ |
251 | ␊ |
252 | class OutputNameList : public QList<FileList>␊ |
253 | {␊ |
254 | public:␊ |
255 | OutputNameList() : QList<FileList>() {}␊ |
256 | ~OutputNameList() {}␊ |
257 | int compareItems(GCI item1,GCI item2)␊ |
258 | {␊ |
259 | FileList *fl1 = (FileList *)item1;␊ |
260 | FileList *fl2 = (FileList *)item2;␊ |
261 | return stricmp(fl1->path(),fl2->path());␊ |
262 | }␊ |
263 | };␊ |
264 | ␊ |
265 | class OutputNameDict : public QDict<FileList>␊ |
266 | {␊ |
267 | public:␊ |
268 | OutputNameDict(int size) : QDict<FileList>(size) {}␊ |
269 | ~OutputNameDict() {}␊ |
270 | };␊ |
271 | ␊ |
272 | class Directory;␊ |
273 | ␊ |
274 | class DirEntry␊ |
275 | {␊ |
276 | public:␊ |
277 | enum EntryKind { Dir, File };␊ |
278 | DirEntry(DirEntry *parent,FileDef *fd) ␊ |
279 | : m_parent(parent), m_name(fd->name()), m_kind(File), m_fd(fd), ␊ |
280 | m_isLast(FALSE) { }␊ |
281 | DirEntry(DirEntry *parent,QCString name) ␊ |
282 | : m_parent(parent), m_name(name), m_kind(Dir), ␊ |
283 | m_fd(0), m_isLast(FALSE) { }␊ |
284 | virtual ~DirEntry() { }␊ |
285 | EntryKind kind() const { return m_kind; }␊ |
286 | FileDef *file() const { return m_fd; }␊ |
287 | bool isLast() const { return m_isLast; }␊ |
288 | void setLast(bool b) { m_isLast=b; }␊ |
289 | DirEntry *parent() const { return m_parent; }␊ |
290 | QCString name() const { return m_name; }␊ |
291 | QCString path() const { return parent() ? parent()->path()+"/"+name() : name(); }␊ |
292 | ␊ |
293 | protected:␊ |
294 | DirEntry *m_parent;␊ |
295 | QCString m_name;␊ |
296 | ␊ |
297 | private:␊ |
298 | EntryKind m_kind;␊ |
299 | FileDef *m_fd;␊ |
300 | int num;␊ |
301 | bool m_isLast;␊ |
302 | };␊ |
303 | ␊ |
304 | class Directory : public DirEntry␊ |
305 | {␊ |
306 | public:␊ |
307 | Directory(Directory *parent,const QCString &name) ␊ |
308 | : DirEntry(parent,name)␊ |
309 | { m_children.setAutoDelete(TRUE); }␊ |
310 | virtual ~Directory() {}␊ |
311 | void addChild(DirEntry *d) { m_children.append(d); d->setLast(TRUE); }␊ |
312 | QList<DirEntry> &children() { return m_children; }␊ |
313 | void rename(const QCString &name) { m_name=name; }␊ |
314 | void reParent(Directory *parent) { m_parent=parent; }␊ |
315 | ␊ |
316 | private:␊ |
317 | QList<DirEntry> m_children;␊ |
318 | };␊ |
319 | ␊ |
320 | //void generateFileTree(QTextStream &t);␊ |
321 | void generateFileTree();␊ |
322 | ␊ |
323 | #endif␊ |
324 | ␊ |
325 |