Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:38

0001 // @(#)root/html:$Id$
0002 // Author: Nenad Buncic   18/10/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TDocInfo
0013 #define ROOT_TDocInfo
0014 
0015 #include "TClass.h"
0016 #include "THashList.h"
0017 #include "TNamed.h"
0018 #include "TROOT.h"
0019 #include <string>
0020 #include <set>
0021 
0022 class TDictionary;
0023 
0024 class TModuleDocInfo;
0025 //____________________________________________________________________
0026 //
0027 // Cache doc info for all known classes
0028 //
0029 class TClassDocInfo: public TObject {
0030 public:
0031    // initialize the object
0032    TClassDocInfo(TClass* cl,
0033       const char* htmlfilename = "",
0034       const char* fsdecl = "", const char* fsimpl = "",
0035       const char* decl = 0, const char* impl = 0):
0036       fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
0037       fDeclFileName(decl ? decl : cl->GetDeclFileName()),
0038       fImplFileName(impl ? impl : cl->GetImplFileName()),
0039       fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
0040       fSelected(kTRUE) { }
0041 
0042    TClassDocInfo(TDictionary* cl,
0043       const char* htmlfilename = "",
0044       const char* fsdecl = "", const char* fsimpl = "",
0045       const char* decl = 0, const char* impl = 0):
0046       fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
0047       fDeclFileName(decl),
0048       fImplFileName(impl),
0049       fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
0050       fSelected(kTRUE) { }
0051 
0052    ~TClassDocInfo() override
0053    {
0054       // Required since we overload TObject::Hash.
0055       ROOT::CallRecursiveRemoveIfNeeded(*this);
0056    }
0057 
0058    TDictionary *GetClass() const { return fClass; }
0059            const char*     GetName() const override;
0060            const char*     GetHtmlFileName() const { return fHtmlFileName; }
0061            const char*     GetDeclFileName() const { return fDeclFileName; }
0062            const char*     GetImplFileName() const { return fImplFileName; }
0063            const char*     GetDeclFileSysName() const { return fDeclFileSysName; }
0064            const char*     GetImplFileSysName() const { return fImplFileSysName; }
0065 
0066            void            SetModule(TModuleDocInfo* module) { fModule = module; }
0067            TModuleDocInfo* GetModule() const { return fModule; }
0068 
0069            void            SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
0070            Bool_t          IsSelected() const { return fSelected; }
0071            Bool_t          HaveSource() const { return fDeclFileSysName.Length()
0072                                                    || (fClass && !dynamic_cast<TClass*>(fClass)); }
0073 
0074            void            SetHtmlFileName(const char* name) { fHtmlFileName = name; }
0075            void            SetDeclFileName(const char* name) { fDeclFileName = name; }
0076            void            SetImplFileName(const char* name) { fImplFileName = name; }
0077            void            SetDeclFileSysName(const char* fsname) { fDeclFileSysName = fsname; }
0078            void            SetImplFileSysName(const char* fsname) { fImplFileSysName = fsname; }
0079 
0080            ULong_t         Hash() const override;
0081 
0082            TList&          GetListOfTypedefs() { return fTypedefs; }
0083 
0084    Bool_t          IsSortable() const override { return kTRUE; }
0085    Int_t           Compare(const TObject* obj) const override;
0086 
0087 private:
0088    TClassDocInfo();
0089 
0090    TDictionary*            fClass; // class (or typedef) represented by this info object
0091    TModuleDocInfo*         fModule; // module this class is in
0092    TString                 fHtmlFileName; // name of the HTML doc file
0093    TString                 fDeclFileName; // header
0094    TString                 fImplFileName; // source
0095    TString                 fDeclFileSysName; // file system's location of the header
0096    TString                 fImplFileSysName; // file system's location of the source
0097    TList                   fTypedefs; // typedefs to this class
0098    Bool_t                  fSelected; // selected for doc output
0099 
0100    ClassDefOverride(TClassDocInfo,0); // info cache for class documentation
0101 };
0102 
0103 //____________________________________________________________________
0104 //
0105 // Cache doc info for all known modules
0106 //
0107 class TModuleDocInfo: public TNamed {
0108 public:
0109    TModuleDocInfo(const char* name, TModuleDocInfo* super, const char* doc = ""):
0110       TNamed(name, doc), fSuper(super), fSub(0), fSelected(kTRUE) {
0111          if (super) super->GetSub().Add(this);
0112       }
0113    ~TModuleDocInfo() override { fSub.Clear("nodelete"); fClasses.Clear("nodelete"); }
0114 
0115    void        SetDoc(const char* doc) { SetTitle(doc); }
0116    const char* GetDoc() const { return GetTitle(); }
0117 
0118    void        SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
0119    Bool_t      IsSelected() const { return fSelected; }
0120 
0121    void        AddClass(TClassDocInfo* cl) { fClasses.Add(cl); }
0122    TList*      GetClasses() { return &fClasses; }
0123 
0124    TModuleDocInfo* GetSuper() const { return fSuper; }
0125    THashList&  GetSub() { return fSub; }
0126 
0127 private:
0128    TModuleDocInfo* fSuper; // module containing this module
0129    THashList   fSub; // modules contained in this module
0130    TList       fClasses;
0131    Bool_t      fSelected; // selected for doc output
0132 
0133    ClassDefOverride(TModuleDocInfo,0); // documentation for a group of classes
0134 };
0135 
0136 //__________________________________________________________________________
0137 //
0138 // A library's documentation database:
0139 // dependencies and sub-modules
0140 //
0141 class TLibraryDocInfo: public TNamed {
0142  public:
0143    TLibraryDocInfo() {}
0144    TLibraryDocInfo(const char* lib): TNamed(lib, "") {}
0145 
0146    std::set<std::string>& GetDependencies() {return fDependencies;}
0147    std::set<std::string>& GetModules() {return fModules;}
0148    void AddDependency(const std::string& lib) {fDependencies.insert(lib);}
0149    void AddModule(const std::string& module) {fModules.insert(module);}
0150 
0151  private:
0152    std::set<std::string> fDependencies; // dependencies on other libraries
0153    std::set<std::string> fModules; // modules in the library
0154 
0155    ClassDefOverride(TLibraryDocInfo,0); // documentation for a library
0156 };
0157 
0158 
0159 #endif // ROOT_TDocInfo