My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "index.h"
22 #include <qlist.h>
23 #include <qintdict.h>
24 #include <qdict.h>
25 #include "definition.h"
26 #include "sortdict.h"
27 #include "memberlist.h"
28 
29 class MemberList;
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 class FTextStream;
43 
46 {
47  IncludeInfo() : fileDef(0), local(FALSE), imported(FALSE), indirect(FALSE) {}
50  QCString includeName;
51  bool local;
52  bool imported;
53  bool indirect;
54 };
55 
64 class FileDef : public Definition
65 {
66  public:
67  //enum FileType { Source, Header, Unknown };
68 
69  FileDef(const char *p,const char *n,const char *ref=0,const char *dn=0);
70  ~FileDef();
71 
72  // ----------------------------------------------------------------------
73 
74  DefType definitionType() const { return TypeFile; }
75 
77  QCString name() const;
78  QCString displayName(bool=TRUE) const { return name(); }
79  QCString fileName() const { return m_fileName; }
80 
81  QCString getOutputFileBase() const;
82 
83  QCString anchor() const { return QCString(); }
84 
85  QCString getSourceFileBase() const;
86 
88  QCString includeName() const;
89 
90  QCString includeDependencyGraphFileName() const;
91 
92  QCString includedByDependencyGraphFileName() const;
93 
95  QCString absFilePath() const { return m_filePath; }
96 
98  const QCString &docName() const { return m_docname; }
99 
101  bool isSource() const { return m_isSource; }
102 
103  bool isDocumentationFile() const;
104 
105  Definition *getSourceDefinition(int lineNr) const;
106  MemberDef *getSourceMember(int lineNr) const;
107 
109  QCString getPath() const { return m_path; }
110 
112  QCString getVersion() const { return m_fileVersion; }
113 
114  bool isLinkableInProject() const;
115 
116  bool isLinkable() const { return isLinkableInProject() || isReference(); }
117  bool isIncluded(const QCString &name) const;
118 
119  PackageDef *packageDef() const { return m_package; }
120  DirDef *getDirDef() const { return m_dir; }
123  QList<IncludeInfo> *includeFileList() const { return m_includeList; }
124  QList<IncludeInfo> *includedByFileList() const { return m_includedByList; }
125  void getAllIncludeFilesRecursively(QStrList &incFiles) const;
126 
128  const QList<MemberList> &getMemberLists() const { return m_memberLists; }
129 
130  /* user defined member groups */
133  ClassSDict *getClassSDict() const { return m_classSDict; }
134 
135  QCString title() const;
136  bool hasDetailedDescription() const;
137  QCString fileVersion() const;
138 
139  bool subGrouping() const { return m_subGrouping; }
140 
141  //---------------------------------
142 
143  void addSourceRef(int line,Definition *d,MemberDef *md);
144 
145  void writeDocumentation(OutputList &ol);
146  void writeMemberPages(OutputList &ol);
147  void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;
148  void writeSummaryLinks(OutputList &ol);
149  void writeTagFile(FTextStream &t);
150 
151  void startParsing();
152  void writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu);
153  void parseSource(bool sameTu,QStrList &filesInSameTu);
154  void finishParsing();
155  void setDiskName(const QCString &name);
156 
157  void insertMember(MemberDef *md);
158  void insertClass(ClassDef *cd);
159  void insertNamespace(NamespaceDef *nd);
160  void computeAnchors();
161 
162  void setPackageDef(PackageDef *pd) { m_package=pd; }
163  void setDirDef(DirDef *dd) { m_dir=dd; }
164 
166  void addUsingDeclaration(Definition *def);
167  void combineUsingRelations();
168 
169  bool generateSourceFile() const;
170  void sortMemberLists();
171 
172  void addIncludeDependency(FileDef *fd,const char *incName,bool local,bool imported,bool indirect);
173  void addIncludedByDependency(FileDef *fd,const char *incName,bool local,bool imported);
174 
179 
180  void addListReferences();
181  //bool includes(FileDef *incFile,QDict<FileDef> *includedFiles) const;
182  //bool includesByName(const QCString &name) const;
183  bool visited;
184 
185  protected:
189  void acquireFileVersion();
190 
191  private:
194  void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title);
195  void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title);
196  void writeIncludeFiles(OutputList &ol);
197  void writeIncludeGraph(OutputList &ol);
199  void writeMemberGroups(OutputList &ol);
200  void writeAuthorSection(OutputList &ol);
201  void writeSourceLink(OutputList &ol);
202  void writeNamespaceDeclarations(OutputList &ol,const QCString &title,
203  bool isConstantGroup);
204  void writeClassDeclarations(OutputList &ol,const QCString &title);
205  void writeInlineClasses(OutputList &ol);
210  void writeDetailedDescription(OutputList &ol,const QCString &title);
212 
213  QDict<IncludeInfo> *m_includeDict;
214  QList<IncludeInfo> *m_includeList;
215  QDict<IncludeInfo> *m_includedByDict;
216  QList<IncludeInfo> *m_includedByList;
219  QCString m_path;
220  QCString m_filePath;
224  QCString m_fileName;
225  QCString m_docname;
226  QIntDict<Definition> *m_srcDefDict;
227  QIntDict<MemberDef> *m_srcMemberDict;
229  QCString m_fileVersion;
230  PackageDef *m_package;
232  QList<MemberList> m_memberLists;
237 };
238 
240 class FileList : public QList<FileDef>
241 {
242  public:
243  FileList() : m_pathName("tmp") {}
244  FileList(const char *path) : QList<FileDef>(), m_pathName(path) {}
246  QCString path() const { return m_pathName; }
247  private:
248  int compareValues(const FileDef *md1,const FileDef *md2) const
249  {
250  return qstricmp(md1->name(),md2->name());
251  }
252  QCString m_pathName;
253 };
254 
255 class OutputNameList : public QList<FileList>
256 {
257  public:
258  OutputNameList() : QList<FileList>() {}
260  private:
261  int compareValues(const FileList *fl1,const FileList *fl2) const
262  {
263  return qstricmp(fl1->path(),fl2->path());
264  }
265 };
266 
267 class OutputNameDict : public QDict<FileList>
268 {
269  public:
270  OutputNameDict(int size) : QDict<FileList>(size) {}
272 };
273 
274 class Directory;
275 
277 class DirEntry
278 {
279  public:
280  enum EntryKind { Dir, File };
282  : m_parent(parent), m_name(fd->name()), m_kind(File), m_fd(fd),
283  m_isLast(FALSE) { }
285  : m_parent(parent), m_name(name), m_kind(Dir),
286  m_fd(0), m_isLast(FALSE) { }
287  virtual ~DirEntry() { }
288  EntryKind kind() const { return m_kind; }
289  FileDef *file() const { return m_fd; }
290  bool isLast() const { return m_isLast; }
291  void setLast(bool b) { m_isLast=b; }
292  DirEntry *parent() const { return m_parent; }
293  QCString name() const { return m_name; }
294  QCString path() const { return parent() ? parent()->path()+"/"+name() : name(); }
295 
296  protected:
298  QCString m_name;
299 
300  private:
303  bool m_isLast;
304 };
305 
307 class Directory : public DirEntry
308 {
309  public:
310  Directory(Directory *parent,const QCString &name)
311  : DirEntry(parent,name)
312  { m_children.setAutoDelete(TRUE); }
313  virtual ~Directory() {}
314  void addChild(DirEntry *d) { m_children.append(d); d->setLast(TRUE); }
315  QList<DirEntry> &children() { return m_children; }
316  void rename(const QCString &name) { m_name=name; }
318 
319  private:
320  QList<DirEntry> m_children;
321 };
322 
323 void generateFileTree();
324 
325 #endif
326