/****************************************************************************** * * $Id$ * * Copyright (C) 1997-1999 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * All output generated with Doxygen is not covered by this license. * */ #include #include #include "message.h" #include "htmlgen.h" #include "config.h" #include "util.h" #include "doxygen.h" #include "logos.h" #include "diagram.h" HtmlGenerator::HtmlGenerator() : OutputGenerator() { if (headerFile.length()>0) header=fileToString(headerFile); if (footerFile.length()>0) footer=fileToString(footerFile); dir=htmlOutputDir; } HtmlGenerator::~HtmlGenerator() { } void HtmlGenerator::append(const OutputGenerator *g) { t << g->getContents(); } void HtmlGenerator::init() { QDir d(htmlOutputDir); if (!d.exists() && !d.mkdir(htmlOutputDir)) { err("Could not create output directory %s\n",htmlOutputDir.data()); exit(1); } writeLogo(htmlOutputDir); } //void HtmlGenerator::generateExternalIndex() //{ // //printf("Generating external index...\n"); // QFile f; // f.setName(htmlOutputDir+"/header.html"); // if (f.open(IO_WriteOnly)) // { // QTextStream tt(&f); // if (header.length()==0) // { // tt << "\n" // "\n" // "Doxysearch\n" // "\n"; // } // else // { // tt << header; // } // if (!noIndexFlag) // { // tt << "
"; // if (documentedGroups>0) // tt << "Modules   "; // if (hierarchyClasses>0) // tt << "Class hierarchy   "; // if (annotatedClasses>0) // tt << "Compound list   "; // if (documentedFiles>0) // tt << "File list   "; // if (includeFiles.count()>0) // tt << "Header files   "; // if (documentedMembers>0) // tt << "Compound Members   "; // if (documentedFunctions>0) // tt << "File Members   "; // if (pageList.count()>0) // tt << "Related Pages   "; // if (exampleList.count()>0) // tt << "Examples   "; // if (searchEngineFlag) // tt << "Search"; // tt << endl << "

" << endl; // } // } // f.close(); // // f.setName(htmlOutputDir+"/footer.html"); // if (f.open(IO_WriteOnly)) // { // QTextStream tt(&f); // if (footer.length()==0) // { // tt << "
Generated at " << dateToString(TRUE); // if (projectName.length()>0) tt << " for " << projectName; // tt << " by " // "doxygen  written by Dimitri van Heesch, © " // "1997-1999
\n\n\n"; // } // else // { // tt << footer; // } // } // f.close(); //} void HtmlGenerator::startFile(const char *name,const char *title,bool external) { QString fileName=name; if (fileName.right(5)!=".html") fileName+=".html"; startPlainFile(fileName); if (header.length()==0) { t << "\n" "\n" "" << title << "\n"; t << "\n" "\n"; } else { t << header; } // if (!noIndexFlag) // { // t << "
"; // if (documentedGroups>0) // t << "Modules   "; // if (hierarchyClasses>0) // t << "Class hierarchy   "; // if (annotatedClasses>0) // t << "Compound list   "; // if (documentedFiles>0) // t << "File list   "; // if (includeFiles.count()>0) // t << "Header files   "; // if (documentedMembers>0) // t << "Compound Members   "; // if (documentedFunctions>0) // t << "File Members   "; // if (pageList.count()>0) // t << "Related Pages   "; // if (exampleList.count()>0) // t << "Examples   "; // if (searchEngineFlag) // t << "Search"; // t << endl << "

" << endl; // } } void HtmlGenerator::startQuickIndexItem(const char *s,const char *l) { t << ""; } void HtmlGenerator::endQuickIndexItem() { t << "   "; } void HtmlGenerator::writeFooter(int part,bool external) { switch (part) { case 0: if (footer.length()==0) t << "
"; else t << footer; break; case 1: if (footer.length()==0) { t << " "; t << "\"doxygen\"  "; } break; default: if (footer.length()==0) t << " Dimitri van Heesch, © " "1997-1999
\n\n\n"; break; } } void HtmlGenerator::endFile() { // if (footer.length()==0) // { // t << "
Generated at " << dateToString(TRUE); // if (projectName.length()>0) // { // t << " for "; // docify(projectName); // } // t << " by " // "\"doxygen\"  written by Dimitri van Heesch, © " // "1997-1999
\n\n\n"; // } // else // { // t << footer; // } endPlainFile(); } void HtmlGenerator::startProjectNumber() { t << "

"; } void HtmlGenerator::endProjectNumber() { t << "

"; } //void HtmlGenerator::writeIndex() //{ // startFile("index.html","Main Index"); // t << "

"; // docify(projectName); // t << " Documentation

" // << "

" << endl << "

" << endl; // if (!projectNumber.isEmpty()) // { // t << "

"; // docify(projectNumber); // t << "

\n

\n

\n"; // } // if (noIndexFlag) // { // t << "

" << endl; // } // endFile(); //} void HtmlGenerator::writeStyleInfo(int part) { if (part==0) { startPlainFile("doxygen.css"); t << "H1 { border-width: thin; border: solid; text-align: center }" << endl << "A.el { text-decoration: none; font-weight: bold }" << endl << "DL.el { margin-left: -1cm }" << endl << "DIV.fragment { width: 100%; border: none; background-color: #eeeeee }" << endl << "DIV.in { margin-left: 16 }" << endl << endl; endPlainFile(); } } void HtmlGenerator::writeDoxyAnchor(const char *,const char *anchor, const char *name) { t << ""; } void HtmlGenerator::newParagraph() { t << endl << "

" << endl; } void HtmlGenerator::writeString(const char *text) { t << text; } void HtmlGenerator::writeIndexItem(const char *ref,const char *f, const char *name) { t << "

  • "; if (ref || f) { t << ""; } else { t << ""; } docify(name); if (ref || f) { t << "" << endl; } else { t << ""; } } void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, const char *path,const char *name) { t << "
  • "; if (path) docify(path); t << ""; docify(name); t << " "; } void HtmlGenerator::writeObjectLink(const char *ref,const char *f, const char *anchor, const char *name) { t << ""; docify(name); t << ""; } void HtmlGenerator::startTextLink(const char *f,const char *anchor) { t << ""; } void HtmlGenerator::endTextLink() { t << ""; } void HtmlGenerator::writeHtmlLink(const char *url,const char *text) { t << ""; docify(text); t << ""; } void HtmlGenerator::startGroupHeader() { t << "

    "; } void HtmlGenerator::endGroupHeader() { t << "

    " << endl; } void HtmlGenerator::writeSection(const char *lab,const char *title,bool sub) { t << ""; if (sub) t << "

    "; else t << "

    "; docify(title); if (sub) t << "

    "; else t << ""; t << "
    " << endl; } void HtmlGenerator::writeSectionRef(const char *name,const char *lab, const char *title) { QString refName=name; if (refName.right(5)!=".html") refName+=".html"; t << """; docify(title); t << """; } void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab, const char *title) { QString refName=name; if (refName.right(5)!=".html") refName+=".html"; t << ""; docify(title); t << ""; } //void HtmlGenerator::docify(const char *str) //{ // docifyStatic(t,str); //} //void HtmlGenerator::docifyStatic(QTextStream &t,const char *str) void HtmlGenerator::docify(const char *str) { if (str) { const char *p=str; char c; while (*p) { c=*p++; switch(c) { case '<': t << "<"; break; case '>': t << ">"; break; case '&': t << "&"; break; case '\\': if (*p=='<') { t << "<"; p++; } else if (*p=='>') { t << ">"; p++; } else t << "\\"; break; default: t << c; } } } } void HtmlGenerator::codify(const char *str) { docify(str); } void HtmlGenerator::writeChar(char c) { char cs[2]; cs[0]=c; cs[1]=0; docify(cs); } void HtmlGenerator::startClassDiagram() { t << "

    "; } void HtmlGenerator::endClassDiagram(ClassDiagram &d, const char *fileName,const char *name) { t << ":\n

    " << endl << "

    " << endl; d.writeImageMap(t,dir,fileName); } void HtmlGenerator::startColorFont(uchar red,uchar green,uchar blue) { QString colorString; colorString.sprintf("%02x%02x%02x",red,green,blue); t << ""; } void HtmlGenerator::endColorFont() { t << ""; } void HtmlGenerator::writeFormula(const char *n,const char *text) { if (text && text[0]=='\\') t << "

    " << endl; t << "" << endl; if (text && text[0]=='\\') t << "

    " << endl; }