Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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
32  TClassDocInfo(TClass* cl,
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 
42  TClassDocInfo(TDictionary* cl,
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.
55  ROOT::CallRecursiveRemoveIfNeeded(*this);
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; }
71  Bool_t HaveSource() const { return fDeclFileSysName.Length()
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 
82  TList& GetListOfTypedefs() { return fTypedefs; }
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
93  TString fDeclFileName; // header
94  TString fImplFileName; // source
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
130  TList fClasses;
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:
143  TLibraryDocInfo() {}
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