dirdef.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: $
00004  *
00005  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and its
00008  * documentation under the terms of the GNU General Public License is hereby 
00009  * granted. No representations are made about the suitability of this software 
00010  * for any purpose. It is provided "as is" without express or implied warranty.
00011  * See the GNU General Public License for more details.
00012  *
00013  * Documents produced by Doxygen are derivative works derived from the
00014  * input used in their production; they are not affected by this license.
00015  *
00016  */
00017 
00018 #ifndef DIRDEF_H
00019 #define DIRDEF_H
00020 
00021 #include "qtbc.h"
00022 #include "sortdict.h"
00023 #include "definition.h"
00024 
00025 #include <qlist.h>
00026 
00027 class FileList;
00028 class ClassSDict;
00029 class QStrList;
00030 class FileDef;
00031 class OutputList;
00032 class UsedDir;
00033 class QTextStream;
00034 
00035 class DirDef;
00036 
00038 class DirList : public QList<DirDef>
00039 {
00040   public:
00041    int compareItems(GCI item1,GCI item2);
00042 };
00043 
00045 class DirDef : public Definition
00046 {
00047   public:
00048     DirDef(const char *path);
00049     virtual ~DirDef();
00050 
00051     // accessors
00052     virtual DefType definitionType() const { return TypeDir; }
00053     virtual QCString getOutputFileBase() const;
00054     virtual bool isLinkableInProject() const;
00055     virtual bool isLinkable() const;
00056     QCString displayName() const { return m_dispName; }
00057     QCString shortName() const { return m_shortName; }
00058     void addSubDir(DirDef *subdir);
00059     FileList *   getFiles() const        { return m_fileList; }
00060     void addFile(FileDef *fd);
00061     const DirList &subDirs() const { return m_subdirs; }
00062     bool isCluster() const { return m_subdirs.count()>0; }
00063     int level() const { return m_level; }
00064     DirDef *parent() const { return m_parent; }
00065     int dirCount() const { return m_dirCount; }
00066     const QDict<UsedDir> *usedDirs() const { return m_usedDirs; }
00067     bool isParentOf(DirDef *dir) const;
00068     bool depGraphIsTrivial() const;
00069 
00070     // generate output
00071     void writeDetailedDocumentation(OutputList &ol);
00072     void writeDocumentation(OutputList &ol);
00073     void writeDepGraph(QTextStream &t);
00074 
00075     static DirDef *mergeDirectoryInTree(const QCString &path);
00076     bool visited;
00077 
00078   private:
00079     friend void computeDirDependencies();
00080     void setLevel();
00081     static DirDef *createNewDir(const char *path);
00082     static bool matchPath(const QCString &path,QStrList &l);
00083     void addUsesDependency(DirDef *usedDir,FileDef *srcFd,
00084                            FileDef *dstFd,bool inherited);
00085     void computeDependencies();
00086 
00087     DirList m_subdirs;
00088     QCString m_dispName;
00089     QCString m_shortName;
00090     FileList *m_fileList;                 // list of files in the group
00091     int m_dirCount;
00092     int m_level;
00093     DirDef *m_parent;
00094     QDict<UsedDir> *m_usedDirs;
00095 };
00096 
00097 class FilePair 
00098 {
00099   public:
00100     FilePair(FileDef *src,FileDef *dst) : m_src(src), m_dst(dst) {}
00101     const FileDef *source() const { return m_src; }
00102     const FileDef *destination() const { return m_dst; }
00103   private:
00104     FileDef *m_src;
00105     FileDef *m_dst;
00106 };
00107 
00108 class FilePairDict : public SDict<FilePair>
00109 {
00110   public:
00111     FilePairDict(int size) : SDict<FilePair>(size) {}
00112     int compareItems(GCI item1,GCI item2);
00113 };
00114 
00116 class UsedDir
00117 {
00118   public:
00119     UsedDir(DirDef *dir,bool inherited);
00120     virtual ~UsedDir();
00121     void addFileDep(FileDef *srcFd,FileDef *dstFd);
00122     FilePair *findFilePair(const char *name);
00123     const FilePairDict &filePairs() const { return m_filePairs; }
00124     const DirDef *dir() const { return m_dir; }
00125     bool inherited() const { return m_inherited; }
00126 
00127   private:
00128     DirDef *m_dir;
00129     FilePairDict m_filePairs;
00130     bool m_inherited;
00131 };
00132 
00134 class DirRelation
00135 {
00136   public:
00137     DirRelation(const QCString &name,DirDef *src,UsedDir *dst) 
00138       : m_name(name), m_src(src), m_dst(dst) {}
00139     DirDef  *source() const      { return m_src; }
00140     UsedDir *destination() const { return m_dst; }
00141     void writeDocumentation(OutputList &ol);
00142     QCString getOutputFileBase() const { return m_name; }
00143 
00144   private:
00145     QCString m_name;
00146     DirDef  *m_src;
00147     UsedDir *m_dst;
00148 };
00149 
00150 inline int DirList::compareItems(GCI item1,GCI item2)
00151 {
00152   return stricmp(((DirDef *)item1)->shortName(),((DirDef *)item2)->shortName());
00153 }
00154 
00155 class DirSDict : public SDict<DirDef>
00156 {
00157   public:
00158     DirSDict(int size) : SDict<DirDef>(size) {}
00159     int compareItems(GCI item1,GCI item2)
00160     {
00161       return stricmp(((DirDef *)item1)->shortName(),((DirDef *)item2)->shortName());
00162     }
00163 };
00164 
00165 
00166 void buildDirectories();
00167 void generateDirDocs(OutputList &ol);
00168 void computeDirDependencies();
00169 void writeDirDependencyGraph(const char *file);
00170 
00171 #endif



Generated on Mon Mar 31 10:58:34 2008 by  doxygen 1.5.1