#include "RooFit.h"
#include "RooHtml.h"
#include "TDatime.h"
#include "TClassTable.h"
#include "TRegexp.h"
#include "TClass.h"
#include "TSystem.h"
#include "TObjString.h"
#include <ctype.h>
#include "Riostream.h"
#include <fstream>
#include <string.h>
#ifndef _WIN32
#include <strings.h>
#endif
#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
char* operator+( streampos&, char* );
#endif
const Int_t   kSpaceNum      = 1;
const char   *formatStr      = "%12s %5s %s";
ClassImp(RooHtml)
  ;
void RooHtml::WriteHtmlHeader(ofstream &out, const char *title, const char* dir, TClass* )
{
  
  out
    << "<!doctype html public \"-//dtd html 4.0 transitional// en\">" << endl
    << "<html>" << endl
    << "<head>" << endl
    << "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">" << endl
    << "  <meta name=\"Author\" content=\"David Kirkby & Wouter Verkerke\">" << endl
    << "  <meta name=\"GENERATOR\" content=\"RooHtml Class in ROOT Environment\">" << endl
    << "  <title>";
  ReplaceSpecialChars(out, title);
  out
    << "</title>" << endl
    << "  <meta name=\"rating\" content=\"General\">" << endl
    << "  <meta name=\"objecttype\" content=\"Manual\">" << endl
    << "  <meta name=\"keywords\" content=\"software development, oo, object oriented, "
    << "  unix, x11, windows, c++, html, rene brun, fons rademakers, david kirkby, wouter verkerke\">" << endl
    << "  <meta name=\"description\" content=\"RooFit - A Toolkit for Physics Data Modeling.\">" << endl
    << "</head>" << endl
    << "<body text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#0000FF\" vlink=\"#FF0000\" alink=\"#000088\">"
    << endl
    << "<a name=\"TopOfPage\"></a>" << endl;
  out
    << "<center><table BORDER=0 CELLSPACING=0 COLS=2 WIDTH=\"100%\" BGCOLOR=\"" << _hfColor << "\" NOSAVE >" << endl
    << "  <tr NOSAVE><td NOSAVE><b><i><font color=\"#000000\">" << endl
    
    << "    <a href=\"http://roofit.sourceforge.net\"" << endl
    << "      title=\"Visit RooFit Home Page\">" << endl
    << "    RooFit Toolkit for Data Modeling</a>" << endl
    
    << "  </font></i></b></td>" << endl
    << "  <td><div align=right><b><i><font color=\"#000000\">" << endl
    
    << "    <a href=\"" << dir << "IndexByTopic.html\"" << endl
    << "      title=\"Visit List of Classes\">" << endl;
  out << getVersion() << " Version</a>" << endl;
  
  out
    << "  </font></i></b></div></td></tr>" << endl
    << "</table></center>" << endl;
}
void RooHtml::WriteHtmlFooter(ofstream &out, const char * , const char *lastUpdate,
			      const char * , const char * ) {
  
  
#ifndef _WIN32
   const char *comma= index(lastUpdate,',');
  TString update = comma ? comma+1 : lastUpdate;
#else
  TString update = lastUpdate;
#endif
  if(update.EndsWith(" Exp $")) update.Remove(update.Length()-6,6);
  out << "<center><table BORDER=0 CELLSPACING=0 COLS=2 WIDTH=\"100%\" BGCOLOR=\"" << _hfColor << "\" NOSAVE >" << endl
      << "<tr NOSAVE>" << endl
      << "<td>Last CVS Update: " << update << "</td>" << endl
      << "<td NOSAVE align=right><b><a href=\"#TopOfPage\">Top</a></b></td>" << endl
      << "</tr></table></center>" << endl
      << "<center>Copyright © 2000-2005 University of California, Stanford University</center>" << endl
      << "</body>" << endl ;
}
void RooHtml::GetModuleName(TString& module, const char* filename) const
{
  
  
   module = getClassGroup(filename);
}
char* RooHtml::getClassGroup(const char* fileName) const
{
  
  
  
  static char buffer[1024] = "" ;
  strcpy(buffer,"USER") ;
  const char* fullName = gSystem->Which(fSourceDir, fileName, kReadPermission) ;
  if (!fullName) {
    return buffer ;
  }
  
  ifstream ifs(fullName) ;
  char line[1024] ;
  while(ifs.good()) {
    ifs.getline(line,sizeof(line),'\n') ;
    
    
    char *ptr ;
    if ((ptr = strstr(line,"CLASS DESCRIPTION"))) {
      char* start = strchr(ptr,'[') ;
      if (start) {
	
	if (!strchr(start,']')) break ;
	
	char* group = strtok(start+1,"]") ;
	
	if (group && strlen(group)) strcpy(buffer,group) ;
      }
      break ;
    }
  }
  return buffer ;
}
void RooHtml::addTopic(const char* tag, const char* description) 
{
  _topicTagList.Add(new TObjString(tag)) ;
  _topicDescList.Add(new TObjString(description)) ;
}
void RooHtml::MakeIndexOfTopics() 
{
  TString idxFileName(fOutputDir) ;
  idxFileName.Append("/") ;
  idxFileName.Append("IndexByTopic.html") ;
  ofstream ofs(idxFileName) ;
  WriteHtmlHeader(ofs,"RooFit Index by Topic") ;
  TIterator* tagIter = _topicTagList.MakeIterator() ;
  TIterator* descIter = _topicDescList.MakeIterator() ;
  TObjString* tag ;
  TObjString* desc ;
  ofs << "<H2>" << endl << "<UL>" << endl ;
  while((tag=(TObjString*)tagIter->Next())) {
    desc=(TObjString*)descIter->Next() ;
    ofs << "<LI> <A HREF=" << tag->String() << "_Index.html>" << desc->String() << "</A>" << endl ;
  }
  ofs << "</UL>" << endl << "</H2>" << endl ;
  TDatime now;
  WriteHtmlFooter(ofs,"",now.AsString()) ;
  delete tagIter ;
  delete descIter ;
  
}
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.