filedef.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: filedef.h,v 1.32 2001/03/19 19:27:40 root Exp $
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 FILEDEF_H
00019 #define FILEDEF_H
00020 
00021 #include "index.h"
00022 #include <qlist.h>
00023 #include <qintdict.h>
00024 #include <qdict.h>
00025 #include "config.h"
00026 #include "definition.h"
00027 #include "memberlist.h"
00028 #include "util.h"
00029 
00030 class FileDef;
00031 class FileList;
00032 class ClassSDict;
00033 class ClassDef;
00034 class ClassList;
00035 class MemberDef;
00036 class OutputList;
00037 class NamespaceDef;
00038 class NamespaceSDict;
00039 class MemberGroupSDict;
00040 class PackageDef;
00041 class DirDef;
00042 
00043 struct IncludeInfo
00044 {
00045   IncludeInfo() { fileDef=0; local=FALSE; }
00046   ~IncludeInfo() {}
00047   FileDef *fileDef;
00048   QCString includeName;
00049   bool local;
00050   bool imported;
00051 };
00052 
00063 class FileDef : public Definition
00064 {
00065   friend class FileName;
00066 
00067   public:
00068     //enum FileType { Source, Header, Unknown };
00069 
00070     FileDef(const char *p,const char *n,const char *ref=0,const char *dn=0);
00071    ~FileDef();
00072     DefType definitionType() const { return TypeFile; }
00073 
00075     QCString name() const 
00076     { 
00077       if (Config_getBool("FULL_PATH_NAMES")) 
00078         return filename; 
00079       else 
00080         return Definition::name(); 
00081     } 
00082 
00083     QCString fileName() const
00084     {
00085       return filename;
00086     }
00087     
00088     QCString getOutputFileBase() const 
00089     { return convertNameToFile(diskname); }
00090 
00091     QCString getFileBase() const
00092     { return diskname; }
00093 
00094     QCString getSourceFileBase() const;
00095     
00097     QCString includeName() const;
00098     
00100     QCString absFilePath() const { return filepath; }
00101     
00102     
00104     QCString docName() const { return docname; }
00105     
00106     void addSourceRef(int line,Definition *d,MemberDef *md);
00107     Definition *getSourceDefinition(int lineNr);
00108     MemberDef *getSourceMember(int lineNr);
00109 
00110     /* Sets the name of the include file to \a n. */
00111     //void setIncludeName(const char *n_) { incName=n_; }
00112     
00114     QCString getPath() const { return path; }
00115 
00117     QCString getVersion() const { return fileVersion; }
00118     
00119     bool isLinkableInProject() const
00120     {
00121       return hasDocumentation() && !isReference();
00122     }
00123 
00124     bool isLinkable() const
00125     {
00126       return isLinkableInProject() || isReference();
00127     }
00128     bool isIncluded(const QCString &name) const;
00129 
00130     bool isJava() const { return m_isJava; }
00131 
00132     void writeDetailedDocumentation(OutputList &ol);
00133     void writeDocumentation(OutputList &ol);
00134     void writeMemberDocumentation(OutputList &ol);
00135     void writeMemberPages(OutputList &ol);
00136     void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;
00137 
00138     void writeSource(OutputList &ol);
00139     void parseSource();
00140     friend void generatedFileNames();
00141     void insertMember(MemberDef *md);
00142     void insertClass(ClassDef *cd);
00143     void insertNamespace(NamespaceDef *nd);
00144     void computeAnchors();
00145 
00146     void setPackageDef(PackageDef *pd) { package=pd; }
00147     PackageDef *packageDef() const { return package; }
00148     
00149     void setDirDef(DirDef *dd) { dir=dd; }
00150     DirDef *getDirDef() const { return dir; }
00151 
00152     void addUsingDirective(NamespaceDef *nd);
00153     NamespaceSDict *getUsedNamespaces() const;
00154     void addUsingDeclaration(Definition *def);
00155     SDict<Definition> *getUsedClasses() const { return usingDeclList; }
00156     void combineUsingRelations();
00157 
00158     bool generateSourceFile() const;
00159 
00160     void addIncludeDependency(FileDef *fd,const char *incName,bool local,bool imported);
00161     void addIncludedByDependency(FileDef *fd,const char *incName,bool local,bool imported);
00162     QList<IncludeInfo> *includeFileList() const { return includeList; }
00163     QList<IncludeInfo> *includedByFileList() const { return includedByList; }
00164 
00165     void addMembersToMemberGroup();
00166     void distributeMemberGroupDocumentation();
00167     void findSectionsInDocumentation();
00168     void addIncludedUsingDirectives();
00169 
00170     void addListReferences();
00171     bool isDocumentationFile() const;
00172 
00173     MemberList *getMemberList(MemberList::ListType lt) const;
00174     const QList<MemberList> &getMemberLists() const { return m_memberLists; }
00175 
00176     /* user defined member groups */
00177     MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }
00178     NamespaceSDict *getNamespaceSDict() const     { return namespaceSDict; }
00179     ClassSDict *getClassSDict() const             { return classSDict; }
00180     
00181     bool visited;
00182 
00183   protected:
00187     void acquireFileVersion();
00188 
00189   private: 
00190     MemberList *createMemberList(MemberList::ListType lt);
00191     void addMemberToList(MemberList::ListType lt,MemberDef *md);
00192     void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title);
00193     void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title);
00194 
00195     QDict<IncludeInfo>   *includeDict;
00196     QList<IncludeInfo>   *includeList;
00197     QDict<IncludeInfo>   *includedByDict;
00198     QList<IncludeInfo>   *includedByList;
00199     NamespaceSDict       *usingDirList;
00200     SDict<Definition>    *usingDeclList;
00201     QCString              path;
00202     QCString              filepath;
00203     QCString              diskname;
00204     QCString              filename;
00205     QCString              docname;
00206     QIntDict<Definition> *srcDefDict;
00207     QIntDict<MemberDef>  *srcMemberDict;
00208     bool                  isSource;
00209     bool                  m_isJava;
00210     QCString              fileVersion;
00211     PackageDef           *package;
00212     DirDef               *dir;
00213     QList<MemberList>     m_memberLists;
00214     MemberGroupSDict     *memberGroupSDict;
00215     NamespaceSDict       *namespaceSDict;
00216     ClassSDict           *classSDict;
00217     bool                  m_subGrouping;
00218 };
00219 
00220 
00221 class FileList : public QList<FileDef>
00222 {
00223   public:
00224     FileList() : m_pathName("tmp") {}
00225     FileList(const char *path) : QList<FileDef>(), m_pathName(path) {}
00226    ~FileList() {}
00227     QCString path() const { return m_pathName; }
00228     int compareItems(GCI item1,GCI item2)
00229     {
00230       FileDef *md1 = (FileDef *)item1;
00231       FileDef *md2 = (FileDef *)item2;
00232       return stricmp(md1->name(),md2->name());
00233     }
00234   private:
00235     QCString m_pathName;
00236 };
00237 
00238 class OutputNameList : public QList<FileList>
00239 {
00240   public:
00241     OutputNameList() : QList<FileList>() {}
00242    ~OutputNameList() {}
00243     int compareItems(GCI item1,GCI item2)
00244     {
00245       FileList *fl1 = (FileList *)item1;
00246       FileList *fl2 = (FileList *)item2;
00247       return stricmp(fl1->path(),fl2->path());
00248     }
00249 };
00250 
00251 class OutputNameDict : public QDict<FileList>
00252 {
00253   public:
00254     OutputNameDict(int size) : QDict<FileList>(size) {}
00255    ~OutputNameDict() {}
00256 };
00257 
00258 class Directory;
00259 
00260 class DirEntry
00261 {
00262   public:
00263     enum EntryKind { Dir, File };
00264     DirEntry(DirEntry *parent,FileDef *fd)  
00265        : m_parent(parent), m_name(fd->name()), m_kind(File), m_fd(fd), 
00266          m_isLast(FALSE) { }
00267     DirEntry(DirEntry *parent,QCString name)              
00268        : m_parent(parent), m_name(name), m_kind(Dir), 
00269          m_fd(0), m_isLast(FALSE) { }
00270     virtual ~DirEntry() { }
00271     EntryKind kind() const { return m_kind; }
00272     FileDef *file()  const { return m_fd; }
00273     bool isLast() const    { return m_isLast; }
00274     void setLast(bool b)   { m_isLast=b; }
00275     DirEntry *parent() const { return m_parent; }
00276     QCString name() const  { return m_name; }
00277     QCString path() const  { return parent() ? parent()->path()+"/"+name() : name(); }
00278 
00279   protected:
00280     DirEntry *m_parent;
00281     QCString m_name;
00282 
00283   private:
00284     EntryKind m_kind;
00285     FileDef   *m_fd;
00286     int num;
00287     bool m_isLast;
00288 };
00289 
00290 class Directory : public DirEntry
00291 {
00292   public:
00293     Directory(Directory *parent,const QCString &name) 
00294        : DirEntry(parent,name)
00295     { m_children.setAutoDelete(TRUE); }
00296     virtual ~Directory()              {}
00297     void addChild(DirEntry *d)        { m_children.append(d); d->setLast(TRUE); }
00298     QList<DirEntry> &children()       { return m_children; }
00299     void rename(const QCString &name) { m_name=name; }
00300     void reParent(Directory *parent)  { m_parent=parent; }
00301 
00302   private:
00303     QList<DirEntry> m_children;
00304 };
00305 
00306 //void generateFileTree(QTextStream &t);
00307 void generateFileTree();
00308 
00309 #endif
00310 



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