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 
36 /** A list of directories. */
37 class DirList : public QList<DirDef>
38 {
39  public:
40  int compareValues(const DirDef *item1,const DirDef *item2) const;
41 };
42 
43 /** A model of a directory symbol. */
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
73  void writeDocumentation(OutputList &ol);
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 
80  private:
81  friend void computeDirDependencies();
82 
83  void writeDetailedDescription(OutputList &ol,const QCString &title);
84  void writeBriefDescription(OutputList &ol);
85  void writeDirectoryGraph(OutputList &ol);
86  void writeSubDirList(OutputList &ol);
87  void writeFileList(OutputList &ol);
88  void startMemberDeclarations(OutputList &ol);
89  void endMemberDeclarations(OutputList &ol);
90 
91  void setLevel();
92  static DirDef *createNewDir(const char *path);
93  static bool matchPath(const QCString &path,QStrList &l);
94  void addUsesDependency(DirDef *usedDir,FileDef *srcFd,
95  FileDef *dstFd,bool inherited);
96  void computeDependencies();
97 
102  FileList *m_fileList; // list of files in the group
104  int m_level;
106  QDict<UsedDir> *m_usedDirs;
107 };
108 
109 /** Class representing a pair of FileDef objects */
110 class FilePair
111 {
112  public:
113  FilePair(FileDef *src,FileDef *dst) : m_src(src), m_dst(dst) {}
114  const FileDef *source() const { return m_src; }
115  const FileDef *destination() const { return m_dst; }
116  private:
119 };
120 
121 /** A sorted dictionary of FilePair objects. */
122 class FilePairDict : public SDict<FilePair>
123 {
124  public:
125  FilePairDict(int size) : SDict<FilePair>(size) {}
126  private:
127  int compareValues(const FilePair *item1,const FilePair *item2) const;
128 };
129 
130 /** Usage information of a directory. */
131 class UsedDir
132 {
133  public:
134  UsedDir(DirDef *dir,bool inherited);
135  virtual ~UsedDir();
136  void addFileDep(FileDef *srcFd,FileDef *dstFd);
137  FilePair *findFilePair(const char *name);
138  const FilePairDict &filePairs() const { return m_filePairs; }
139  const DirDef *dir() const { return m_dir; }
140  bool inherited() const { return m_inherited; }
141 
142  private:
146 };
147 
148 /** A usage relation between two directories. */
150 {
151  public:
153  : m_name(name), m_src(src), m_dst(dst) {}
154  DirDef *source() const { return m_src; }
155  UsedDir *destination() const { return m_dst; }
156  void writeDocumentation(OutputList &ol);
157  QCString getOutputFileBase() const { return m_name; }
158 
159  private:
163 };
164 
165 inline int DirList::compareValues(const DirDef *item1,const DirDef *item2) const
166 {
167  return qstricmp(item1->shortName(),item2->shortName());
168 }
169 
170 /** A sorted dictionary of DirDef objects. */
171 class DirSDict : public SDict<DirDef>
172 {
173  public:
174  DirSDict(int size) : SDict<DirDef>(size) {}
175  int compareValues(const DirDef *item1,const DirDef *item2) const
176  {
177  return qstricmp(item1->shortName(),item2->shortName());
178  }
179 };
180 
181 
182 void buildDirectories();
183 void generateDirDocs(OutputList &ol);
185 void writeDirDependencyGraph(const char *file);
186 
187 #endif
static QCString name
Definition: declinfo.cpp:673
int m_dirCount
Definition: dirdef.h:103
DefType definitionType() const
Definition: dirdef.h:51
bool visited
Definition: dirdef.h:77
const QCString & shortName() const
Definition: dirdef.h:57
QCString m_dispName
Definition: dirdef.h:99
int level() const
Definition: dirdef.h:63
DirList m_subdirs
Definition: dirdef.h:98
DirRelation(const QCString &name, DirDef *src, UsedDir *dst)
Definition: dirdef.h:152
QCString anchor() const
Definition: dirdef.h:53
bool isCluster() const
Definition: dirdef.h:62
int compareValues(const DirDef *item1, const DirDef *item2) const
Definition: dirdef.h:165
void computeDirDependencies()
Definition: dirdef.cpp:924
const FileDef * source() const
Definition: dirdef.h:114
FileList * m_fileList
Definition: dirdef.h:102
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
UsedDir * destination() const
Definition: dirdef.h:155
string dir
static QStrList * l
Definition: config.cpp:1044
QCString getOutputFileBase() const
Definition: dirdef.h:157
bool inherited() const
Definition: dirdef.h:140
FilePair(FileDef *src, FileDef *dst)
Definition: dirdef.h:113
QCString m_shortName
Definition: dirdef.h:100
QCString displayName(bool=TRUE) const
Definition: dirdef.h:56
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
void writeDirDependencyGraph(const char *file)
FilePairDict m_filePairs
Definition: dirdef.h:144
Definition: sortdict.h:73
int dirCount() const
Definition: dirdef.h:65
Definition: dirdef.h:37
const FilePairDict & filePairs() const
Definition: dirdef.h:138
int qstricmp(const char *str1, const char *str2)
Definition: qcstring.cpp:567
QDict< UsedDir > * m_usedDirs
Definition: dirdef.h:106
int compareValues(const DirDef *item1, const DirDef *item2) const
Definition: dirdef.h:175
DirDef * source() const
Definition: dirdef.h:154
void generateDirDocs(OutputList &ol)
Definition: dirdef.cpp:942
QCString m_name
Definition: dirdef.h:160
FileDef * m_dst
Definition: dirdef.h:118
const DirList & subDirs() const
Definition: dirdef.h:61
DirSDict(int size)
Definition: dirdef.h:174
const FileDef * destination() const
Definition: dirdef.h:115
const QDict< UsedDir > * usedDirs() const
Definition: dirdef.h:66
Definition: dirdef.h:44
static void writeTagFile()
Definition: doxygen.cpp:10604
DirDef * m_src
Definition: dirdef.h:161
void setDiskName(const QCString &name)
Definition: dirdef.h:78
FileDef * m_src
Definition: dirdef.h:117
DirDef * m_dir
Definition: dirdef.h:143
bool m_inherited
Definition: dirdef.h:145
DirDef * m_parent
Definition: dirdef.h:105
UsedDir * m_dst
Definition: dirdef.h:162
const DirDef * dir() const
Definition: dirdef.h:139
int m_level
Definition: dirdef.h:104
FileList * getFiles() const
Definition: dirdef.h:59
DirDef * parent() const
Definition: dirdef.h:64
FilePairDict(int size)
Definition: dirdef.h:125
QCString m_diskName
Definition: dirdef.h:101
const bool TRUE
Definition: qglobal.h:371
void buildDirectories()
Definition: dirdef.cpp:872
Definition: qlist.h:54