My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dirdef.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 DIRDEF_H
19 #define DIRDEF_H
20 
21 #include "sortdict.h"
22 #include "definition.h"
23 
24 #include <qlist.h>
25 
26 class FileList;
27 class ClassSDict;
28 class QStrList;
29 class FileDef;
30 class OutputList;
31 class UsedDir;
32 class FTextStream;
33 
34 class DirDef;
35 
37 class DirList : public QList<DirDef>
38 {
39  public:
40  int compareValues(const DirDef *item1,const DirDef *item2) const;
41 };
42 
44 class DirDef : public Definition
45 {
46  public:
47  DirDef(const char *path);
48  virtual ~DirDef();
49 
50  // accessors
51  DefType definitionType() const { return TypeDir; }
52  QCString getOutputFileBase() const;
53  QCString anchor() const { return QCString(); }
54  bool isLinkableInProject() const;
55  bool isLinkable() const;
56  QCString displayName(bool=TRUE) const { return m_dispName; }
57  const QCString &shortName() const { return m_shortName; }
58  void addSubDir(DirDef *subdir);
59  FileList * getFiles() const { return m_fileList; }
60  void addFile(FileDef *fd);
61  const DirList &subDirs() const { return m_subdirs; }
62  bool isCluster() const { return m_subdirs.count()>0; }
63  int level() const { return m_level; }
64  DirDef *parent() const { return m_parent; }
65  int dirCount() const { return m_dirCount; }
66  const QDict<UsedDir> *usedDirs() const { return m_usedDirs; }
67  bool isParentOf(DirDef *dir) const;
68  bool depGraphIsTrivial() const;
69  QCString shortTitle() const;
70  bool hasDetailedDescription() const;
71 
72  // generate output
74  void writeTagFile(FTextStream &t);
75 
76  static DirDef *mergeDirectoryInTree(const QCString &path);
77  bool visited;
78  void setDiskName(const QCString &name) { m_diskName = name; }
79  void sort();
80 
81  private:
82  friend void computeDirDependencies();
83 
84  void writeDetailedDescription(OutputList &ol,const QCString &title);
87  void writeSubDirList(OutputList &ol);
88  void writeFileList(OutputList &ol);
91 
92  void setLevel();
93  static DirDef *createNewDir(const char *path);
94  static bool matchPath(const QCString &path,QStrList &l);
95  void addUsesDependency(DirDef *usedDir,FileDef *srcFd,
96  FileDef *dstFd,bool inherited);
97  void computeDependencies();
98 
100  QCString m_dispName;
101  QCString m_shortName;
102  QCString m_diskName;
103  FileList *m_fileList; // list of files in the group
105  int m_level;
107  QDict<UsedDir> *m_usedDirs;
108 };
109 
111 class FilePair
112 {
113  public:
114  FilePair(FileDef *src,FileDef *dst) : m_src(src), m_dst(dst) {}
115  const FileDef *source() const { return m_src; }
116  const FileDef *destination() const { return m_dst; }
117  private:
120 };
121 
123 class FilePairDict : public SDict<FilePair>
124 {
125  public:
126  FilePairDict(int size) : SDict<FilePair>(size) {}
127  private:
128  int compareValues(const FilePair *item1,const FilePair *item2) const;
129 };
130 
132 class UsedDir
133 {
134  public:
135  UsedDir(DirDef *dir,bool inherited);
136  virtual ~UsedDir();
137  void addFileDep(FileDef *srcFd,FileDef *dstFd);
138  FilePair *findFilePair(const char *name);
139  const FilePairDict &filePairs() const { return m_filePairs; }
140  const DirDef *dir() const { return m_dir; }
141  bool inherited() const { return m_inherited; }
142  void sort();
143 
144  private:
148 };
149 
152 {
153  public:
154  DirRelation(const QCString &name,DirDef *src,UsedDir *dst)
155  : m_name(name), m_src(src), m_dst(dst) {}
156  DirDef *source() const { return m_src; }
157  UsedDir *destination() const { return m_dst; }
158  void writeDocumentation(OutputList &ol);
159  QCString getOutputFileBase() const { return m_name; }
160 
161  private:
162  QCString m_name;
165 };
166 
167 inline int DirList::compareValues(const DirDef *item1,const DirDef *item2) const
168 {
169  return qstricmp(item1->shortName(),item2->shortName());
170 }
171 
173 class DirSDict : public SDict<DirDef>
174 {
175  public:
176  DirSDict(int size) : SDict<DirDef>(size) {}
177  int compareValues(const DirDef *item1,const DirDef *item2) const
178  {
179  return qstricmp(item1->shortName(),item2->shortName());
180  }
181 };
182 
183 
184 void buildDirectories();
185 void generateDirDocs(OutputList &ol);
187 void writeDirDependencyGraph(const char *file);
188 
189 #endif