Logo ROOT   6.12/07
Reference Guide
TDocInfo.h
Go to the documentation of this file.
1 // @(#)root/html:$Id$
2 // Author: Nenad Buncic 18/10/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TDocInfo
13 #define ROOT_TDocInfo
14 
15 #include "TClass.h"
16 #include "THashList.h"
17 #include "TNamed.h"
18 #include "TROOT.h"
19 #include <string>
20 #include <set>
21 
22 class TDictionary;
23 
24 class TModuleDocInfo;
25 //____________________________________________________________________
26 //
27 // Cache doc info for all known classes
28 //
29 class TClassDocInfo: public TObject {
30 public:
31  // initialize the object
33  const char* htmlfilename = "",
34  const char* fsdecl = "", const char* fsimpl = "",
35  const char* decl = 0, const char* impl = 0):
36  fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
37  fDeclFileName(decl ? decl : cl->GetDeclFileName()),
38  fImplFileName(impl ? impl : cl->GetImplFileName()),
39  fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
40  fSelected(kTRUE) { }
41 
43  const char* htmlfilename = "",
44  const char* fsdecl = "", const char* fsimpl = "",
45  const char* decl = 0, const char* impl = 0):
46  fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
47  fDeclFileName(decl),
48  fImplFileName(impl),
49  fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
50  fSelected(kTRUE) { }
51 
52  virtual ~TClassDocInfo()
53  {
54  // Required since we overload TObject::Hash.
56  }
57 
58  TDictionary *GetClass() const { return fClass; }
59  virtual const char* GetName() const;
60  const char* GetHtmlFileName() const { return fHtmlFileName; }
61  const char* GetDeclFileName() const { return fDeclFileName; }
62  const char* GetImplFileName() const { return fImplFileName; }
63  const char* GetDeclFileSysName() const { return fDeclFileSysName; }
64  const char* GetImplFileSysName() const { return fImplFileSysName; }
65 
66  void SetModule(TModuleDocInfo* module) { fModule = module; }
67  TModuleDocInfo* GetModule() const { return fModule; }
68 
69  void SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
70  Bool_t IsSelected() const { return fSelected; }
72  || (fClass && !dynamic_cast<TClass*>(fClass)); }
73 
74  void SetHtmlFileName(const char* name) { fHtmlFileName = name; }
75  void SetDeclFileName(const char* name) { fDeclFileName = name; }
76  void SetImplFileName(const char* name) { fImplFileName = name; }
77  void SetDeclFileSysName(const char* fsname) { fDeclFileSysName = fsname; }
78  void SetImplFileSysName(const char* fsname) { fImplFileSysName = fsname; }
79 
80  ULong_t Hash() const;
81 
83 
84  virtual Bool_t IsSortable() const { return kTRUE; }
85  virtual Int_t Compare(const TObject* obj) const;
86 
87 private:
88  TClassDocInfo();
89 
90  TDictionary* fClass; // class (or typedef) represented by this info object
91  TModuleDocInfo* fModule; // module this class is in
92  TString fHtmlFileName; // name of the HTML doc file
95  TString fDeclFileSysName; // file system's location of the header
96  TString fImplFileSysName; // file system's location of the source
97  TList fTypedefs; // typedefs to this class
98  Bool_t fSelected; // selected for doc output
99 
100  ClassDef(TClassDocInfo,0); // info cache for class documentation
101 };
102 
103 //____________________________________________________________________
104 //
105 // Cache doc info for all known modules
106 //
107 class TModuleDocInfo: public TNamed {
108 public:
109  TModuleDocInfo(const char* name, TModuleDocInfo* super, const char* doc = ""):
110  TNamed(name, doc), fSuper(super), fSub(0), fSelected(kTRUE) {
111  if (super) super->GetSub().Add(this);
112  }
113  virtual ~TModuleDocInfo() { fSub.Clear("nodelete"); fClasses.Clear("nodelete"); }
114 
115  void SetDoc(const char* doc) { SetTitle(doc); }
116  const char* GetDoc() const { return GetTitle(); }
117 
118  void SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
119  Bool_t IsSelected() const { return fSelected; }
120 
121  void AddClass(TClassDocInfo* cl) { fClasses.Add(cl); }
122  TList* GetClasses() { return &fClasses; }
123 
124  TModuleDocInfo* GetSuper() const { return fSuper; }
125  THashList& GetSub() { return fSub; }
126 
127 private:
128  TModuleDocInfo* fSuper; // module containing this module
129  THashList fSub; // modules contained in this module
131  Bool_t fSelected; // selected for doc output
132 
133  ClassDef(TModuleDocInfo,0); // documentation for a group of classes
134 };
135 
136 //__________________________________________________________________________
137 //
138 // A library's documentation database:
139 // dependencies and sub-modules
140 //
141 class TLibraryDocInfo: public TNamed {
142  public:
144  TLibraryDocInfo(const char* lib): TNamed(lib, "") {}
145 
146  std::set<std::string>& GetDependencies() {return fDependencies;}
147  std::set<std::string>& GetModules() {return fModules;}
148  void AddDependency(const std::string& lib) {fDependencies.insert(lib);}
149  void AddModule(const std::string& module) {fModules.insert(module);}
150 
151  private:
152  std::set<std::string> fDependencies; // dependencies on other libraries
153  std::set<std::string> fModules; // modules in the library
154 
155  ClassDef(TLibraryDocInfo,0); // documentation for a library
156 };
157 
158 
159 #endif // ROOT_TDocInfo
std::set< std::string > fModules
Definition: TDocInfo.h:153
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:118
void SetDoc(const char *doc)
Definition: TDocInfo.h:115
TDictionary * fClass
Definition: TDocInfo.h:90
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
Definition: TDocInfo.cxx:38
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
Definition: TROOT.h:391
ULong_t Hash() const
Return hash value for this object.
Definition: TDocInfo.cxx:32
void AddDependency(const std::string &lib)
Definition: TDocInfo.h:148
void AddClass(TClassDocInfo *cl)
Definition: TDocInfo.h:121
virtual Bool_t IsSortable() const
Definition: TDocInfo.h:84
Bool_t IsSelected() const
Definition: TDocInfo.h:119
const char * GetImplFileSysName() const
Definition: TDocInfo.h:64
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t IsSelected() const
Definition: TDocInfo.h:70
TString fDeclFileName
Definition: TDocInfo.h:93
std::set< std::string > & GetDependencies()
Definition: TDocInfo.h:146
TLibraryDocInfo(const char *lib)
Definition: TDocInfo.h:144
TModuleDocInfo(const char *name, TModuleDocInfo *super, const char *doc="")
Definition: TDocInfo.h:109
Bool_t fSelected
Definition: TDocInfo.h:131
#define ClassDef(name, id)
Definition: Rtypes.h:320
Bool_t HaveSource() const
Definition: TDocInfo.h:71
std::set< std::string > & GetModules()
Definition: TDocInfo.h:147
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
const char * GetImplFileName() const
Definition: TDocInfo.h:62
TDictionary * GetClass() const
Definition: TDocInfo.h:58
Bool_t fSelected
Definition: TDocInfo.h:98
A doubly linked list.
Definition: TList.h:44
TClassDocInfo(TClass *cl, const char *htmlfilename="", const char *fsdecl="", const char *fsimpl="", const char *decl=0, const char *impl=0)
Definition: TDocInfo.h:32
TList & GetListOfTypedefs()
Definition: TDocInfo.h:82
virtual const char * GetName() const
Returns name of object.
Definition: TDocInfo.cxx:26
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
TModuleDocInfo * GetModule() const
Definition: TDocInfo.h:67
TString fImplFileName
Definition: TDocInfo.h:94
Ssiz_t Length() const
Definition: TString.h:386
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
THashList & GetSub()
Definition: TDocInfo.h:125
void SetImplFileName(const char *name)
Definition: TDocInfo.h:76
const char * GetHtmlFileName() const
Definition: TDocInfo.h:60
TString fDeclFileSysName
Definition: TDocInfo.h:95
TString fImplFileSysName
Definition: TDocInfo.h:96
TString fHtmlFileName
Definition: TDocInfo.h:92
unsigned long ULong_t
Definition: RtypesCore.h:51
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:69
TList * GetClasses()
Definition: TDocInfo.h:122
TModuleDocInfo * fModule
Definition: TDocInfo.h:91
TClassDocInfo(TDictionary *cl, const char *htmlfilename="", const char *fsdecl="", const char *fsimpl="", const char *decl=0, const char *impl=0)
Definition: TDocInfo.h:42
const char * GetDoc() const
Definition: TDocInfo.h:116
void AddModule(const std::string &module)
Definition: TDocInfo.h:149
void SetImplFileSysName(const char *fsname)
Definition: TDocInfo.h:78
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:401
THashList fSub
Definition: TDocInfo.h:129
void SetHtmlFileName(const char *name)
Definition: TDocInfo.h:74
virtual void Add(TObject *obj)
Definition: TList.h:87
void SetDeclFileSysName(const char *fsname)
Definition: TDocInfo.h:77
TModuleDocInfo * GetSuper() const
Definition: TDocInfo.h:124
virtual ~TModuleDocInfo()
Definition: TDocInfo.h:113
TList fTypedefs
Definition: TDocInfo.h:97
TList fClasses
Definition: TDocInfo.h:130
virtual ~TClassDocInfo()
Definition: TDocInfo.h:52
const char * GetDeclFileSysName() const
Definition: TDocInfo.h:63
const char * GetDeclFileName() const
Definition: TDocInfo.h:61
const Bool_t kTRUE
Definition: RtypesCore.h:87
std::set< std::string > fDependencies
Definition: TDocInfo.h:152
char name[80]
Definition: TGX11.cxx:109
void SetDeclFileName(const char *name)
Definition: TDocInfo.h:75
TModuleDocInfo * fSuper
Definition: TDocInfo.h:128
void SetModule(TModuleDocInfo *module)
Definition: TDocInfo.h:66