TDocInfo.h

Go to the documentation of this file.
00001 // @(#)root/html:$Id: TDocInfo.h 23937 2008-05-20 16:44:59Z axel $
00002 // Author: Nenad Buncic   18/10/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TDocInfo
00013 #define ROOT_TDocInfo
00014 
00015 #ifndef ROOT_TClass
00016 #include "TClass.h"
00017 #endif
00018 #ifndef ROOT_THashList
00019 #include "THashList.h"
00020 #endif
00021 #ifndef ROOT_TNamed
00022 #include "TNamed.h"
00023 #endif
00024 #include <string>
00025 #include <set>
00026 
00027 class TDictionary;
00028 
00029 class TModuleDocInfo;
00030 //____________________________________________________________________
00031 //
00032 // Cache doc info for all known classes
00033 //
00034 class TClassDocInfo: public TObject {
00035 public:
00036    // initialize the object
00037    TClassDocInfo(TClass* cl,
00038       const char* htmlfilename = "",
00039       const char* fsdecl = "", const char* fsimpl = "",
00040       const char* decl = 0, const char* impl = 0): 
00041       fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
00042       fDeclFileName(decl ? decl : cl->GetDeclFileName()),
00043       fImplFileName(impl ? impl : cl->GetImplFileName()),
00044       fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
00045       fSelected(kTRUE) { }
00046 
00047    TClassDocInfo(TDictionary* cl,
00048       const char* htmlfilename = "",
00049       const char* fsdecl = "", const char* fsimpl = "",
00050       const char* decl = 0, const char* impl = 0): 
00051       fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
00052       fDeclFileName(decl),
00053       fImplFileName(impl),
00054       fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
00055       fSelected(kTRUE) { }
00056 
00057    virtual ~TClassDocInfo() {}
00058 
00059            TDictionary*    GetClass() const { return fClass; }
00060    virtual const char*     GetName() const;
00061            const char*     GetHtmlFileName() const { return fHtmlFileName; }
00062            const char*     GetDeclFileName() const { return fDeclFileName; }
00063            const char*     GetImplFileName() const { return fImplFileName; }
00064            const char*     GetDeclFileSysName() const { return fDeclFileSysName; }
00065            const char*     GetImplFileSysName() const { return fImplFileSysName; }
00066 
00067            void            SetModule(TModuleDocInfo* module) { fModule = module; }
00068            TModuleDocInfo* GetModule() const { return fModule; }
00069 
00070            void            SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
00071            Bool_t          IsSelected() const { return fSelected; }
00072            Bool_t          HaveSource() const { return fDeclFileSysName.Length()
00073                                                    || (fClass && !dynamic_cast<TClass*>(fClass)); }
00074    
00075            void            SetHtmlFileName(const char* name) { fHtmlFileName = name; }
00076            void            SetDeclFileName(const char* name) { fDeclFileName = name; }
00077            void            SetImplFileName(const char* name) { fImplFileName = name; }
00078            void            SetDeclFileSysName(const char* fsname) { fDeclFileSysName = fsname; }
00079            void            SetImplFileSysName(const char* fsname) { fImplFileSysName = fsname; }
00080 
00081            ULong_t         Hash() const;
00082 
00083            TList&          GetListOfTypedefs() { return fTypedefs; }
00084 
00085    virtual Bool_t          IsSortable() const { return kTRUE; }
00086    virtual Int_t           Compare(const TObject* obj) const;
00087 
00088 private:
00089    TClassDocInfo();
00090 
00091    TDictionary*            fClass; // class (or typedef) represented by this info object
00092    TModuleDocInfo*         fModule; // module this class is in
00093    TString                 fHtmlFileName; // name of the HTML doc file
00094    TString                 fDeclFileName; // header
00095    TString                 fImplFileName; // source
00096    TString                 fDeclFileSysName; // file system's location of the header
00097    TString                 fImplFileSysName; // file system's location of the source
00098    TList                   fTypedefs; // typedefs to this class
00099    Bool_t                  fSelected; // selected for doc output
00100 
00101    ClassDef(TClassDocInfo,0); // info cache for class documentation
00102 };
00103 
00104 //____________________________________________________________________
00105 //
00106 // Cache doc info for all known modules
00107 //
00108 class TModuleDocInfo: public TNamed {
00109 public:
00110    TModuleDocInfo(const char* name, TModuleDocInfo* super, const char* doc = ""): 
00111       TNamed(name, doc), fSuper(super), fSub(0), fSelected(kTRUE) {
00112          if (super) super->GetSub().Add(this);
00113       }
00114    virtual ~TModuleDocInfo() {}
00115 
00116    void        SetDoc(const char* doc) { SetTitle(doc); }
00117    const char* GetDoc() const { return GetTitle(); }
00118 
00119    void        SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
00120    Bool_t      IsSelected() const { return fSelected; }
00121 
00122    void        AddClass(TClassDocInfo* cl) { fClasses.Add(cl); }
00123    TList*      GetClasses() { return &fClasses; }
00124 
00125    TModuleDocInfo* GetSuper() const { return fSuper; }
00126    THashList&  GetSub() { return fSub; }
00127 
00128 private:
00129    TModuleDocInfo* fSuper; // module containing this module
00130    THashList   fSub; // modules contained in this module
00131    TList       fClasses;
00132    Bool_t      fSelected; // selected for doc output
00133 
00134    ClassDef(TModuleDocInfo,0); // documentation for a group of classes
00135 };
00136 
00137 //__________________________________________________________________________
00138 //
00139 // A library's documentation database:
00140 // dependencies and sub-modules
00141 //
00142 class TLibraryDocInfo: public TNamed {
00143  public:
00144    TLibraryDocInfo() {}
00145    TLibraryDocInfo(const char* lib): TNamed(lib, "") {}
00146 
00147    std::set<std::string>& GetDependencies() {return fDependencies;}
00148    std::set<std::string>& GetModules() {return fModules;}
00149    void AddDependency(const std::string& lib) {fDependencies.insert(lib);}
00150    void AddModule(const std::string& module) {fModules.insert(module);}
00151 
00152  private:
00153    std::set<std::string> fDependencies; // dependencies on other libraries
00154    std::set<std::string> fModules; // modules in the library
00155 
00156    ClassDef(TLibraryDocInfo,0); // documentation for a library
00157 };
00158 
00159 
00160 #endif // ROOT_TDocInfo

Generated on Tue Jul 5 14:24:42 2011 for ROOT_528-00b_version by  doxygen 1.5.1