htmlex.C

Go to the documentation of this file.
00001 
00002 // This file demonstrates how THtml can document sources.
00003 // BEGIN_HTML <!--
00004 /* -->
00005 <p>See the <a href=http://root.cern.ch/root/doc/RootDoc.html">Users Guide</a> 
00006 chapter <a href="ftp://root.cern.ch/root/doc/chapter28.pdf">Automatic HTML Documentation</a>,
00007 and <a href="http://root.cern.ch/root/html/THtml.html">THtml's class documentation</a>.
00008 There's also a version of this file in HTML, i.e. the output of THtmlDemo::Convert(), 
00009 at <a href="http://root.cern.ch/root/html/examples/htmlex.C.html">
00010 http://root.cern.ch/root/html/examples/htmlex.C.html</a></p>
00011 
00012 <p>To see this demo script in action start up ROOT and run
00013 <pre>   root [0] .x $(ROOTSYS)/tutorials/htmlex.C+</pre>
00014 and check the output in ./htmldoc.</p>
00015 
00016 <p>O, and of course we can put HTML code into comments, too:</p>
00017   <img src="http://root.cern.ch/root/images/twiki-rootlogo.jpg"/>
00018 <p>Actually, all of this documentation is already HTML!</p>
00019 <!-- */ 
00020 // --> END_HTML
00021 
00022 #include "THtml.h"
00023 
00024 class THtmlDemo: public TObject {
00025 public:
00026    THtmlDemo(): fHtml(0)
00027    { 
00028       printf("This class is for demonstration purposes only!\n"); 
00029    }
00030    ~THtmlDemo() { if (fHtml) delete fHtml; }
00031 
00032    // inline methods can have their documentation in front 
00033    // of the declaration. DontDoMuch is so short - where
00034    // else would one put it?
00035    void DontDoMuch() {}
00036 
00037    void Convert() 
00038    {
00039       // Create a "beautified" version of this source file.
00040       // It will be called htmldoc/htmlex.C.html.
00041 
00042       GetHtml()->SetSourceDir("$(ROOTSYS)/tutorials");
00043       GetHtml()->Convert("htmlex.C", "Example of THtml", "./htmldoc/", "./");
00044    }
00045 
00046    void ReferenceDoc() 
00047    {
00048       // This function documents THtmlDemo.
00049       // It will create THtmlDemo.html and src/THtmlDemo.cxx.html
00050       // - the beautified version of the source file
00051 
00052       GetHtml()->SetSourceDir("$(ROOTSYS)/tutorials");
00053       GetHtml()->SetOutputDir("./htmldoc");
00054       GetHtml()->MakeIndex("THtmlDemo"); // create ClassIndex.html and the javascript and CSS files
00055       GetHtml()->MakeClass("THtmlDemo"); // update the class doc
00056    }
00057 
00058    void MakeDocForAllClasses(Bool_t evenForROOT = kFALSE) 
00059    {
00060       // Creates the documentation pages for all classes that have
00061       // been loaded, and that are accessible from "./".
00062       // If evenForROOT is set, we'll try to document ROOT's classes, 
00063       // too - you will end up with a copy of ROOT's class reference.
00064       // The documentation will end up in the subdirectory htmldoc/.
00065 
00066       if (evenForROOT)
00067          GetHtml()->SetSourceDir(".:$(ROOTSYS)");
00068       else
00069          GetHtml()->SetSourceDir(".");
00070       GetHtml()->SetOutputDir("./htmldoc");
00071       GetHtml()->MakeAll();
00072    }
00073 
00074    void RunAll() {
00075       // Show off a bit - do everything we can.
00076       MakeDocForAllClasses();
00077       ReferenceDoc();
00078       Convert();
00079    }
00080 
00081 protected:
00082    THtml* GetHtml() 
00083    {
00084       // Return out THtml object, and create it if it doesn't exist.
00085       if (!fHtml) fHtml = new THtml();
00086       return fHtml;
00087    }
00088 
00089 private:
00090    Int_t fVeryUselessMember; // This is a very useless member.
00091    THtml* fHtml; // our local THtml instance.
00092    ClassDef(THtmlDemo, 0); // A demo of THtml. 
00093 };
00094 
00095 void htmlex() {
00096    THtmlDemo htmldemo;
00097    htmldemo.RunAll();
00098 }

Generated on Tue Jul 5 15:44:48 2011 for ROOT_528-00b_version by  doxygen 1.5.1