entry.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: entry.h,v 1.36 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 ENTRY_H
00019 #define ENTRY_H
00020 
00021 #include "qtbc.h"
00022 #include <qlist.h>
00023 
00024 #include <qgstring.h>
00025 
00026 struct SectionInfo;
00027 class QFile;
00028 class EntryNav;
00029 class FileDef;
00030 class FileStorage;
00031 class StorageIntf;
00032 
00033 enum Protection { Public, Protected, Private, Package } ;
00034 enum Specifier { Normal, Virtual, Pure } ;
00035 enum MethodTypes { Method, Signal, Slot, DCOP, Property, Event };
00036 
00037 struct ListItemInfo
00038 {
00039   QCString type;
00040   int itemId;
00041 };
00042 
00045 struct BaseInfo 
00046 {
00048   BaseInfo(const char *n,Protection p,Specifier v) : 
00049     name(n),prot(p),virt(v) {}
00050   QCString   name; 
00051   Protection prot; 
00052   Specifier  virt; 
00053 };
00054 
00059 struct Argument
00060 {
00062   Argument() {}
00064   Argument(const Argument &a) 
00065   { 
00066     attrib=a.attrib.copy();
00067     type=a.type.copy(); 
00068     name=a.name.copy(); 
00069     defval=a.defval.copy(); 
00070     docs=a.docs.copy();
00071     array=a.array.copy();
00072   }
00074   Argument &operator=(const Argument &a)
00075   {
00076     if (this!=&a)
00077     {
00078       attrib=a.attrib.copy();
00079       type=a.type.copy(); 
00080       name=a.name.copy(); 
00081       defval=a.defval.copy(); 
00082       docs=a.docs.copy();
00083       array=a.array.copy();
00084     }
00085     return *this;
00086   }
00090   bool hasDocumentation() const 
00091   { 
00092     return !name.isEmpty() && !docs.isEmpty(); 
00093   }
00094   
00095   QCString attrib;   
00096   QCString type;     
00097   QCString canType;  
00098   QCString name;     
00099   QCString array;    
00100   QCString defval;   
00101   QCString docs;     
00102 };
00103 
00110 class ArgumentList : public QList<Argument> 
00111 {
00112   public:
00114     ArgumentList() : QList<Argument>(), 
00115                      constSpecifier(FALSE),
00116                      volatileSpecifier(FALSE),
00117                      pureSpecifier(FALSE)
00118                      { setAutoDelete(TRUE); }
00120    ~ArgumentList() {}
00121     bool hasDocumentation() const;
00123     bool constSpecifier;
00125     bool volatileSpecifier;
00127     bool pureSpecifier;
00128 };
00129 
00130 typedef QListIterator<Argument> ArgumentListIterator;
00131 
00135 struct TagInfo 
00136 {
00137   QCString tagName;
00138   QCString fileName;
00139   QCString anchor;
00140 };
00141 
00142 struct Grouping 
00143 {
00144   enum GroupPri_t 
00145   {
00146     GROUPING_LOWEST,
00147     GROUPING_AUTO_WEAK = 
00148       GROUPING_LOWEST,     
00149     GROUPING_AUTO_ADD,     
00150     GROUPING_AUTO_DEF,     
00151     GROUPING_AUTO_HIGHEST = GROUPING_AUTO_DEF,
00152     GROUPING_INGROUP,      
00153     GROUPING_HIGHEST = GROUPING_INGROUP
00154   };
00155 
00156   static const char *getGroupPriName( GroupPri_t priority )
00157   {
00158     switch( priority )
00159     {
00160       case GROUPING_AUTO_WEAK:
00161         return "@weakgroup";
00162       case GROUPING_AUTO_ADD:
00163         return "@addtogroup";
00164       case GROUPING_AUTO_DEF:
00165         return "@defgroup";
00166       case GROUPING_INGROUP:
00167         return "@ingroup";
00168     }       
00169     return "???";
00170   }
00171 
00172   Grouping( const char *gn, GroupPri_t p ) : groupname(gn), pri(p) {}
00173   Grouping( const Grouping &g ) : groupname(g.groupname), pri(g.pri) {}
00174   QCString groupname;   
00175   GroupPri_t pri;       
00176 
00177 };
00178 
00185 class Entry
00186 {
00187   public:
00188 
00190     enum Sections { 
00191       CLASS_SEC        = 0x00000001, 
00192       //STRUCT_SEC       = 0x00000002,
00193       //UNION_SEC        = 0x00000004, 
00194       //EXCEPTION_SEC    = 0x00000008,
00195       NAMESPACE_SEC    = 0x00000010,
00196       //INTERFACE_SEC    = 0x00000020,
00197       //PROTOCOL_SEC     = 0x00000040,
00198       //CATEGORY_SEC     = 0x00000080,
00199       COMPOUND_MASK    = CLASS_SEC //| STRUCT_SEC | UNION_SEC | 
00200                          //INTERFACE_SEC | EXCEPTION_SEC | 
00201                          //PROTOCOL_SEC | CATEGORY_SEC
00202                          ,
00203       SCOPE_MASK       = COMPOUND_MASK | NAMESPACE_SEC,
00204       
00205       CLASSDOC_SEC     = 0x00000800, 
00206       STRUCTDOC_SEC    = 0x00001000,
00207       UNIONDOC_SEC     = 0x00002000,
00208       EXCEPTIONDOC_SEC = 0x00004000,
00209       NAMESPACEDOC_SEC = 0x00008000,
00210       INTERFACEDOC_SEC = 0x00010000,
00211       PROTOCOLDOC_SEC  = 0x00020000,
00212       CATEGORYDOC_SEC  = 0x00040000,
00213       COMPOUNDDOC_MASK = CLASSDOC_SEC | STRUCTDOC_SEC | UNIONDOC_SEC | 
00214                          INTERFACEDOC_SEC | EXCEPTIONDOC_SEC | PROTOCOLDOC_SEC |
00215                          CATEGORYDOC_SEC,
00216 
00217       SOURCE_SEC       = 0x00400000,
00218       HEADER_SEC       = 0x00800000,
00219       FILE_MASK        = SOURCE_SEC | HEADER_SEC,
00220 
00221       ENUMDOC_SEC      = 0x01000000,
00222       ENUM_SEC         = 0x02000000,
00223       EMPTY_SEC        = 0x03000000, 
00224       PAGEDOC_SEC      = 0x04000000, 
00225       VARIABLE_SEC     = 0x05000000,
00226       FUNCTION_SEC     = 0x06000000,
00227       TYPEDEF_SEC      = 0x07000000,
00228       MEMBERDOC_SEC    = 0x08000000, 
00229       OVERLOADDOC_SEC  = 0x09000000,
00230       EXAMPLE_SEC      = 0x0a000000, 
00231       VARIABLEDOC_SEC  = 0x0b000000,
00232       FILEDOC_SEC      = 0x0c000000,
00233       DEFINEDOC_SEC    = 0x0d000000,
00234       INCLUDE_SEC      = 0x0e000000,
00235       DEFINE_SEC       = 0x0f000000,
00236       GROUPDOC_SEC     = 0x10000000,
00237       USINGDIR_SEC     = 0x11000000,
00238       MAINPAGEDOC_SEC  = 0x12000000,
00239       MEMBERGRP_SEC    = 0x13000000,
00240       USINGDECL_SEC    = 0x14000000,
00241       PACKAGE_SEC      = 0x15000000,
00242       PACKAGEDOC_SEC   = 0x16000000,
00243       OBJCIMPL_SEC     = 0x17000000,
00244       DIRDOC_SEC       = 0x18000000
00245     };
00246     enum MemberSpecifier
00247     {
00248       Inline    = 0x000001,
00249       Explicit  = 0x000002,
00250       Mutable   = 0x000004,
00251       Settable  = 0x000008,
00252       Gettable  = 0x000010,
00253       Readable  = 0x000020,
00254       Writable  = 0x000040,
00255       Final     = 0x000080,
00256       Abstract  = 0x000100,
00257       Addable   = 0x000200,
00258       Removable = 0x000400,
00259       Raisable  = 0x000800,
00260       Override  = 0x001000,
00261       New       = 0x002000,
00262       Sealed    = 0x004000,
00263       Initonly  = 0x008000,
00264       Optional  = 0x010000,
00265       Required  = 0x020000,
00266       NonAtomic = 0x040000,
00267       Copy      = 0x080000,
00268       Retain    = 0x100000,
00269       Assign    = 0x200000
00270     };
00271     enum ClassSpecifier
00272     {
00273       Template       = 0x0001,
00274       Generic        = 0x0002,
00275       Ref            = 0x0004,
00276       Value          = 0x0008,
00277       Interface      = 0x0010,
00278       Struct         = 0x0020,
00279       Union          = 0x0040,
00280       Exception      = 0x0080,
00281       Protocol       = 0x0100,
00282       Category       = 0x0200,
00283       SealedClass    = 0x0400,
00284       AbstractClass  = 0x0800
00285     };
00286     enum GroupDocType
00287     {
00288       GROUPDOC_NORMAL,        
00289       GROUPDOC_ADD,           
00290       GROUPDOC_WEAK           
00291     };                        
00292 
00293 
00294     Entry();
00295     Entry(const Entry &);
00296     ~Entry();
00297     int getSize();
00298     void addSpecialListItem(const char *listName,int index);
00299     void createNavigationIndex(EntryNav *rootNav,FileStorage *storage,FileDef *fd);
00300 
00301     // while parsing a file these function can be used to navigate/build the tree
00302     void setParent(Entry *parent) { m_parent = parent; }
00303     Entry *parent() const { return m_parent; }
00304     const QList<Entry> *children() const { return m_sublist; }
00305 
00307     void        addSubEntry (Entry* e) ;
00311     void reset();
00312     void marshall(StorageIntf *);
00313     void unmarshall(StorageIntf *);
00314 
00315   public:
00316 
00317     // identification
00318     int          section;     
00319     QCString     type;        
00320     QCString     name;        
00321     TagInfo     *tagInfo;     
00322 
00323     // content
00324     Protection protection;    
00325     MethodTypes mtype;        
00326     int  spec;                
00327     int  initLines;           
00328     bool stat;                
00329     bool explicitExternal;    
00330     bool proto;               
00331     bool subGrouping;         
00332     bool callGraph;           
00333     bool callerGraph;         
00334     Specifier    virt;        
00335     QCString     args;        
00336     QCString     bitfields;   
00337     ArgumentList *argList;    
00338     QList<ArgumentList> *tArgLists; 
00339     QGString     program;     
00340     QGString     initializer; 
00341     QCString     includeFile; 
00342     QCString     includeName; 
00343     QCString     doc;         
00344     int          docLine;     
00345     QCString     docFile;     
00346     QCString     brief;       
00347     int          briefLine;   
00348     QCString     briefFile;   
00349     QCString     inbodyDocs;  
00350     int          inbodyLine;  
00351     QCString     inbodyFile;  
00352     QCString     relates;     
00353     bool         relatesDup;  
00354     QCString     read;        
00355     QCString     write;       
00356     QCString     inside;      
00357     QCString     exception;   
00358     ArgumentList *typeConstr; 
00359     int          bodyLine;    
00360     int          endBodyLine; 
00361     int          mGrpId;      
00362     QList<BaseInfo> *extends; 
00363     QList<Grouping> *groups;  
00364     QList<SectionInfo> *anchors; 
00365     QCString    fileName;     
00366     int         startLine;    
00367     QList<ListItemInfo> *sli; 
00368     bool        objc;         
00369     bool        hidden;       
00370     bool        artificial;   
00371     GroupDocType groupDocType;
00372 
00373     static int  num;          
00374 
00376     const char *groupDocCmd() const
00377     {
00378       switch( groupDocType ) 
00379       {
00380         case GROUPDOC_NORMAL: return "\\defgroup";
00381         case GROUPDOC_ADD: return "\\addgroup";
00382         case GROUPDOC_WEAK: return "\\weakgroup";
00383         default: return "unknown group command";
00384       }
00385     }
00386     Grouping::GroupPri_t groupingPri() const
00387     {
00388       if( section != GROUPDOC_SEC ) 
00389       {
00390         return Grouping::GROUPING_LOWEST;
00391       }
00392       switch( groupDocType ) 
00393       {
00394         case GROUPDOC_NORMAL: return Grouping::GROUPING_AUTO_DEF;
00395         case GROUPDOC_ADD:    return Grouping::GROUPING_AUTO_ADD;
00396         case GROUPDOC_WEAK:   return Grouping::GROUPING_AUTO_WEAK;
00397         default: return Grouping::GROUPING_LOWEST;
00398       }
00399     }
00400 
00401   private:  
00402     void createSubtreeIndex(EntryNav *nav,FileStorage *storage,FileDef *fd);
00403     Entry         *m_parent;    
00404     QList<Entry>  *m_sublist;   
00405     Entry &operator=(const Entry &); 
00406 };
00407 
00408 class EntryNav
00409 {
00410   public:
00411     EntryNav(EntryNav *parent,Entry *e);
00412    ~EntryNav();
00413     void addChild(EntryNav *);
00414     bool loadEntry(FileStorage *storage);
00415     bool saveEntry(Entry *e,FileStorage *storage);
00416     void setEntry(Entry *e);
00417     void releaseEntry();
00418     void changeSection(int section) { m_section = section; }
00419     void setFileDef(FileDef *fd) { m_fileDef = fd; }
00420 
00421     Entry *entry() const { return m_info; }
00422     int section() const { return m_section; }
00423     const QCString &type() const { return m_type; }
00424     const QCString &name() const { return m_name; }
00425     TagInfo *tagInfo() const { return m_tagInfo; }
00426     const QList<EntryNav> *children() const { return m_subList; }
00427     EntryNav *parent() const { return m_parent; }
00428     FileDef *fileDef() const { return m_fileDef; }
00429 
00430   private:
00431 
00432     // navigation 
00433     EntryNav        *m_parent;    
00434     QList<EntryNav> *m_subList;   
00435 
00436     // identification
00437     int          m_section;     
00438     QCString     m_type;        
00439     QCString     m_name;        
00440     TagInfo     *m_tagInfo;      
00441     FileDef     *m_fileDef;
00442 
00443     Entry       *m_info;
00444     int64        m_offset;
00445     bool         m_noLoad;
00446 };
00447 
00448 
00449 typedef QList<Entry> EntryList;
00450 typedef QListIterator<Entry> EntryListIterator;
00451 
00452 typedef QList<EntryNav> EntryNavList;
00453 typedef QListIterator<EntryNav> EntryNavListIterator;
00454 
00455 #endif



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