forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
htmlex.C
98 lines (82 loc) · 3.13 KB
/
htmlex.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// This file demonstrates how THtml can document sources.
// BEGIN_HTML <!--
/* -->
<p>See the <a href=http://root.cern.ch/root/doc/RootDoc.html">Users Guide</a>
chapter <a href="ftp://root.cern.ch/root/doc/chapter28.pdf">Automatic HTML Documentation</a>,
and <a href="http://root.cern.ch/root/html/THtml.html">THtml's class documentation</a>.
There's also a version of this file in HTML, i.e. the output of THtmlDemo::Convert(),
at <a href="http://root.cern.ch/root/html/examples/htmlex.C.html">
http://root.cern.ch/root/html/examples/htmlex.C.html</a></p>
<p>To see this demo script in action start up ROOT and run
<pre> root [0] .x $(ROOTSYS)/tutorials/htmlex.C+</pre>
and check the output in ./htmldoc.</p>
<p>O, and of course we can put HTML code into comments, too:</p>
<img src="http://root.cern.ch/root/images/twiki-rootlogo.jpg"/>
<p>Actually, all of this documentation is already HTML!</p>
<!-- */
// --> END_HTML
#include "THtml.h"
class THtmlDemo: public TObject {
public:
THtmlDemo(): fHtml(0)
{
printf("This class is for demonstration purposes only!\n");
}
~THtmlDemo() { if (fHtml) delete fHtml; }
// inline methods can have their documentation in front
// of the declaration. DontDoMuch is so short - where
// else would one put it?
void DontDoMuch() {}
void Convert()
{
// Create a "beautified" version of this source file.
// It will be called htmldoc/htmlex.C.html.
GetHtml()->SetSourceDir("$(ROOTSYS)/tutorials");
GetHtml()->Convert("htmlex.C", "Example of THtml", "./htmldoc/", "./");
}
void ReferenceDoc()
{
// This function documents THtmlDemo.
// It will create THtmlDemo.html and src/THtmlDemo.cxx.html
// - the beautified version of the source file
GetHtml()->SetSourceDir("$(ROOTSYS)/tutorials");
GetHtml()->SetOutputDir("./htmldoc");
GetHtml()->MakeIndex("THtmlDemo"); // create ClassIndex.html and the javascript and CSS files
GetHtml()->MakeClass("THtmlDemo"); // update the class doc
}
void MakeDocForAllClasses(Bool_t evenForROOT = kFALSE)
{
// Creates the documentation pages for all classes that have
// been loaded, and that are accessible from "./".
// If evenForROOT is set, we'll try to document ROOT's classes,
// too - you will end up with a copy of ROOT's class reference.
// The documentation will end up in the subdirectory htmldoc/.
if (evenForROOT)
GetHtml()->SetSourceDir(".:$(ROOTSYS)");
else
GetHtml()->SetSourceDir(".");
GetHtml()->SetOutputDir("./htmldoc");
GetHtml()->MakeAll();
}
void RunAll() {
// Show off a bit - do everything we can.
MakeDocForAllClasses();
ReferenceDoc();
Convert();
}
protected:
THtml* GetHtml()
{
// Return out THtml object, and create it if it doesn't exist.
if (!fHtml) fHtml = new THtml();
return fHtml;
}
private:
Int_t fVeryUselessMember; // This is a very useless member.
THtml* fHtml; // our local THtml instance.
ClassDef(THtmlDemo, 0); // A demo of THtml.
};
void htmlex() {
THtmlDemo htmldemo;
htmldemo.RunAll();
}