1 |
// @(#)root/html:$Id: TDocInfo.h 23937 2008-05-20 16:44:59Z axel $
|
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 |
#ifndef ROOT_TClass
|
16 |
#include "TClass.h"
|
17 |
#endif
|
18 |
#ifndef ROOT_THashList
|
19 |
#include "THashList.h"
|
20 |
#endif
|
21 |
#ifndef ROOT_TNamed
|
22 |
#include "TNamed.h"
|
23 |
#endif
|
24 |
#include <string>
|
25 |
#include <set>
|
26 |
|
27 |
class TDictionary;
|
28 |
|
29 |
class TModuleDocInfo;
|
30 |
//____________________________________________________________________
|
31 |
//
|
32 |
// Cache doc info for all known classes
|
33 |
//
|
34 |
class TClassDocInfo: public TObject {
|
35 |
public:
|
36 |
// initialize the object
|
37 |
TClassDocInfo(TClass* cl,
|
38 |
const char* htmlfilename = "",
|
39 |
const char* fsdecl = "", const char* fsimpl = "",
|
40 |
const char* decl = 0, const char* impl = 0):
|
41 |
fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
|
42 |
fDeclFileName(decl ? decl : cl->GetDeclFileName()),
|
43 |
fImplFileName(impl ? impl : cl->GetImplFileName()),
|
44 |
fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
|
45 |
fSelected(kTRUE) { }
|
46 |
|
47 |
TClassDocInfo(TDictionary* cl,
|
48 |
const char* htmlfilename = "",
|
49 |
const char* fsdecl = "", const char* fsimpl = "",
|
50 |
const char* decl = 0, const char* impl = 0):
|
51 |
fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
|
52 |
fDeclFileName(decl),
|
53 |
fImplFileName(impl),
|
54 |
fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
|
55 |
fSelected(kTRUE) { }
|
56 |
|
57 |
virtual ~TClassDocInfo() {}
|
58 |
|
59 |
TDictionary* GetClass() const { return fClass; }
|
60 |
virtual const char* GetName() const;
|
61 |
const char* GetHtmlFileName() const { return fHtmlFileName; }
|
62 |
const char* GetDeclFileName() const { return fDeclFileName; }
|
63 |
const char* GetImplFileName() const { return fImplFileName; }
|
64 |
const char* GetDeclFileSysName() const { return fDeclFileSysName; }
|
65 |
const char* GetImplFileSysName() const { return fImplFileSysName; }
|
66 |
|
67 |
void SetModule(TModuleDocInfo* module) { fModule = module; }
|
68 |
TModuleDocInfo* GetModule() const { return fModule; }
|
69 |
|
70 |
void SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
|
71 |
Bool_t IsSelected() const { return fSelected; }
|
72 |
Bool_t HaveSource() const { return fDeclFileSysName.Length()
|
73 |
|| (fClass && !dynamic_cast<TClass*>(fClass)); }
|
74 |
|
75 |
void SetHtmlFileName(const char* name) { fHtmlFileName = name; }
|
76 |
void SetDeclFileName(const char* name) { fDeclFileName = name; }
|
77 |
void SetImplFileName(const char* name) { fImplFileName = name; }
|
78 |
void SetDeclFileSysName(const char* fsname) { fDeclFileSysName = fsname; }
|
79 |
void SetImplFileSysName(const char* fsname) { fImplFileSysName = fsname; }
|
80 |
|
81 |
ULong_t Hash() const;
|
82 |
|
83 |
TList& GetListOfTypedefs() { return fTypedefs; }
|
84 |
|
85 |
virtual Bool_t IsSortable() const { return kTRUE; }
|
86 |
virtual Int_t Compare(const TObject* obj) const;
|
87 |
|
88 |
private:
|
89 |
TClassDocInfo();
|
90 |
|
91 |
TDictionary* fClass; // class (or typedef) represented by this info object
|
92 |
TModuleDocInfo* fModule; // module this class is in
|
93 |
TString fHtmlFileName; // name of the HTML doc file
|
94 |
TString fDeclFileName; // header
|
95 |
TString fImplFileName; // source
|
96 |
TString fDeclFileSysName; // file system's location of the header
|
97 |
TString fImplFileSysName; // file system's location of the source
|
98 |
TList fTypedefs; // typedefs to this class
|
99 |
Bool_t fSelected; // selected for doc output
|
100 |
|
101 |
ClassDef(TClassDocInfo,0); // info cache for class documentation
|
102 |
};
|
103 |
|
104 |
//____________________________________________________________________
|
105 |
//
|
106 |
// Cache doc info for all known modules
|
107 |
//
|
108 |
class TModuleDocInfo: public TNamed {
|
109 |
public:
|
110 |
TModuleDocInfo(const char* name, TModuleDocInfo* super, const char* doc = ""):
|
111 |
TNamed(name, doc), fSuper(super), fSub(0), fSelected(kTRUE) {
|
112 |
if (super) super->GetSub().Add(this);
|
113 |
}
|
114 |
virtual ~TModuleDocInfo() {}
|
115 |
|
116 |
void SetDoc(const char* doc) { SetTitle(doc); }
|
117 |
const char* GetDoc() const { return GetTitle(); }
|
118 |
|
119 |
void SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
|
120 |
Bool_t IsSelected() const { return fSelected; }
|
121 |
|
122 |
void AddClass(TClassDocInfo* cl) { fClasses.Add(cl); }
|
123 |
TList* GetClasses() { return &fClasses; }
|
124 |
|
125 |
TModuleDocInfo* GetSuper() const { return fSuper; }
|
126 |
THashList& GetSub() { return fSub; }
|
127 |
|
128 |
private:
|
129 |
TModuleDocInfo* fSuper; // module containing this module
|
130 |
THashList fSub; // modules contained in this module
|
131 |
TList fClasses;
|
132 |
Bool_t fSelected; // selected for doc output
|
133 |
|
134 |
ClassDef(TModuleDocInfo,0); // documentation for a group of classes
|
135 |
};
|
136 |
|
137 |
//__________________________________________________________________________
|
138 |
//
|
139 |
// A library's documentation database:
|
140 |
// dependencies and sub-modules
|
141 |
//
|
142 |
class TLibraryDocInfo: public TNamed {
|
143 |
public:
|
144 |
TLibraryDocInfo() {}
|
145 |
TLibraryDocInfo(const char* lib): TNamed(lib, "") {}
|
146 |
|
147 |
std::set<std::string>& GetDependencies() {return fDependencies;}
|
148 |
std::set<std::string>& GetModules() {return fModules;}
|
149 |
void AddDependency(const std::string& lib) {fDependencies.insert(lib);}
|
150 |
void AddModule(const std::string& module) {fModules.insert(module);}
|
151 |
|
152 |
private:
|
153 |
std::set<std::string> fDependencies; // dependencies on other libraries
|
154 |
std::set<std::string> fModules; // modules in the library
|
155 |
|
156 |
ClassDef(TLibraryDocInfo,0); // documentation for a library
|
157 |
};
|
158 |
|
159 |
|
160 |
#endif // ROOT_TDocInfo
|