Logo ROOT   6.12/07
Reference Guide
TClassDocOutput.cxx
Go to the documentation of this file.
1 // @(#)root/html:$Id$
2 // Author: Axel Naumann 2007-01-09
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 #include "TClassDocOutput.h"
13 
14 #include "TBaseClass.h"
15 #include "TClassEdit.h"
16 #include "TDataMember.h"
17 #include "TMethodArg.h"
18 #include "TDataType.h"
19 #include "TDocInfo.h"
20 #include "TDocParser.h"
21 #include "TEnv.h"
22 #include "TError.h"
23 #include "THtml.h"
24 #include "TMethod.h"
25 #include "TROOT.h"
26 #include "TSystem.h"
27 #include "TVirtualPad.h"
28 #include "TVirtualMutex.h"
29 #include "Riostream.h"
30 #include <sstream>
31 
32 //______________________________________________________________________________
33 //
34 // Write the documentation for a class or namespace. The documentation is
35 // parsed by TDocParser and then passed to TClassDocOutput to generate
36 // the class doc header, the class description, members overview, and method
37 // documentation. All generic output functionality is in TDocOutput; it is
38 // re-used in this derived class.
39 //
40 // You usually do not use this class yourself; it is invoked indirectly by
41 // THtml. Customization of the output should happen via the interfaces defined
42 // by THtml.
43 //______________________________________________________________________________
44 
45 
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// Create an object given the invoking THtml object, and the TClass
50 /// object that we will generate output for.
51 
53  TDocOutput(html), fHierarchyLines(0), fCurrentClass(cl),
54  fCurrentClassesTypedefs(typedefs), fParser(0)
55 {
56  fParser = new TDocParser(*this, fCurrentClass);
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Destructor, deletes fParser
61 
63 {
64  delete fParser;
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Create HTML files for a single class.
69 ///
70 
72 {
73  gROOT->GetListOfGlobals(kTRUE);
74 
75  // create a filename
76  TString filename(fCurrentClass->GetName());
77  NameSpace2FileName(filename);
78 
80 
81  filename += ".html";
82 
83  if (!force && !IsModified(fCurrentClass, kSource)
85  Printf(fHtml->GetCounterFormat(), "-no change-", fHtml->GetCounter(), filename.Data());
86  return;
87  }
88 
89  // open class file
90  std::ofstream classFile(filename);
91 
92  if (!classFile.good()) {
93  Error("Make", "Can't open file '%s' !", filename.Data());
94  return;
95  }
96 
97  Printf(fHtml->GetCounterFormat(), "", fHtml->GetCounter(), filename.Data());
98 
99  // write a HTML header for the classFile file
101  WriteClassDocHeader(classFile);
102 
103  // copy .h file to the Html output directory
104  TString declf;
106  CopyHtmlFile(declf);
107 
108  // process a '.cxx' file
109  fParser->Parse(classFile);
110 
111  // write classFile footer
112  WriteHtmlFooter(classFile, "",
116 }
117 
118 ////////////////////////////////////////////////////////////////////////////////
119 /// Write the list of functions
120 
121 void TClassDocOutput::ListFunctions(std::ostream& classFile)
122 {
123  // loop to get a pointers to method names
124 
125  classFile << std::endl << "<div id=\"functions\">" << std::endl;
126  TString mangled(fCurrentClass->GetName());
127  NameSpace2FileName(mangled);
128  classFile << "<h2><a id=\"" << mangled
129  << ":Function_Members\"></a>Function Members (Methods)</h2>" << std::endl;
130 
131  const char* tab4nbsp="&nbsp;&nbsp;&nbsp;&nbsp;";
132  TString declFile;
135  classFile << "&nbsp;<br /><b>"
136  << tab4nbsp << "This is an abstract class, constructors will not be documented.<br />" << std::endl
137  << tab4nbsp << "Look at the <a href=\""
138  << gSystem->BaseName(declFile)
139  << "\">header</a> to check for available constructors.</b><br />" << std::endl;
140 
141  Int_t minAccess = 0;
143  minAccess = TDocParser::kPublic;
144  for (Int_t access = TDocParser::kPublic; access >= minAccess; --access) {
145 
146  const TList* methods = fParser->GetMethods((TDocParser::EAccess)access);
147  if (methods->GetEntries() == 0)
148  continue;
149 
150  classFile << "<div class=\"access\" ";
151  const char* accessID [] = {"priv", "prot", "publ"};
152  const char* accesstxt[] = {"private", "protected", "public"};
153 
154  classFile << "id=\"func" << accessID[access] << "\"><b>"
155  << accesstxt[access] << ":</b>" << std::endl
156  << "<table class=\"func\" id=\"tabfunc" << accessID[access] << "\" cellspacing=\"0\">" << std::endl;
157 
158  TIter iMethWrap(methods);
159  TDocMethodWrapper *methWrap = 0;
160  while ((methWrap = (TDocMethodWrapper*) iMethWrap())) {
161  const TMethod* method = methWrap->GetMethod();
162 
163  // it's a c'tor - Cint stores the class name as return type
164  Bool_t isctor = (!strcmp(method->GetName(), method->GetReturnTypeName()));
165  // it's a d'tor - Cint stores "void" as return type
166  Bool_t isdtor = (!isctor && method->GetName()[0] == '~');
167 
168  classFile << "<tr class=\"func";
169  if (method->GetClass() != fCurrentClass)
170  classFile << "inh";
171  classFile << "\"><td class=\"funcret\">";
172  if (kIsVirtual & method->Property()) {
173  if (!isdtor)
174  classFile << "virtual ";
175  else
176  classFile << " virtual";
177  }
178 
179  if (kIsStatic & method->Property())
180  classFile << "static ";
181 
182  if (!isctor && !isdtor)
183  fParser->DecorateKeywords(classFile, method->GetReturnTypeName());
184 
185  TString mangledM(method->GetClass()->GetName());
186  NameSpace2FileName(mangledM);
187  classFile << "</td><td class=\"funcname\"><a class=\"funcname\" href=\"";
188  if (method->GetClass() != fCurrentClass) {
189  TString htmlFile;
190  fHtml->GetHtmlFileName(method->GetClass(), htmlFile);
191  classFile << htmlFile;
192  }
193  classFile << "#" << mangledM;
194  classFile << ":";
195  mangledM = method->GetName();
196  NameSpace2FileName(mangledM);
197  Int_t overloadIdx = methWrap->GetOverloadIdx();
198  if (overloadIdx) {
199  mangledM += "@";
200  mangledM += overloadIdx;
201  }
202  classFile << mangledM << "\">";
203  if (method->GetClass() != fCurrentClass) {
204  classFile << "<span class=\"baseclass\">";
205  ReplaceSpecialChars(classFile, method->GetClass()->GetName());
206  classFile << "::</span>";
207  }
208  ReplaceSpecialChars(classFile, method->GetName());
209  classFile << "</a>";
210 
211  fParser->DecorateKeywords(classFile, const_cast<TMethod*>(method)->GetSignature());
212  bool propSignal = false;
213  bool propMenu = false;
214  bool propToggle = false;
215  bool propGetter = false;
216  if (method->GetTitle()) {
217  propSignal = (strstr(method->GetTitle(), "*SIGNAL*"));
218  propMenu = (strstr(method->GetTitle(), "*MENU*"));
219  propToggle = (strstr(method->GetTitle(), "*TOGGLE*"));
220  propGetter = (strstr(method->GetTitle(), "*GETTER"));
221  if (propSignal || propMenu || propToggle || propGetter) {
222  classFile << "<span class=\"funcprop\">";
223  if (propSignal) classFile << "<abbr title=\"emits a signal\">SIGNAL</abbr> ";
224  if (propMenu) classFile << "<abbr title=\"has a popup menu entry\">MENU</abbr> ";
225  if (propToggle) classFile << "<abbr title=\"toggles a state\">TOGGLE</abbr> ";
226  if (propGetter) {
227  TString getter(method->GetTitle());
228  Ssiz_t posGetter = getter.Index("*GETTER=");
229  getter.Remove(0, posGetter + 8);
230  classFile << "<abbr title=\"use " + getter + "() as getter\">GETTER</abbr> ";
231  }
232  classFile << "</span>";
233  }
234  }
235  classFile << "</td></tr>" << std::endl;
236  }
237  classFile << std::endl << "</table></div>" << std::endl;
238  }
239 
240  classFile << "</div>" << std::endl; // class="functions"
241 }
242 
243 ////////////////////////////////////////////////////////////////////////////////
244 /// Write the list of data members and enums
245 
246 void TClassDocOutput::ListDataMembers(std::ostream& classFile)
247 {
248  // make a loop on data members
249  Bool_t haveDataMembers = (fParser->GetDataMembers(TDocParser::kPrivate)->GetEntries() ||
255 
256  if (!haveDataMembers) return;
257 
258  classFile << std::endl << "<div id=\"datamembers\">" << std::endl;
259  TString mangled(fCurrentClass->GetName());
260  NameSpace2FileName(mangled);
261  classFile << "<h2><a name=\"" << mangled
262  << ":Data_Members\"></a>Data Members</h2>" << std::endl;
263 
264  for (Int_t access = 5; access >= 0 && !fHtml->IsNamespace(fCurrentClass); --access) {
265  const TList* datamembers = 0;
266  if (access > 2) datamembers = fParser->GetEnums((TDocParser::EAccess) (access - 3));
267  else datamembers = fParser->GetDataMembers((TDocParser::EAccess) access);
268  if (datamembers->GetEntries() == 0)
269  continue;
270 
271  classFile << "<div class=\"access\" ";
272  const char* what = "data";
273  if (access > 2) what = "enum";
274  const char* accessID [] = {"priv", "prot", "publ"};
275  const char* accesstxt[] = {"private", "protected", "public"};
276 
277  classFile << "id=\"" << what << accessID[access%3] << "\"><b>"
278  << accesstxt[access%3] << ":</b>" << std::endl
279  << "<table class=\"data\" id=\"tab" << what << accessID[access%3] << "\" cellspacing=\"0\">" << std::endl;
280 
281  TIter iDM(datamembers);
282  TDataMember *member = 0;
283  TString prevEnumName;
284  Bool_t prevIsInh = kTRUE;
285 
286  while ((member = (TDataMember*) iDM())) {
287  Bool_t haveNewEnum = access > 2 && prevEnumName != member->GetTypeName();
288  if (haveNewEnum) {
289  if (prevEnumName.Length()) {
290  classFile << "<tr class=\"data";
291  if (prevIsInh)
292  classFile << "inh";
293  classFile << "\"><td class=\"datatype\">};</td><td></td><td></td></tr>" << std::endl;
294  }
295  prevEnumName = member->GetTypeName();
296  }
297 
298  classFile << "<tr class=\"data";
299  prevIsInh = (member->GetClass() != fCurrentClass);
300  if (prevIsInh)
301  classFile << "inh";
302  classFile << "\"><td class=\"datatype\">";
303  if (haveNewEnum) {
304  TString enumName(member->GetTypeName());
305  TString myScope(fCurrentClass->GetName());
306  myScope += "::";
307  enumName.ReplaceAll(myScope, "");
308  if (enumName.EndsWith("::"))
309  enumName += "<i>[unnamed]</i>";
310  Ssiz_t startClassName = 0;
311  if (!enumName.BeginsWith("enum "))
312  classFile << "enum ";
313  else
314  startClassName = 5;
315 
316  Ssiz_t endClassName = enumName.Last(':'); // need template handling here!
317  if (endClassName != kNPOS && endClassName > 0 && enumName[endClassName - 1] == ':') {
318  // TClass* cl = fHtml->GetClass(TString(enumName(startClassName, endClassName - startClassName - 1)));
319  TSubString substr(enumName(startClassName, endClassName - startClassName + 1));
320  // if (cl)
321  // ReferenceEntity(substr, cl);
322  enumName.Insert(substr.Start() + substr.Length(), "</span>");
323  enumName.Insert(substr.Start(), "<span class=\"baseclass\">");
324  }
325  classFile << enumName << " { ";
326  } else
327  if (access < 3) {
328  if (member->Property() & kIsStatic)
329  classFile << "static ";
330  std::string shortTypeName(fHtml->ShortType(member->GetFullTypeName()));
331  fParser->DecorateKeywords(classFile, shortTypeName.c_str());
332  }
333 
334  TString mangledM(member->GetClass()->GetName());
335  NameSpace2FileName(mangledM);
336  classFile << "</td><td class=\"dataname\"><a ";
337  if (member->GetClass() != fCurrentClass) {
338  classFile << "href=\"";
339  TString htmlFile;
340  fHtml->GetHtmlFileName(member->GetClass(), htmlFile);
341  classFile << htmlFile << "#";
342  } else
343  classFile << "name=\"";
344  classFile << mangledM;
345  classFile << ":";
346  mangledM = member->GetName();
347  NameSpace2FileName(mangledM);
348  classFile << mangledM << "\">";
349  if (member->GetClass() == fCurrentClass)
350  classFile << "</a>";
351  if (access < 3 && member->GetClass() != fCurrentClass) {
352  classFile << "<span class=\"baseclass\">";
353  ReplaceSpecialChars(classFile, member->GetClass()->GetName());
354  classFile << "::</span>";
355  }
356  ReplaceSpecialChars(classFile, member->GetName());
357 
358  // Add the dimensions to "array" members
359  for (Int_t indx = 0; indx < member->GetArrayDim(); ++indx)
360  if (member->GetMaxIndex(indx) <= 0)
361  break;
362  else
363  classFile << "[" << member->GetMaxIndex(indx) << "]";
364 
365  if (member->GetClass() != fCurrentClass)
366  classFile << "</a>";
367  classFile << "</td>";
368  if (member->GetTitle() && member->GetTitle()[0]) {
369  classFile << "<td class=\"datadesc\">";
370  ReplaceSpecialChars(classFile, member->GetTitle());
371  } else classFile << "<td>";
372  classFile << "</td></tr>" << std::endl;
373  } // for members
374 
375  if (prevEnumName.Length()) {
376  classFile << "<tr class=\"data";
377  if (prevIsInh)
378  classFile << "inh";
379  classFile << "\"><td class=\"datatype\">};</td><td></td><td></td></tr>" << std::endl;
380  }
381  classFile << std::endl << "</table></div>" << std::endl;
382  } // for access
383 
384  classFile << "</div>" << std::endl; // datamembers
385 }
386 
387 ////////////////////////////////////////////////////////////////////////////////
388 /// This function builds the class charts for one class in GraphViz/Dot format,
389 /// i.e. the inheritance diagram, the include dependencies, and the library
390 /// dependency.
391 ///
392 /// Input: out - output file stream
393 
395 {
396  if (!fHtml->HaveDot())
397  return kFALSE;
398 
399  TString title(fCurrentClass->GetName());
400  NameSpace2FileName(title);
401 
402  TString dir("inh");
404  gSystem->MakeDirectory(dir);
405 
406  dir = "inhmem";
408  gSystem->MakeDirectory(dir);
409 
410  dir = "incl";
412  gSystem->MakeDirectory(dir);
413 
414  dir = "lib";
416  gSystem->MakeDirectory(dir);
417 
418  TString filenameInh(title);
419  gSystem->PrependPathName("inh", filenameInh);
420  gSystem->PrependPathName(fHtml->GetOutputDir(), filenameInh);
421  filenameInh += "_Inh";
422  if (!CreateDotClassChartInh(filenameInh + ".dot") ||
423  !RunDot(filenameInh, &out))
424  return kFALSE;
425 
426  TString filenameInhMem(title);
427  gSystem->PrependPathName("inhmem", filenameInhMem);
428  gSystem->PrependPathName(fHtml->GetOutputDir(), filenameInhMem);
429  filenameInhMem += "_InhMem";
430  if (CreateDotClassChartInhMem(filenameInhMem + ".dot"))
431  RunDot(filenameInhMem, &out);
432 
433  TString filenameIncl(title);
434  gSystem->PrependPathName("incl", filenameIncl);
435  gSystem->PrependPathName(fHtml->GetOutputDir(), filenameIncl);
436  filenameIncl += "_Incl";
437  if (CreateDotClassChartIncl(filenameIncl + ".dot"))
438  RunDot(filenameIncl, &out);
439 
440  TString filenameLib(title);
441  gSystem->PrependPathName("lib", filenameLib);
442  gSystem->PrependPathName(fHtml->GetOutputDir(), filenameLib);
443  filenameLib += "_Lib";
444  if (CreateDotClassChartLib(filenameLib + ".dot"))
445  RunDot(filenameLib, &out);
446 
447  out << "<div class=\"tabs\">" << std::endl
448  << "<a id=\"img" << title << "_Inh\" class=\"tabsel\" href=\"inh/" << title << "_Inh.png\" onclick=\"javascript:return SetImg('Charts','inh/" << title << "_Inh.png');\">Inheritance</a>" << std::endl
449  << "<a id=\"img" << title << "_InhMem\" class=\"tab\" href=\"inhmem/" << title << "_InhMem.png\" onclick=\"javascript:return SetImg('Charts','inhmem/" << title << "_InhMem.png');\">Inherited Members</a>" << std::endl
450  << "<a id=\"img" << title << "_Incl\" class=\"tab\" href=\"incl/" << title << "_Incl.png\" onclick=\"javascript:return SetImg('Charts','incl/" << title << "_Incl.png');\">Includes</a>" << std::endl
451  << "<a id=\"img" << title << "_Lib\" class=\"tab\" href=\"lib/" << title << "_Lib.png\" onclick=\"javascript:return SetImg('Charts','lib/" << title << "_Lib.png');\">Libraries</a><br/>" << std::endl
452  << "</div><div class=\"classcharts\"><div class=\"classchartswidth\"></div>" << std::endl
453  << "<img id=\"Charts\" alt=\"Class Charts\" class=\"classcharts\" usemap=\"#Map" << title << "_Inh\" src=\"inh/" << title << "_Inh.png\"/></div>" << std::endl;
454 
455  return kTRUE;
456 }
457 
458 ////////////////////////////////////////////////////////////////////////////////
459 /// This function builds the class tree for one class in HTML
460 /// (inherited and succeeding classes, called recursively)
461 ///
462 ///
463 /// Input: out - output file stream
464 /// classPtr - pointer to the class
465 /// dir - direction to traverse tree: up, down or both
466 ///
467 
468 void TClassDocOutput::ClassHtmlTree(std::ostream& out, TClass * classPtr,
469  ETraverse dir, int depth)
470 {
471  if (dir == kBoth) {
472  out << "<!--INHERITANCE TREE-->" << std::endl;
473 
474  // draw class tree into nested tables recursively
475  out << "<table><tr><td width=\"10%\"></td><td width=\"70%\">"
476  << "<a href=\"ClassHierarchy.html\">Inheritance Chart</a>:</td></tr>";
477  out << "<tr class=\"inhtree\"><td width=\"10%\"></td><td width=\"70%\">";
478 
479  out << "<table class=\"inhtree\"><tr><td>" << std::endl;
480  out << "<table width=\"100%\" border=\"0\" ";
481  out << "cellpadding =\"0\" cellspacing=\"2\"><tr>" << std::endl;
482  } else {
483  out << "<table><tr>";
484  }
485 
486  ////////////////////////////////////////////////////////
487  // Loop up to mother classes
488  if (dir == kUp || dir == kBoth) {
489 
490  // make a loop on base classes
491  TBaseClass *inheritFrom;
492  TIter nextBase(classPtr->GetListOfBases());
493 
494  UInt_t bgcolor=255-depth*8;
495  Bool_t first = kTRUE;
496  while ((inheritFrom = (TBaseClass *) nextBase())) {
497 
498  if (first) {
499  out << "<td><table><tr>" << std::endl;
500  first = kFALSE;
501  } else
502  out << "</tr><tr>" << std::endl;
503  out << "<td bgcolor=\""
504  << Form("#%02x%02x%02x", bgcolor, bgcolor, bgcolor)
505  << "\" align=\"right\">" << std::endl;
506  // get a class
507  TClass *classInh = fHtml->GetClass((const char *) inheritFrom->GetName());
508  if (classInh)
509  ClassHtmlTree(out, classInh, kUp, depth+1);
510  else
511  out << "<tt>"
512  << (const char *) inheritFrom->GetName()
513  << "</tt>";
514  out << "</td>"<< std::endl;
515  }
516  if (!first) {
517  out << "</tr></table></td>" << std::endl; // put it in additional row in table
518  out << "<td>&larr;</td>";
519  }
520  }
521 
522  out << "<td>" << std::endl; // put it in additional row in table
523  ////////////////////////////////////////////////////////
524  // Output Class Name
525 
526  const char *className = classPtr->GetName();
527  TString htmlFile;
528  fHtml->GetHtmlFileName(classPtr, htmlFile);
529  TString anchor(className);
530  NameSpace2FileName(anchor);
531 
532  if (dir == kUp) {
533  if (htmlFile) {
534  out << "<center><tt><a name=\"" << anchor;
535  out << "\" href=\"" << htmlFile << "\">";
536  ReplaceSpecialChars(out, className);
537  out << "</a></tt></center>" << std::endl;
538  } else
539  ReplaceSpecialChars(out, className);
540  }
541 
542  if (dir == kBoth) {
543  if (htmlFile.Length()) {
544  out << "<center><big><b><tt><a name=\"" << anchor;
545  out << "\" href=\"" << htmlFile << "\">";
546  ReplaceSpecialChars(out, className);
547  out << "</a></tt></b></big></center>" << std::endl;
548  } else
549  ReplaceSpecialChars(out, className);
550  }
551 
552  out << "</td>" << std::endl; // put it in additional row in table
553 
554  ////////////////////////////////////////////////////////
555  // Loop down to child classes
556 
557  if (dir == kDown || dir == kBoth) {
558 
559  // 1. make a list of class names
560  // 2. use DescendHierarchy
561 
562  out << "<td><table><tr>" << std::endl;
563  fHierarchyLines = 0;
564  DescendHierarchy(out,classPtr,10);
565 
566  out << "</tr></table>";
567  if (dir==kBoth && fHierarchyLines>=10)
568  out << "</td><td align=\"left\">&nbsp;<a href=\"ClassHierarchy.html\">[more...]</a>";
569  out<<"</td>" << std::endl;
570 
571  // free allocated memory
572  }
573 
574  out << "</tr></table>" << std::endl;
575  if (dir == kBoth)
576  out << "</td></tr></table></td></tr></table>"<<std::endl;
577 }
578 
579 
580 ////////////////////////////////////////////////////////////////////////////////
581 /// It makes a graphical class tree
582 ///
583 ///
584 /// Input: psCanvas - pointer to the current canvas
585 /// classPtr - pointer to the class
586 ///
587 
589 {
590  if (!psCanvas || !fCurrentClass)
591  return;
592 
593  TString filename(fCurrentClass->GetName());
594  NameSpace2FileName(filename);
595 
596  gSystem->PrependPathName(fHtml->GetOutputDir(), filename);
597 
598 
599  filename += "_Tree.pdf";
600 
601  if (IsModified(fCurrentClass, kTree) || force) {
602  // TCanvas already prints pdf being saved
603  // Printf(fHtml->GetCounterFormat(), "", "", filename);
604  fCurrentClass->Draw("same");
605  Int_t saveErrorIgnoreLevel = gErrorIgnoreLevel;
607  psCanvas->SaveAs(filename);
608  gErrorIgnoreLevel = saveErrorIgnoreLevel;
609  } else
610  Printf(fHtml->GetCounterFormat(), "-no change-", "", filename.Data());
611 }
612 
613 ////////////////////////////////////////////////////////////////////////////////
614 /// Build the class tree for one class in GraphViz/Dot format
615 ///
616 ///
617 /// Input: filename - output dot file incl. path
618 
620 {
621  std::ofstream outdot(filename);
622  outdot << "strict digraph G {" << std::endl
623  << "rankdir=RL;" << std::endl
624  << "ranksep=2;" << std::endl
625  << "nodesep=0;" << std::endl
626  << "size=\"8,10\";" << std::endl
627  << "ratio=auto;" << std::endl
628  << "margin=0;" << std::endl
629  << "node [shape=plaintext,fontsize=40,width=4,height=0.75];" << std::endl
630  << "\"" << fCurrentClass->GetName() << "\" [shape=ellipse];" << std::endl;
631 
632  std::stringstream ssDep;
633  std::list<TClass*> writeBasesFor;
634  writeBasesFor.push_back(fCurrentClass);
635  Bool_t haveBases = fCurrentClass->GetListOfBases() &&
637  if (haveBases) {
638  outdot << "{" << std::endl;
639  while (!writeBasesFor.empty()) {
640  TClass* cl = writeBasesFor.front();
641  writeBasesFor.pop_front();
642  if (cl != fCurrentClass) {
643  outdot << " \"" << cl->GetName() << "\"";
644  const char* htmlFileName = fHtml->GetHtmlFileName(cl->GetName());
645  if (htmlFileName)
646  outdot << " [URL=\"" << htmlFileName << "\"]";
647  outdot << ";" << std::endl;
648  }
649  if (cl->GetListOfBases() && cl->GetListOfBases()->GetSize()) {
650  ssDep << " \"" << cl->GetName() << "\" -> {";
651  TIter iBase(cl->GetListOfBases());
652  TBaseClass* base = 0;
653  while ((base = (TBaseClass*)iBase())) {
654  ssDep << " \"" << base->GetName() << "\";";
655  writeBasesFor.push_back(base->GetClassPointer());
656  }
657  ssDep << "}" << std::endl;
658  }
659  }
660  outdot << "}" << std::endl; // cluster
661  }
662 
663  std::map<TClass*, Int_t> derivesFromMe;
664  std::map<TClass*, unsigned int> entriesPerDerived;
665  std::set<TClass*> wroteNode;
666  wroteNode.insert(fCurrentClass);
667  static const unsigned int maxClassesPerDerived = 20;
668  fHtml->GetDerivedClasses(fCurrentClass, derivesFromMe);
669  outdot << "{" << std::endl;
670  for (Int_t level = 1; kTRUE; ++level) {
671  Bool_t levelExists = kFALSE;
672  for (std::map<TClass*, Int_t>::iterator iDerived = derivesFromMe.begin();
673  iDerived != derivesFromMe.end(); ++iDerived) {
674  if (iDerived->second != level) continue;
675  levelExists = kTRUE;
676  TIter iBaseOfDerived(iDerived->first->GetListOfBases());
677  TBaseClass* baseDerived = 0;
678  Bool_t writeNode = kFALSE;
679  TClass* writeAndMoreFor = 0;
680  while ((baseDerived = (TBaseClass*) iBaseOfDerived())) {
681  TClass* clBaseDerived = baseDerived->GetClassPointer();
682  if (clBaseDerived->InheritsFrom(fCurrentClass)
683  && wroteNode.find(clBaseDerived) != wroteNode.end()) {
684  unsigned int& count = entriesPerDerived[clBaseDerived];
685  if (count < maxClassesPerDerived) {
686  writeNode = kTRUE;
687  ssDep << "\"" << iDerived->first->GetName() << "\" -> \""
688  << clBaseDerived->GetName() << "\";" << std::endl;
689  ++count;
690  } else if (count == maxClassesPerDerived) {
691  writeAndMoreFor = clBaseDerived;
692  ssDep << "\"...andmore" << clBaseDerived->GetName() << "\"-> \""
693  << clBaseDerived->GetName() << "\";" << std::endl;
694  ++count;
695  }
696  }
697  }
698 
699  if (writeNode) {
700  wroteNode.insert(iDerived->first);
701  outdot << " \"" << iDerived->first->GetName() << "\"";
702  const char* htmlFileName = fHtml->GetHtmlFileName(iDerived->first->GetName());
703  if (htmlFileName)
704  outdot << " [URL=\"" << htmlFileName << "\"]";
705  outdot << ";" << std::endl;
706  } else if (writeAndMoreFor) {
707  outdot << " \"...andmore" << writeAndMoreFor->GetName()
708  << "\" [label=\"...and more\",fontname=\"Times-Italic\",fillcolor=lightgrey,style=filled];" << std::endl;
709  }
710  }
711  if (!levelExists) break;
712  }
713  outdot << "}" << std::endl; // cluster
714 
715  outdot << ssDep.str();
716 
717  outdot << "}" << std::endl; // digraph
718 
719  return kTRUE;
720 }
721 
722 ////////////////////////////////////////////////////////////////////////////////
723 /// Build the class tree of inherited members for one class in GraphViz/Dot format
724 ///
725 /// Input: filename - output dot file incl. path
726 
728  std::ofstream outdot(filename);
729  outdot << "strict digraph G {" << std::endl
730  << "ratio=auto;" << std::endl
731  << "rankdir=RL;" << std::endl
732  << "compound=true;" << std::endl
733  << "constraint=false;" << std::endl
734  << "ranksep=0.1;" << std::endl
735  << "nodesep=0;" << std::endl
736  << "margin=0;" << std::endl;
737  outdot << " node [style=filled,width=0.7,height=0.15,fixedsize=true,shape=plaintext,fontsize=10];" << std::endl;
738 
739  std::stringstream ssDep;
740  const int numColumns = 3;
741 
742  std::list<TClass*> writeBasesFor;
743  writeBasesFor.push_back(fCurrentClass);
744  while (!writeBasesFor.empty()) {
745  TClass* cl = writeBasesFor.front();
746  writeBasesFor.pop_front();
747 
748  const char* htmlFileName = fHtml->GetHtmlFileName(cl->GetName());
749 
750  outdot << "subgraph \"cluster" << cl->GetName() << "\" {" << std::endl
751  << " color=lightgray;" << std::endl
752  << " label=\"" << cl->GetName() << "\";" << std::endl;
753  if (cl != fCurrentClass && htmlFileName)
754  outdot << " URL=\"" << htmlFileName << "\"" << std::endl;
755 
756  //Bool_t haveMembers = (cl->GetListOfDataMembers() && cl->GetListOfDataMembers()->GetSize());
757  Bool_t haveFuncs = cl->GetListOfMethods() && cl->GetListOfMethods()->GetSize();
758 
759  // DATA MEMBERS
760  {
761  // make sure each member name is listed only once
762  // that's useless for data members, but symmetric to what we have for methods
763  std::map<std::string, TDataMember*> dmMap;
764 
765  {
766  TIter iDM(cl->GetListOfDataMembers());
767  TDataMember* dm = 0;
768  while ((dm = (TDataMember*) iDM()))
769  dmMap[dm->GetName()] = dm;
770  }
771 
772  outdot << "subgraph \"clusterData0" << cl->GetName() << "\" {" << std::endl
773  << " color=white;" << std::endl
774  << " label=\"\";" << std::endl
775  << " \"clusterNode0" << cl->GetName() << "\" [height=0,width=0,style=invis];" << std::endl;
776  TString prevColumnNode;
777  Int_t pos = dmMap.size();
778  Int_t column = 0;
779  Int_t newColumnEvery = (pos + numColumns - 1) / numColumns;
780  for (std::map<std::string, TDataMember*>::iterator iDM = dmMap.begin();
781  iDM != dmMap.end(); ++iDM, --pos) {
782  TDataMember* dm = iDM->second;
783  TString nodeName(cl->GetName());
784  nodeName += "::";
785  nodeName += dm->GetName();
786  if (iDM == dmMap.begin())
787  prevColumnNode = nodeName;
788 
789  outdot << "\"" << nodeName << "\" [label=\""
790  << dm->GetName() << "\"";
791  if (dm->Property() & kIsPrivate)
792  outdot << ",color=\"#FFCCCC\"";
793  else if (dm->Property() & kIsProtected)
794  outdot << ",color=\"#FFFF77\"";
795  else
796  outdot << ",color=\"#CCFFCC\"";
797  outdot << "];" << std::endl;
798  if (pos % newColumnEvery == 1) {
799  ++column;
800  outdot << "};" << std::endl // end dataR
801  << "subgraph \"clusterData" << column << cl->GetName() << "\" {" << std::endl
802  << " color=white;" << std::endl
803  << " label=\"\";" << std::endl
804  << " \"clusterNode" << column << cl->GetName() << "\" [height=0,width=0,style=invis];" << std::endl;
805  } else if (iDM != dmMap.begin() && pos % newColumnEvery == 0) {
806  ssDep << "\"" << prevColumnNode
807  << "\" -> \"" << nodeName << "\""<< " [style=invis,weight=100];" << std::endl;
808  prevColumnNode = nodeName;
809  }
810  }
811 
812  while (column < numColumns - 1) {
813  ++column;
814  outdot << " \"clusterNode" << column << cl->GetName() << "\" [height=0,width=0,style=invis];" << std::endl;
815  }
816 
817  outdot << "};" << std::endl; // subgraph dataL/R
818  } // DATA MEMBERS
819 
820  // FUNCTION MEMBERS
821  if (haveFuncs) {
822  // make sure each member name is listed only once
823  std::map<std::string, TMethod*> methMap;
824 
825  {
826  TIter iMeth(cl->GetListOfMethods());
827  TMethod* meth = 0;
828  while ((meth = (TMethod*) iMeth()))
829  methMap[meth->GetName()] = meth;
830  }
831 
832  outdot << "subgraph \"clusterFunc0" << cl->GetName() << "\" {" << std::endl
833  << " color=white;" << std::endl
834  << " label=\"\";" << std::endl
835  << " \"clusterNode0" << cl->GetName() << "\" [height=0,width=0,style=invis];" << std::endl;
836 
837  TString prevColumnNodeFunc;
838  Int_t pos = methMap.size();
839  Int_t column = 0;
840  Int_t newColumnEvery = (pos + numColumns - 1) / numColumns;
841  for (std::map<std::string, TMethod*>::iterator iMeth = methMap.begin();
842  iMeth != methMap.end(); ++iMeth, --pos) {
843  TMethod* meth = iMeth->second;
844  TString nodeName(cl->GetName());
845  nodeName += "::";
846  nodeName += meth->GetName();
847  if (iMeth == methMap.begin())
848  prevColumnNodeFunc = nodeName;
849 
850  outdot << "\"" << nodeName << "\" [label=\"" << meth->GetName() << "\"";
851  if (cl != fCurrentClass &&
853  outdot << ",color=\"#777777\"";
854  else if (meth->Property() & kIsPrivate)
855  outdot << ",color=\"#FFCCCC\"";
856  else if (meth->Property() & kIsProtected)
857  outdot << ",color=\"#FFFF77\"";
858  else
859  outdot << ",color=\"#CCFFCC\"";
860  outdot << "];" << std::endl;
861  if (pos % newColumnEvery == 1) {
862  ++column;
863  outdot << "};" << std::endl // end funcR
864  << "subgraph \"clusterFunc" << column << cl->GetName() << "\" {" << std::endl
865  << " color=white;" << std::endl
866  << " label=\"\";" << std::endl;
867  } else if (iMeth != methMap.begin() && pos % newColumnEvery == 0) {
868  ssDep << "\"" << prevColumnNodeFunc
869  << "\" -> \"" << nodeName << "\""<< " [style=invis,weight=100];" << std::endl;
870  prevColumnNodeFunc = nodeName;
871  }
872  }
873  outdot << "};" << std::endl; // subgraph funcL/R
874  }
875 
876  outdot << "}" << std::endl; // cluster class
877 
878  for (Int_t pos = 0; pos < numColumns - 1; ++pos)
879  ssDep << "\"clusterNode" << pos << cl->GetName() << "\" -> \"clusterNode" << pos + 1 << cl->GetName() << "\" [style=invis];" << std::endl;
880 
881  if (cl->GetListOfBases() && cl->GetListOfBases()->GetSize()) {
882  TIter iBase(cl->GetListOfBases());
883  TBaseClass* base = 0;
884  while ((base = (TBaseClass*)iBase())) {
885  ssDep << " \"clusterNode" << numColumns - 1 << cl->GetName() << "\" -> "
886  << " \"clusterNode0" << base->GetName() << "\" [ltail=\"cluster" << cl->GetName()
887  << "\",lhead=\"cluster" << base->GetName() << "\"";
888  if (base != cl->GetListOfBases()->First())
889  ssDep << ",weight=0";
890  ssDep << "];" << std::endl;
891  writeBasesFor.push_back(base->GetClassPointer());
892  }
893  }
894  }
895 
896  outdot << ssDep.str();
897 
898  outdot << "}" << std::endl; // digraph
899 
900  return kTRUE;
901 }
902 
903 ////////////////////////////////////////////////////////////////////////////////
904 /// Build the include dependency graph for one class in
905 /// GraphViz/Dot format
906 ///
907 /// Input: filename - output dot file incl. path
908 
910  R__LOCKGUARD(GetHtml()->GetMakeClassMutex());
911 
912  std::map<std::string, std::string> filesToParse;
913  std::list<std::string> listFilesToParse;
914  TString declFileName;
915  TString implFileName;
916  fHtml->GetImplFileName(fCurrentClass, kFALSE, implFileName);
917  if (fHtml->GetDeclFileName(fCurrentClass, kFALSE, declFileName)) {
918  TString real;
919  if (fHtml->GetDeclFileName(fCurrentClass, kTRUE, real)) {
920  filesToParse[declFileName.Data()] = real.Data();
921  listFilesToParse.push_back(declFileName.Data());
922  }
923  }
924  /* do it only for the header
925  if (implFileName && strlen(implFileName)) {
926  char* real = gSystem->Which(fHtml->GetInputPath(), implFileName, kReadPermission);
927  if (real) {
928  filesToParse[implFileName] = real;
929  listFilesToParse.push_back(implFileName);
930  delete real;
931  }
932  }
933  */
934 
935  std::ofstream outdot(filename);
936  outdot << "strict digraph G {" << std::endl
937  << "ratio=compress;" << std::endl
938  << "rankdir=TB;" << std::endl
939  << "concentrate=true;" << std::endl
940  << "ranksep=0;" << std::endl
941  << "nodesep=0;" << std::endl
942  << "size=\"8,10\";" << std::endl
943  << "node [fontsize=20,shape=plaintext];" << std::endl;
944 
945  for (std::list<std::string>::iterator iFile = listFilesToParse.begin();
946  iFile != listFilesToParse.end(); ++iFile) {
947  std::ifstream in(filesToParse[*iFile].c_str());
948  std::string line;
949  while (in && !in.eof()) {
950  std::getline(in, line);
951  size_t pos = 0;
952  while (line[pos] == ' ' || line[pos] == '\t') ++pos;
953  if (line[pos] != '#') continue;
954  ++pos;
955  while (line[pos] == ' ' || line[pos] == '\t') ++pos;
956  if (line.compare(pos, 8, "include ") != 0) continue;
957  pos += 8;
958  while (line[pos] == ' ' || line[pos] == '\t') ++pos;
959  if (line[pos] != '"' && line[pos] != '<')
960  continue;
961  char delim = line[pos];
962  if (delim == '<') delim = '>';
963  ++pos;
964  line.erase(0, pos);
965  pos = 0;
966  pos = line.find(delim);
967  if (pos == std::string::npos) continue;
968  line.erase(pos);
969  if (filesToParse.find(line) == filesToParse.end()) {
970  TString sysfilename;
971  if (!GetHtml()->GetPathDefinition().GetFileNameFromInclude(line.c_str(), sysfilename))
972  continue;
973  listFilesToParse.push_back(line);
974  filesToParse[line] = sysfilename;
975  if (*iFile == implFileName.Data() || *iFile == declFileName.Data())
976  outdot << "\"" << *iFile << "\" [style=filled,fillcolor=lightgray];" << std::endl;
977  }
978  outdot << "\"" << *iFile << "\" -> \"" << line << "\";" << std::endl;
979  }
980  }
981 
982  outdot << "}" << std::endl; // digraph
983 
984  return kTRUE;
985 }
986 
987 ////////////////////////////////////////////////////////////////////////////////
988 /// Build the library dependency graph for one class in
989 /// GraphViz/Dot format
990 ///
991 /// Input: filename - output dot file incl. path
992 
994  std::ofstream outdot(filename);
995  outdot << "strict digraph G {" << std::endl
996  << "ratio=auto;" << std::endl
997  << "rankdir=RL;" << std::endl
998  << "compound=true;" << std::endl
999  << "constraint=false;" << std::endl
1000  << "ranksep=0.7;" << std::endl
1001  << "nodesep=0.3;" << std::endl
1002  << "size=\"8,8\";" << std::endl
1003  << "ratio=compress;" << std::endl;
1004 
1006  outdot << "\"All Libraries\" [URL=\"LibraryDependencies.html\",shape=box,rank=max,fillcolor=lightgray,style=filled];" << std::endl;
1007 
1008  if (libs.Length()) {
1009  TString firstLib(libs);
1010  Ssiz_t end = firstLib.Index(' ');
1011  if (end != kNPOS) {
1012  firstLib.Remove(end, firstLib.Length());
1013  libs.Remove(0, end + 1);
1014  } else libs = "";
1015 
1016  {
1017  Ssiz_t posExt = firstLib.First(".");
1018  if (posExt != kNPOS)
1019  firstLib.Remove(posExt, firstLib.Length());
1020  }
1021 
1022  outdot << "\"All Libraries\" -> \"" << firstLib << "\" [style=invis];" << std::endl;
1023  outdot << "\"" << firstLib << "\" -> {" << std::endl;
1024 
1025  if (firstLib != "libCore")
1026  libs += " libCore";
1027  if (firstLib != "libCint")
1028  libs += " libCint";
1029  TString thisLib;
1030  for (Ssiz_t pos = 0; pos < libs.Length(); ++pos)
1031  if (libs[pos] != ' ')
1032  thisLib += libs[pos];
1033  else if (thisLib.Length()) {
1034  Ssiz_t posExt = thisLib.First(".");
1035  if (posExt != kNPOS)
1036  thisLib.Remove(posExt, thisLib.Length());
1037  outdot << " \"" << thisLib << "\";";
1038  thisLib = "";
1039  }
1040  // remaining lib
1041  if (thisLib.Length()) {
1042  Ssiz_t posExt = thisLib.First(".");
1043  if (posExt != kNPOS)
1044  thisLib.Remove(posExt, thisLib.Length());
1045  outdot << " \"" << thisLib << "\";";
1046  thisLib = "";
1047  }
1048  outdot << "}" << std::endl; // dependencies
1049  } else
1050  outdot << "\"No rlibmap information available.\"" << std::endl;
1051 
1052  outdot << "}" << std::endl; // digraph
1053 
1054  return kTRUE;
1055 }
1056 
1057 ////////////////////////////////////////////////////////////////////////////////
1058 /// Create the hierarchical class list part for the current class's
1059 /// base classes. docFileName contains doc for fCurrentClass.
1060 ///
1061 
1062 void TClassDocOutput::CreateClassHierarchy(std::ostream& out, const char* docFileName)
1063 {
1064  // Find basic base classes
1065  TList *bases = fCurrentClass->GetListOfBases();
1066  if (!bases || bases->IsEmpty())
1067  return;
1068 
1069  out << "<hr />" << std::endl;
1070 
1071  out << "<table><tr><td><ul><li><tt>";
1072  if (docFileName) {
1073  out << "<a name=\"" << fCurrentClass->GetName() << "\" href=\""
1074  << docFileName << "\">";
1076  out << "</a>";
1077  } else {
1079  }
1080 
1081  // find derived classes
1082  out << "</tt></li></ul></td>";
1083  fHierarchyLines = 0;
1085 
1086  out << "</tr></table>" << std::endl;
1087 }
1088 
1089 ////////////////////////////////////////////////////////////////////////////////
1090 /// Create a hierarchical class list
1091 /// The algorithm descends from the base classes and branches into
1092 /// all derived classes. Mixing classes are displayed several times.
1093 ///
1094 ///
1095 
1097 {
1098  const char* title = "ClassHierarchy";
1099  TString filename(title);
1100  gSystem->PrependPathName(fHtml->GetOutputDir(), filename);
1101 
1102  // open out file
1103  std::ofstream dotout(filename + ".dot");
1104 
1105  if (!dotout.good()) {
1106  Error("CreateHierarchy", "Can't open file '%s.dot' !",
1107  filename.Data());
1108  return kFALSE;
1109  }
1110 
1111  dotout << "digraph G {" << std::endl
1112  << "ratio=auto;" << std::endl
1113  << "rankdir=RL;" << std::endl;
1114 
1115  // loop on all classes
1116  TClassDocInfo* cdi = 0;
1117  TIter iClass(fHtml->GetListOfClasses());
1118  while ((cdi = (TClassDocInfo*)iClass())) {
1119 
1120  TDictionary *dict = cdi->GetClass();
1121  TClass *cl = dynamic_cast<TClass*>(dict);
1122  if (cl == 0) {
1123  if (!dict)
1124  Warning("THtml::CreateHierarchy", "skipping class %s\n", cdi->GetName());
1125  continue;
1126  }
1127 
1128  // Find immediate base classes
1129  TList *bases = cl->GetListOfBases();
1130  if (bases && !bases->IsEmpty()) {
1131  dotout << "\"" << cdi->GetName() << "\" -> { ";
1132  TIter iBase(bases);
1133  TBaseClass* base = 0;
1134  while ((base = (TBaseClass*) iBase())) {
1135  // write out current class
1136  if (base != bases->First())
1137  dotout << "; ";
1138  dotout << "\"" << base->GetName() << "\"";
1139  }
1140  dotout << "};" << std::endl;
1141  } else
1142  // write out current class - no bases
1143  dotout << "\"" << cdi->GetName() << "\";" << std::endl;
1144 
1145  }
1146 
1147  dotout << "}";
1148  dotout.close();
1149 
1150  std::ofstream out(filename + ".html");
1151  if (!out.good()) {
1152  Error("CreateHierarchy", "Can't open file '%s.html' !",
1153  filename.Data());
1154  return kFALSE;
1155  }
1156 
1157  Printf(fHtml->GetCounterFormat(), "", fHtml->GetCounter(), (filename + ".html").Data());
1158  // write out header
1159  WriteHtmlHeader(out, "Class Hierarchy");
1160  out << "<h1>Class Hierarchy</h1>" << std::endl;
1161 
1162  WriteSearch(out);
1163 
1164  RunDot(filename, &out);
1165 
1166  out << "<img usemap=\"#Map" << title << "\" src=\"" << title << ".png\"/>" << std::endl;
1167  // write out footer
1168  WriteHtmlFooter(out);
1169  return kTRUE;
1170 }
1171 
1172 ////////////////////////////////////////////////////////////////////////////////
1173 /// Open a Class.cxx.html file, where Class is defined by classPtr, and .cxx.html by extension
1174 /// It's created in fHtml->GetOutputDir()/src. If successful, the HTML header is written to out.
1175 
1176 void TClassDocOutput::CreateSourceOutputStream(std::ostream& out, const char* extension,
1177  TString& sourceHtmlFileName)
1178 {
1179  TString sourceHtmlDir("src");
1180  gSystem->PrependPathName(fHtml->GetOutputDir(), sourceHtmlDir);
1181  // create directory if necessary
1182  {
1183  R__LOCKGUARD(GetHtml()->GetMakeClassMutex());
1184 
1185  if (gSystem->AccessPathName(sourceHtmlDir))
1186  gSystem->MakeDirectory(sourceHtmlDir);
1187  }
1188  sourceHtmlFileName = fCurrentClass->GetName();
1189  NameSpace2FileName(sourceHtmlFileName);
1190  gSystem->PrependPathName(sourceHtmlDir, sourceHtmlFileName);
1191  sourceHtmlFileName += extension;
1192  dynamic_cast<std::ofstream&>(out).open(sourceHtmlFileName);
1193  if (!out) {
1194  Warning("LocateMethodsInSource", "Can't open beautified source file '%s' for writing!",
1195  sourceHtmlFileName.Data());
1196  sourceHtmlFileName.Remove(0);
1197  return;
1198  }
1199 
1200  // write a HTML header
1201  TString title(fCurrentClass->GetName());
1202  title += " - source file";
1203  WriteHtmlHeader(out, title, "../", fCurrentClass);
1204  out << "<div id=\"codeAndLineNumbers\"><pre class=\"listing\">" << std::endl;
1205 }
1206 
1207 ////////////////////////////////////////////////////////////////////////////////
1208 /// Descend hierarchy recursively
1209 /// loop over all classes and look for classes with base class basePtr
1210 
1211 void TClassDocOutput::DescendHierarchy(std::ostream& out, TClass* basePtr, Int_t maxLines, Int_t depth)
1212 {
1213  if (maxLines)
1214  if (fHierarchyLines >= maxLines) {
1215  out << "<td></td>" << std::endl;
1216  return;
1217  }
1218 
1219  UInt_t numClasses = 0;
1220 
1221  TClassDocInfo* cdi = 0;
1222  TIter iClass(fHtml->GetListOfClasses());
1223  while ((cdi = (TClassDocInfo*)iClass()) && (!maxLines || fHierarchyLines<maxLines)) {
1224 
1225  TClass *classPtr = dynamic_cast<TClass*>(cdi->GetClass());
1226  if (!classPtr) continue;
1227 
1228  // find base classes with same name as basePtr
1229  TList* bases=classPtr->GetListOfBases();
1230  if (!bases) continue;
1231 
1232  TBaseClass *inheritFrom=(TBaseClass*)bases->FindObject(basePtr->GetName());
1233  if (!inheritFrom) continue;
1234 
1235  if (!numClasses)
1236  out << "<td>&larr;</td><td><table><tr>" << std::endl;
1237  else
1238  out << "</tr><tr>"<<std::endl;
1239  fHierarchyLines++;
1240  numClasses++;
1241  UInt_t bgcolor=255-depth*8;
1242  out << "<td bgcolor=\""
1243  << Form("#%02x%02x%02x", bgcolor, bgcolor, bgcolor)
1244  << "\">";
1245  out << "<table><tr><td>" << std::endl;
1246 
1247  TString htmlFile(cdi->GetHtmlFileName());
1248  if (htmlFile.Length()) {
1249  out << "<center><tt><a name=\"" << cdi->GetName() << "\" href=\""
1250  << htmlFile << "\">";
1251  ReplaceSpecialChars(out, cdi->GetName());
1252  out << "</a></tt></center>";
1253  } else {
1254  ReplaceSpecialChars(out, cdi->GetName());
1255  }
1256  // write title
1257  // commented out for now because it reduces overview
1258  /*
1259  len = strlen(classNames[i]);
1260  for (Int_t w = 0; w < (maxLen - len + 2); w++)
1261  out << ".";
1262  out << " ";
1263 
1264  out << "<a name=\"Title:";
1265  out << classPtr->GetName();
1266  out << "\">";
1267  ReplaceSpecialChars(out, classPtr->GetTitle());
1268  out << "</a></tt>" << std::endl;
1269  */
1270 
1271  out << "</td>" << std::endl;
1272  DescendHierarchy(out,classPtr,maxLines, depth+1);
1273  out << "</tr></table></td>" << std::endl;
1274 
1275  } // loop over all classes
1276  if (numClasses)
1277  out << "</tr></table></td>" << std::endl;
1278  else
1279  out << "<td></td>" << std::endl;
1280 }
1281 
1282 ////////////////////////////////////////////////////////////////////////////////
1283 /// Create an output file with a graphical representation of the class
1284 /// inheritance. If force, replace existing output file.
1285 /// This routine does nothing if fHtml->HaveDot() is true - use
1286 /// ClassDotCharts() instead!
1287 
1288 void TClassDocOutput::MakeTree(Bool_t force /*= kFALSE*/)
1289 {
1290  // class tree only if no dot, otherwise it's part of charts
1291  if (!fCurrentClass || fHtml->HaveDot())
1292  return;
1293 
1294  TString htmlFile;
1295  fHtml->GetHtmlFileName(fCurrentClass, htmlFile);
1296  if (htmlFile.Length()
1297  && (htmlFile.BeginsWith("http://")
1298  || htmlFile.BeginsWith("https://")
1299  || gSystem->IsAbsoluteFileName(htmlFile))
1300  ) {
1301  htmlFile.Remove(0);
1302  }
1303 
1304  if (!htmlFile.Length()) {
1305  TString what(fCurrentClass->GetName());
1306  what += " (source not found)";
1307  Printf(fHtml->GetCounterFormat(), "-skipped-", "", what.Data());
1308  return;
1309  }
1310 
1311  R__LOCKGUARD(GetHtml()->GetMakeClassMutex());
1312 
1313  // Create a canvas without linking against GUI libs
1314  Bool_t wasBatch = gROOT->IsBatch();
1315  if (!wasBatch)
1316  gROOT->SetBatch();
1317  TVirtualPad *psCanvas = (TVirtualPad*)gROOT->ProcessLineFast("new TCanvas(\"R__THtml\",\"psCanvas\",0,0,1000,1200);");
1318  if (!wasBatch)
1319  gROOT->SetBatch(kFALSE);
1320 
1321  if (!psCanvas) {
1322  Error("MakeTree", "Cannot create a TCanvas!");
1323  return;
1324  }
1325 
1326  // make a class tree
1327  ClassTree(psCanvas, force);
1328 
1329  psCanvas->Close();
1330  delete psCanvas;
1331 }
1332 
1333 ////////////////////////////////////////////////////////////////////////////////
1334 /// Called by TDocParser::LocateMethods(), this hook writes out the class description
1335 /// found by TDocParser. It's even called if none is found, i.e. if the first method
1336 /// has occurred before a class description is found, so missing class descriptions
1337 /// can be handled.
1338 /// For HTML, its creates the description block, the list of functions and data
1339 /// members, and the inheritance tree or, if Graphviz's dot is found, the class charts.
1340 
1341 void TClassDocOutput::WriteClassDescription(std::ostream& out, const TString& description)
1342 {
1343  // Class Description Title
1344  out << "<div class=\"dropshadow\"><div class=\"withshadow\">";
1345  TString anchor(fCurrentClass->GetName());
1346  NameSpace2FileName(anchor);
1347  out << "<h1><a name=\"" << anchor;
1348  out << ":description\"></a>";
1349 
1351  out << "namespace ";
1352  else
1353  out << "class ";
1355 
1356 
1357  // make a loop on base classes
1358  Bool_t first = kTRUE;
1359  TBaseClass *inheritFrom;
1360  TIter nextBase(fCurrentClass->GetListOfBases());
1361 
1362  while ((inheritFrom = (TBaseClass *) nextBase())) {
1363  if (first) {
1364  out << ": ";
1365  first = kFALSE;
1366  } else
1367  out << ", ";
1368  Long_t property = inheritFrom->Property();
1369  if (property & kIsPrivate)
1370  out << "private ";
1371  else if (property & kIsProtected)
1372  out << "protected ";
1373  else
1374  out << "public ";
1375 
1376  // get a class
1377  TClass *classInh = fHtml->GetClass(inheritFrom->GetName());
1378 
1379  TString htmlFile;
1380  fHtml->GetHtmlFileName(classInh, htmlFile);
1381 
1382  if (htmlFile.Length()) {
1383  // make a link to the base class
1384  out << "<a href=\"" << htmlFile << "\">";
1385  ReplaceSpecialChars(out, inheritFrom->GetName());
1386  out << "</a>";
1387  } else
1388  ReplaceSpecialChars(out, inheritFrom->GetName());
1389  }
1390  out << "</h1>" << std::endl;
1391 
1392  out << "<div class=\"classdescr\">" << std::endl;
1393 
1394  if (description.Length())
1395  out << "<pre>" << description << "</pre>";
1396 
1397  // typedefs pointing to this class:
1399  out << "<h4>This class is also known as (typedefs to this class)</h4>";
1401  bool firsttd = true;
1402  TDataType* dt = 0;
1403  while ((dt = (TDataType*) iTD())) {
1404  if (!firsttd)
1405  out << ", ";
1406  else firsttd = false;
1407  fParser->DecorateKeywords(out, dt->GetName());
1408  }
1409  }
1410 
1411  out << "</div>" << std::endl
1412  << "</div></div>" << std::endl;
1413 
1414  ListFunctions(out);
1415  ListDataMembers(out);
1416 
1417  // create dot class charts or an html inheritance tree
1418  out << "<h2><a id=\"" << anchor
1419  << ":Class_Charts\"></a>Class Charts</h2>" << std::endl;
1421  if (!ClassDotCharts(out))
1423 
1424  // header for the following function docs:
1425  out << "<h2>Function documentation</h2>" << std::endl;
1426 }
1427 
1428 
1429 ////////////////////////////////////////////////////////////////////////////////
1430 /// Write out the introduction of a class description (shortcuts and links)
1431 
1432 void TClassDocOutput::WriteClassDocHeader(std::ostream& classFile)
1433 {
1434  classFile << "<a name=\"TopOfPage\"></a>" << std::endl;
1435 
1436 
1437  // show box with lib, include
1438  // needs to go first to allow title on the left
1439  TString sTitle(fCurrentClass->GetName());
1440  ReplaceSpecialChars(sTitle);
1442  sTitle.Prepend("namespace ");
1443  else
1444  sTitle.Prepend("class ");
1445 
1446  TString sInclude;
1447  TString sLib;
1448  const char* lib=fCurrentClass->GetSharedLibs();
1450  if (lib) {
1451  char* libDup=StrDup(lib);
1452  char* libDupSpace=strchr(libDup,' ');
1453  if (libDupSpace) *libDupSpace=0;
1454  char* libDupEnd=libDup+strlen(libDup);
1455  while (libDupEnd!=libDup)
1456  if (*(--libDupEnd)=='.') {
1457  *libDupEnd=0;
1458  break;
1459  }
1460  sLib = libDup;
1461  delete[] libDup;
1462  }
1463  classFile << "<script type=\"text/javascript\">WriteFollowPageBox('"
1464  << sTitle << "','" << sLib << "','" << sInclude << "');</script>" << std::endl;
1465 
1466  TString modulename;
1468  TModuleDocInfo* module = (TModuleDocInfo*) fHtml->GetListOfModules()->FindObject(modulename);
1469  WriteTopLinks(classFile, module, fCurrentClass->GetName(), kFALSE);
1470 
1471  classFile << "<div class=\"descrhead\"><div class=\"descrheadcontent\">" << std::endl // descrhead line 3
1472  << "<span class=\"descrtitle\">Source:</span>" << std::endl;
1473 
1474  // make a link to the '.cxx' file
1475  TString classFileName(fCurrentClass->GetName());
1476  NameSpace2FileName(classFileName);
1477 
1478  TString headerFileName;
1479  fHtml->GetDeclFileName(fCurrentClass, kFALSE, headerFileName);
1480  TString sourceFileName;
1481  fHtml->GetImplFileName(fCurrentClass, kFALSE, sourceFileName);
1482  if (headerFileName.Length())
1483  classFile << "<a class=\"descrheadentry\" href=\"src/" << classFileName
1484  << ".h.html\">header file</a>" << std::endl;
1485  else
1486  classFile << "<a class=\"descrheadentry\"> </a>" << std::endl;
1487 
1488  if (sourceFileName.Length())
1489  classFile << "<a class=\"descrheadentry\" href=\"src/" << classFileName
1490  << ".cxx.html\">source file</a>" << std::endl;
1491  else
1492  classFile << "<a class=\"descrheadentry\"> </a>" << std::endl;
1493 
1494  if (!fHtml->IsNamespace(fCurrentClass) && !fHtml->HaveDot()) {
1495  // make a link to the inheritance tree (postscript)
1496  classFile << "<a class=\"descrheadentry\" href=\"" << classFileName << "_Tree.pdf\"";
1497  classFile << ">inheritance tree (.pdf)</a> ";
1498  }
1499 
1500  const TString& viewCVSLink = GetHtml()->GetViewCVS();
1501  Bool_t mustReplace = viewCVSLink.Contains("%f");
1502  if (viewCVSLink.Length()) {
1503  if (headerFileName.Length()) {
1504  TString link(viewCVSLink);
1505  TString sHeader(headerFileName);
1506  if (GetHtml()->GetProductName() && !strcmp(GetHtml()->GetProductName(), "ROOT")) {
1507  Ssiz_t posInclude = sHeader.Index("/include/");
1508  if (posInclude != kNPOS) {
1509  // Cut off ".../include", i.e. keep leading '/'
1510  sHeader.Remove(0, posInclude + 8);
1511  } else {
1512  // no /include/; maybe /inc?
1513  posInclude = sHeader.Index("/inc/");
1514  if (posInclude != kNPOS) {
1515  sHeader = "/";
1516  sHeader += sInclude;
1517  }
1518  }
1519  if (sourceFileName && strstr(sourceFileName, "src")) {
1520  TString src(sourceFileName);
1521  src.Remove(src.Index("src"), src.Length());
1522  src += "inc";
1523  sHeader.Prepend(src);
1524  } else {
1526  Ssiz_t posEndLib = src.Index(' ');
1527  if (posEndLib != kNPOS)
1528  src.Remove(posEndLib, src.Length());
1529  if (src.BeginsWith("lib"))
1530  src.Remove(0, 3);
1531  posEndLib = src.Index('.');
1532  if (posEndLib != kNPOS)
1533  src.Remove(posEndLib, src.Length());
1534  src.ToLower();
1535  src += "/inc";
1536  sHeader.Prepend(src);
1537  }
1538  if (sHeader.BeginsWith("tmva/inc/TMVA"))
1539  sHeader.Remove(8, 5);
1540  }
1541  if (mustReplace) link.ReplaceAll("%f", sHeader);
1542  else link += sHeader;
1543  classFile << "<a class=\"descrheadentry\" href=\"" << link << "\">viewVC header</a> ";
1544  } else
1545  classFile << "<a class=\"descrheadentry\"> </a> ";
1546  if (sourceFileName.Length()) {
1547  TString link(viewCVSLink);
1548  if (mustReplace) link.ReplaceAll("%f", sourceFileName);
1549  else link += sourceFileName;
1550  classFile << "<a class=\"descrheadentry\" href=\"" << link << "\">viewVC source</a> ";
1551  } else
1552  classFile << "<a class=\"descrheadentry\"> </a> ";
1553  }
1554 
1555  TString currClassNameMangled(fCurrentClass->GetName());
1556  NameSpace2FileName(currClassNameMangled);
1557 
1558  TString wikiLink = GetHtml()->GetWikiURL();
1559  if (wikiLink.Length()) {
1560  if (wikiLink.Contains("%c")) wikiLink.ReplaceAll("%c", currClassNameMangled);
1561  else wikiLink += currClassNameMangled;
1562  classFile << "<a class=\"descrheadentry\" href=\"" << wikiLink << "\">wiki</a> ";
1563  }
1564 
1565  classFile << std::endl << "</div></div>" << std::endl; // descrhead line 3
1566 
1567  classFile << "<div class=\"descrhead\"><div class=\"descrheadcontent\">" << std::endl // descrhead line 4
1568  << "<span class=\"descrtitle\">Sections:</span>" << std::endl
1569  << "<a class=\"descrheadentry\" href=\"#" << currClassNameMangled;
1571  classFile << ":description\">namespace description</a> ";
1572  else
1573  classFile << ":description\">class description</a> ";
1574  classFile << std::endl
1575  << "<a class=\"descrheadentry\" href=\"#" << currClassNameMangled << ":Function_Members\">function members</a>" << std::endl
1576  << "<a class=\"descrheadentry\" href=\"#" << currClassNameMangled << ":Data_Members\">data members</a>" << std::endl
1577  << "<a class=\"descrheadentry\" href=\"#" << currClassNameMangled << ":Class_Charts\">class charts</a>" << std::endl
1578  << "</div></div>" << std::endl // descrhead line 4
1579  << "</div>" << std::endl; // toplinks, from TDocOutput::WriteTopLinks
1580 
1581  WriteLocation(classFile, module, fCurrentClass->GetName());
1582 }
1583 
1584 
1585 ////////////////////////////////////////////////////////////////////////////////
1586 /// Write method name with return type ret and parameters param to out.
1587 /// Build a link using file and anchor. Cooment it with comment, and
1588 /// show the code codeOneLiner (set if the func consists of only one line
1589 /// of code, immediately surrounded by "{","}"). Also updates fMethodNames's
1590 /// count of method names.
1591 
1592 void TClassDocOutput::WriteMethod(std::ostream& out, TString& ret,
1593  TString& name, TString& params,
1594  const char* filename, TString& anchor,
1595  TString& comment, TString& codeOneLiner,
1596  TDocMethodWrapper* guessedMethod)
1597 {
1598  fParser->DecorateKeywords(ret);
1599  out << "<div class=\"funcdoc\"><span class=\"funcname\">"
1600  << ret << " <a class=\"funcname\" name=\"";
1601  TString mangled(fCurrentClass->GetName());
1602  NameSpace2FileName(mangled);
1603  out << mangled << ":";
1604  mangled = name;
1605  NameSpace2FileName(mangled);
1606  if (guessedMethod && guessedMethod->GetOverloadIdx()) {
1607  mangled += "@";
1608  mangled += guessedMethod->GetOverloadIdx();
1609  }
1610  out << mangled << "\" href=\"src/" << filename;
1611  if (anchor.Length())
1612  out << "#" << anchor;
1613  out << "\">";
1614  ReplaceSpecialChars(out, name);
1615  out << "</a>";
1616  if (guessedMethod) {
1617  out << "(";
1618  TMethodArg* arg;
1619  TIter iParam(guessedMethod->GetMethod()->GetListOfMethodArgs());
1620  Bool_t first = kTRUE;
1621  while ((arg = (TMethodArg*) iParam())) {
1622  if (!first) out << ", ";
1623  else first = kFALSE;
1624  TString paramGuessed(arg->GetFullTypeName());
1625  paramGuessed += " ";
1626  paramGuessed += arg->GetName();
1627  if (arg->GetDefault() && strlen(arg->GetDefault())) {
1628  paramGuessed += " = ";
1629  paramGuessed += arg->GetDefault();
1630  }
1631  fParser->DecorateKeywords(paramGuessed);
1632  out << paramGuessed;
1633  }
1634  out << ")";
1635  if (guessedMethod->GetMethod()->Property() & kIsConstMethod)
1636  out << " const";
1637  } else {
1638  fParser->DecorateKeywords(params);
1639  out << params;
1640  }
1641  out << "</span><br />" << std::endl;
1642 
1643  if (comment.Length())
1644  out << "<div class=\"funccomm\"><pre>" << comment << "</pre></div>" << std::endl;
1645 
1646  if (codeOneLiner.Length()) {
1647  out << std::endl << "<div class=\"code\"><code class=\"inlinecode\">"
1648  << codeOneLiner << "</code></div>" << std::endl
1649  << "<div style=\"clear:both;\"></div>" << std::endl;
1650  codeOneLiner.Remove(0);
1651  }
1652  out << "</div>" << std::endl;
1653 }
1654 
1655 
1656 
A zero length substring is legal.
Definition: TString.h:71
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:932
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1276
static Bool_t IsNamespace(const TClass *cl)
Check whether cl is a namespace.
Definition: THtml.cxx:2194
TClassDocOutput(THtml &html, TClass *cl, TList *typedefs)
Create an object given the invoking THtml object, and the TClass object that we will generate output ...
friend class TDocParser
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:949
virtual void Close(Option_t *option="")=0
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3507
virtual ~TClassDocOutput()
Destructor, deletes fParser.
virtual bool GetImplFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return implementation file name.
Definition: THtml.cxx:2105
Bool_t HaveDot()
Check whether dot is available in $PATH or in the directory set by SetDotPath()
Definition: THtml.cxx:1403
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:105
void CreateClassHierarchy(std::ostream &out, const char *docFileName)
Create the hierarchical class list part for the current class&#39;s base classes.
const TString & GetWikiURL() const
Definition: THtml.h:314
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
TLine * line
const char * GetReturnTypeName() const
Get full type description of function return type, e,g.: "class TDirectory*".
Definition: TFunction.cxx:140
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:638
TDocParser * fParser
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
virtual Int_t GetEntries() const
Definition: TCollection.h:177
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:825
void ClassTree(TVirtualPad *canvas, Bool_t force=kFALSE)
It makes a graphical class tree.
#define gROOT
Definition: TROOT.h:402
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Definition: TClass.cxx:3617
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:585
const TList * GetEnums(EAccess access) const
Definition: TDocParser.h:176
const char * GetSharedLibs()
Get the list of shared libraries containing the code for class cls.
Definition: TClass.cxx:3494
Ssiz_t Start() const
Definition: TString.h:109
const TString & GetViewCVS() const
Definition: THtml.h:313
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Ssiz_t Length() const
Definition: TString.h:108
Bool_t CopyHtmlFile(const char *sourceName, const char *destName="")
Copy file to HTML directory.
Definition: TDocOutput.cxx:593
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition: TMethodArg.h:31
TString & Prepend(const char *cs)
Definition: TString.h:607
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
Definition: TMethodArg.cxx:75
virtual Int_t GetOverloadIdx() const =0
const char * GetSourceInfo(ESourceInfo type) const
Definition: TDocParser.h:177
const char * GetCounter() const
Definition: THtml.h:323
void GetDerivedClasses(TClass *cl, std::map< TClass *, Int_t > &derived) const
fill derived with all classes inheriting from cl and their inheritance distance to cl ...
Definition: THtml.cxx:1954
const TList * GetListOfClasses() const
Definition: THtml.h:341
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
void MakeTree(Bool_t force=kFALSE)
Create an output file with a graphical representation of the class inheritance.
virtual void SaveAs(const char *filename="", Option_t *option="") const =0
Save this object in the file specified by filename.
Bool_t CreateHierarchyDot()
Create a hierarchical class list The algorithm descends from the base classes and branches into all d...
TClass * GetClass(T *)
Definition: TClass.h:577
const TList * GetMethods(EAccess access) const
Definition: TDocParser.h:170
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition: TSystem.cxx:1062
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TFunction.cxx:183
virtual bool GetFileNameFromInclude(const char *included, TString &out_fsname) const
Set out_fsname to the full pathname corresponding to a file included as "included".
Definition: THtml.cxx:620
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:477
Bool_t CreateDotClassChartInh(const char *filename)
Build the class tree for one class in GraphViz/Dot format.
void WriteHtmlFooter(std::ostream &out, const char *dir, const char *lastUpdate, const char *author, const char *copyright, const char *footer)
Write HTML footer.
void WriteLocation(std::ostream &out, TModuleDocInfo *module, const char *classname=0)
make a link to the description
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:49
virtual void GetModuleNameForClass(TString &module, TClass *cl) const
Return the module name for a given class.
Definition: THtml.cxx:1530
TDictionary * GetClass() const
Definition: TDocInfo.h:58
virtual void Parse(std::ostream &out)
Locate methods, starting in the source file, then inline, then immediately inside the class declarati...
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
A doubly linked list.
Definition: TList.h:44
virtual bool GetIncludeAs(TClass *cl, TString &out_include_as) const
Determine the path and filename used in an include statement for the header file of the given class...
Definition: THtml.cxx:571
virtual TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();...
Definition: TMethod.cxx:305
TClass * fCurrentClass
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
virtual const char * GetName() const
Returns name of object.
Definition: TDocInfo.cxx:26
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
virtual const char * ReplaceSpecialChars(char c)
Replace ampersand, less-than and greater-than character, writing to out.
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
virtual void NameSpace2FileName(TString &name)
Replace "::" in name by "__" Replace "<", ">", " ", ",", "~", "=" in name by "_" Replace "A::X<A::Y>"...
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:561
void CreateSourceOutputStream(std::ostream &out, const char *extension, TString &filename)
Open a Class.cxx.html file, where Class is defined by classPtr, and .cxx.html by extension It&#39;s creat...
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
char * Form(const char *fmt,...)
void Draw(Option_t *option="")
Draw detailed class inheritance structure.
Definition: TClass.cxx:2406
Ssiz_t Length() const
Definition: TString.h:386
const char * ShortType(const char *name) const
Get short type name, i.e. with default templates removed.
Definition: THtml.cxx:2512
const TString & GetOutputDir(Bool_t createDir=kTRUE) const
Return the output directory as set by SetOutputDir().
Definition: THtml.cxx:2169
Int_t GetArrayDim() const
Return number of array dimensions.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
THtml * fHtml
Definition: TDocOutput.h:46
const Int_t kWarning
Definition: TError.h:38
virtual TMethod * GetMethod() const =0
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4688
TList * fCurrentClassesTypedefs
virtual bool GetDeclFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return declaration file name; return the full path if filesys is true.
Definition: THtml.cxx:2097
virtual void WriteSearch(std::ostream &out)
Write a search link or a search box, based on THtml::GetSearchStemURL() and THtml::GetSearchEngine()...
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
Definition: TClass.cxx:5768
void DescendHierarchy(std::ostream &out, TClass *basePtr, Int_t maxLines=0, Int_t depth=1)
Descend hierarchy recursively loop over all classes and look for classes with base class basePtr...
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:33
void WriteHtmlHeader(std::ostream &out, const char *titleNoSpecial, const char *dir, TClass *cls, const char *header)
Write HTML header.
#define Printf
Definition: TGeoToOCC.h:18
virtual Bool_t IsModified(TClass *classPtr, EFileType type)
Check if file is modified.
const char * GetHtmlFileName() const
Definition: TDocInfo.h:60
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2544
const Bool_t kFALSE
Definition: RtypesCore.h:88
const char * extension
Definition: civetweb.c:5005
void ClassHtmlTree(std::ostream &out, TClass *classPtr, ETraverse dir=kBoth, int depth=1)
This function builds the class tree for one class in HTML (inherited and succeeding classes...
TString & Remove(Ssiz_t pos)
Definition: TString.h:619
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
void Class2Html(Bool_t force=kFALSE)
Create HTML files for a single class.
const char * GetCounterFormat() const
Definition: THtml.h:303
virtual Bool_t IsEmpty() const
Definition: TCollection.h:184
#define ClassImp(name)
Definition: Rtypes.h:359
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:875
virtual void DecorateKeywords(std::ostream &out, const char *text)
Expand keywords in text, writing to out.
Definition: TDocParser.cxx:450
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
#define R__LOCKGUARD(mutex)
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TBaseClass.cxx:134
virtual void GetHtmlFileName(TClass *classPtr, TString &filename) const
Return real HTML filename.
Definition: THtml.cxx:1991
virtual void ListDataMembers(std::ostream &classFile)
Write the list of data members and enums.
virtual TClass * GetClass(const char *name) const
Return pointer to class with name.
Definition: THtml.cxx:2066
void WriteTopLinks(std::ostream &out, TModuleDocInfo *module, const char *classname=0, Bool_t withLocation=kTRUE)
Write the first part of the links shown ontop of each doc page; one <div> has to be closed by caller ...
virtual void WriteClassDocHeader(std::ostream &classFile)
Write out the introduction of a class description (shortcuts and links)
const char * GetDefault() const
Get default value of method argument.
Definition: TMethodArg.cxx:58
Bool_t CreateDotClassChartInhMem(const char *filename)
Build the class tree of inherited members for one class in GraphViz/Dot format.
Bool_t RunDot(const char *filename, std::ostream *outMap=0, EGraphvizTool gvwhat=kDot)
Run filename".dot", creating filename".png", and - if outMap is !=0, filename".map", which gets then included literally into outMap.
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:38
TClass * GetClass() const
Definition: TMethod.h:55
THtml * GetHtml()
Definition: TDocOutput.h:90
virtual void WriteMethod(std::ostream &out, TString &ret, TString &name, TString &params, const char *file, TString &anchor, TString &comment, TString &codeOneLiner, TDocMethodWrapper *guessedMethod)
Write method name with return type ret and parameters param to out.
Bool_t ClassDotCharts(std::ostream &out)
This function builds the class charts for one class in GraphViz/Dot format, i.e.
TMethod * GetMethodAny(const char *method)
Return pointer to method without looking at parameters.
Definition: TClass.cxx:4195
Definition: first.py:1
const TList * GetListOfModules() const
Definition: THtml.h:340
virtual Int_t GetSize() const
Definition: TCollection.h:180
const TPathDefinition & GetPathDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
Definition: THtml.cxx:1331
virtual void ListFunctions(std::ostream &classFile)
Write the list of functions.
TClass * GetClass() const
Definition: TDataMember.h:73
Bool_t CreateDotClassChartIncl(const char *filename)
Build the include dependency graph for one class in GraphViz/Dot format.
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
Definition: TClass.cxx:3666
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void WriteClassDescription(std::ostream &out, const TString &description)
Called by TDocParser::LocateMethods(), this hook writes out the class description found by TDocParser...
Bool_t CreateDotClassChartLib(const char *filename)
Build the library dependency graph for one class in GraphViz/Dot format.
Definition: THtml.h:40
char name[80]
Definition: TGX11.cxx:109
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
const TList * GetDataMembers(EAccess access) const
Definition: TDocParser.h:175
const char * Data() const
Definition: TString.h:345