summaryrefslogtreecommitdiffstats
path: root/src/htmlgen.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-12-25 19:21:37 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-12-25 19:21:37 (GMT)
commit5970cae1c37dc07acb7fd495520e83f20171a821 (patch)
tree7054df5dad72ff0d1b1a97b2ffe17aa638fa9778 /src/htmlgen.cpp
parentb294263f69f56feee519fb95d71e504ea7682c5e (diff)
downloadDoxygen-5970cae1c37dc07acb7fd495520e83f20171a821.zip
Doxygen-5970cae1c37dc07acb7fd495520e83f20171a821.tar.gz
Doxygen-5970cae1c37dc07acb7fd495520e83f20171a821.tar.bz2
Minor fixes
Avoid code duplication by adding function addHtmlExtensionIfMissing() and avoid member shadowing by using 'm_' prefix for member variables
Diffstat (limited to 'src/htmlgen.cpp')
-rw-r--r--src/htmlgen.cpp97
1 files changed, 47 insertions, 50 deletions
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 047eec8..bf52eed 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -752,7 +752,7 @@ void HtmlCodeGenerator::_writeCodeLink(const char *className,
}
m_t << "href=\"";
m_t << externalRef(m_relPath,ref,TRUE);
- if (f) m_t << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension);
+ if (f) m_t << addHtmlExtensionIfMissing(f);
if (anchor) m_t << "#" << anchor;
m_t << "\"";
if (tooltip) m_t << " title=\"" << convertToHtml(tooltip) << "\"";
@@ -773,7 +773,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo,
{
m_t << "<a href=\"";
m_t << externalRef(m_relPath,docInfo.ref,TRUE);
- m_t << docInfo.url << (hasExtension(docInfo.url) ? "" : Doxygen::htmlFileExtension);
+ m_t << addHtmlExtensionIfMissing(docInfo.url);
if (!docInfo.anchor.isEmpty())
{
m_t << "#" << docInfo.anchor;
@@ -805,7 +805,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo,
{
m_t << "<a href=\"";
m_t << externalRef(m_relPath,defInfo.ref,TRUE);
- m_t << defInfo.url << (hasExtension(docInfo.url) ? "" : Doxygen::htmlFileExtension);
+ m_t << addHtmlExtensionIfMissing(defInfo.url);
if (!defInfo.anchor.isEmpty())
{
m_t << "#" << defInfo.anchor;
@@ -826,7 +826,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo,
{
m_t << "<a href=\"";
m_t << externalRef(m_relPath,declInfo.ref,TRUE);
- m_t << declInfo.url << (hasExtension(docInfo.url) ? "" : Doxygen::htmlFileExtension);
+ m_t << addHtmlExtensionIfMissing(declInfo.url);
if (!declInfo.anchor.isEmpty())
{
m_t << "#" << declInfo.anchor;
@@ -893,7 +893,7 @@ void HtmlCodeGenerator::writeCodeAnchor(const char *anchor)
HtmlGenerator::HtmlGenerator() : OutputGenerator()
{
- dir=Config_getString(HTML_OUTPUT);
+ m_dir=Config_getString(HTML_OUTPUT);
m_emptySection=FALSE;
m_sectionCount=0;
}
@@ -1086,18 +1086,17 @@ void HtmlGenerator::startFile(const char *name,const char *,
const char *title)
{
//printf("HtmlGenerator::startFile(%s)\n",name);
- QCString fileName=name;
- lastTitle=title;
- relPath = relativePathToRoot(fileName);
+ m_relPath = relativePathToRoot(name);
+ QCString fileName = addHtmlExtensionIfMissing(name);
+ m_lastTitle=title;
- fileName+=(hasExtension(fileName) ? "" : Doxygen::htmlFileExtension);
startPlainFile(fileName);
m_codeGen.setTextStream(t);
- m_codeGen.setRelativePath(relPath);
+ m_codeGen.setRelativePath(m_relPath);
Doxygen::indexList->addIndexFile(fileName);
- lastFile = fileName;
- t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title)),relPath);
+ m_lastFile = fileName;
+ t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title)),m_relPath);
t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen "
<< getVersion() << " -->" << endl;
@@ -1108,7 +1107,7 @@ void HtmlGenerator::startFile(const char *name,const char *,
t << "<script type=\"text/javascript\">\n";
t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */\n";
t << "var searchBox = new SearchBox(\"searchBox\", \""
- << relPath<< "search\",false,'" << theTranslator->trSearch() << "');\n";
+ << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "');\n";
t << "/* @license-end */\n";
t << "</script>\n";
}
@@ -1116,13 +1115,12 @@ void HtmlGenerator::startFile(const char *name,const char *,
m_sectionCount=0;
}
-void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &relPath)
+void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &)
{
static bool searchEngine = Config_getBool(SEARCHENGINE);
static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
if (searchEngine && !serverBasedSearch)
{
- (void)relPath;
t << "<!-- window showing the filter options -->\n";
t << "<div id=\"MSearchSelectWindow\"\n";
t << " onmouseover=\"return searchBox.OnSearchSelectShow()\"\n";
@@ -1142,7 +1140,7 @@ void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &relPath)
void HtmlGenerator::writeSearchInfo()
{
- writeSearchInfo(t,relPath);
+ writeSearchInfo(t,m_relPath);
}
@@ -1172,7 +1170,7 @@ QCString HtmlGenerator::writeLogoAsString(const char *path)
void HtmlGenerator::writeLogo()
{
- t << writeLogoAsString(relPath);
+ t << writeLogoAsString(m_relPath);
}
void HtmlGenerator::writePageFooter(FTextStream &t,const QCString &lastTitle,
@@ -1186,7 +1184,7 @@ void HtmlGenerator::writeFooter(const char *navPath)
// Currently only tooltips in HTML
TooltipManager::instance()->writeTooltips(m_codeGen);
- writePageFooter(t,lastTitle,relPath,navPath);
+ writePageFooter(t,m_lastTitle,m_relPath,navPath);
}
void HtmlGenerator::endFile()
@@ -1323,8 +1321,8 @@ void HtmlGenerator::startIndexItem(const char *ref,const char *f)
t << "<a class=\"el\" ";
}
t << "href=\"";
- t << externalRef(relPath,ref,TRUE);
- if (f) t << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension);
+ t << externalRef(m_relPath,ref,TRUE);
+ if (f) t << addHtmlExtensionIfMissing(f);
t << "\">";
}
else
@@ -1351,7 +1349,7 @@ void HtmlGenerator::writeStartAnnoItem(const char *,const char *f,
{
t << "<li>";
if (path) docify(path);
- t << "<a class=\"el\" href=\"" << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension) << "\">";
+ t << "<a class=\"el\" href=\"" << addHtmlExtensionIfMissing(f) << "\">";
docify(name);
t << "</a> ";
}
@@ -1369,8 +1367,8 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f,
t << "<a class=\"el\" ";
}
t << "href=\"";
- t << externalRef(relPath,ref,TRUE);
- if (f) t << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension);
+ t << externalRef(m_relPath,ref,TRUE);
+ if (f) t << addHtmlExtensionIfMissing(f);
if (anchor) t << "#" << anchor;
t << "\">";
docify(name);
@@ -1380,7 +1378,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f,
void HtmlGenerator::startTextLink(const char *f,const char *anchor)
{
t << "<a href=\"";
- if (f) t << relPath << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension);
+ if (f) t << m_relPath << addHtmlExtensionIfMissing(f);
if (anchor) t << "#" << anchor;
t << "\">";
}
@@ -1583,7 +1581,7 @@ static void endSectionContent(FTextStream &t)
void HtmlGenerator::startClassDiagram()
{
- startSectionHeader(t,relPath,m_sectionCount);
+ startSectionHeader(t,m_relPath,m_sectionCount);
}
void HtmlGenerator::endClassDiagram(const ClassDiagram &d,
@@ -1596,12 +1594,12 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d,
startSectionSummary(t,m_sectionCount);
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- d.writeImage(tt,dir,relPath,fileName);
+ d.writeImage(tt,m_dir,m_relPath,fileName);
if (!result.isEmpty())
{
t << " <div class=\"center\">" << endl;
t << " <img src=\"";
- t << relPath << fileName << ".png\" usemap=\"#" << convertToId(name);
+ t << m_relPath << fileName << ".png\" usemap=\"#" << convertToId(name);
t << "_map\" alt=\"\"/>" << endl;
t << " <map id=\"" << convertToId(name);
t << "_map\" name=\"" << convertToId(name);
@@ -1614,7 +1612,7 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d,
{
t << " <div class=\"center\">" << endl;
t << " <img src=\"";
- t << relPath << fileName << ".png\" alt=\"\"/>" << endl;
+ t << m_relPath << fileName << ".png\" alt=\"\"/>" << endl;
t << " </div>";
}
endSectionContent(t);
@@ -1967,7 +1965,7 @@ void HtmlGenerator::endMemberDoc(bool hasArgs)
void HtmlGenerator::startDotGraph()
{
- startSectionHeader(t,relPath,m_sectionCount);
+ startSectionHeader(t,m_relPath,m_sectionCount);
}
void HtmlGenerator::endDotGraph(DotClassGraph &g)
@@ -1979,11 +1977,11 @@ void HtmlGenerator::endDotGraph(DotClassGraph &g)
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,TRUE,m_sectionCount);
+ g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,TRUE,m_sectionCount);
if (generateLegend && !umlLook)
{
t << "<center><span class=\"legend\">[";
- startHtmlLink(relPath+"graph_legend"+Doxygen::htmlFileExtension);
+ startHtmlLink(m_relPath+"graph_legend"+Doxygen::htmlFileExtension);
t << theTranslator->trLegend();
endHtmlLink();
t << "]</span></center>";
@@ -1995,7 +1993,7 @@ void HtmlGenerator::endDotGraph(DotClassGraph &g)
void HtmlGenerator::startInclDepGraph()
{
- startSectionHeader(t,relPath,m_sectionCount);
+ startSectionHeader(t,m_relPath,m_sectionCount);
}
void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g)
@@ -2005,7 +2003,7 @@ void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g)
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount);
+ g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount);
endSectionContent(t);
m_sectionCount++;
@@ -2013,7 +2011,7 @@ void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g)
void HtmlGenerator::startGroupCollaboration()
{
- startSectionHeader(t,relPath,m_sectionCount);
+ startSectionHeader(t,m_relPath,m_sectionCount);
}
void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g)
@@ -2023,7 +2021,7 @@ void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g)
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount);
+ g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount);
endSectionContent(t);
m_sectionCount++;
@@ -2031,7 +2029,7 @@ void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g)
void HtmlGenerator::startCallGraph()
{
- startSectionHeader(t,relPath,m_sectionCount);
+ startSectionHeader(t,m_relPath,m_sectionCount);
}
void HtmlGenerator::endCallGraph(DotCallGraph &g)
@@ -2041,7 +2039,7 @@ void HtmlGenerator::endCallGraph(DotCallGraph &g)
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount);
+ g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount);
endSectionContent(t);
m_sectionCount++;
@@ -2049,7 +2047,7 @@ void HtmlGenerator::endCallGraph(DotCallGraph &g)
void HtmlGenerator::startDirDepGraph()
{
- startSectionHeader(t,relPath,m_sectionCount);
+ startSectionHeader(t,m_relPath,m_sectionCount);
}
void HtmlGenerator::endDirDepGraph(DotDirDeps &g)
@@ -2059,7 +2057,7 @@ void HtmlGenerator::endDirDepGraph(DotDirDeps &g)
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount);
+ g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount);
endSectionContent(t);
m_sectionCount++;
@@ -2067,7 +2065,7 @@ void HtmlGenerator::endDirDepGraph(DotDirDeps &g)
void HtmlGenerator::writeGraphicalHierarchy(DotGfxHierarchyTable &g)
{
- g.writeGraph(t,dir,fileName);
+ g.writeGraph(t,m_dir,m_fileName);
}
void HtmlGenerator::startMemberGroupHeader(bool)
@@ -2544,7 +2542,7 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa
"<script type=\"text/javascript\">\n"
"/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */\n"
"$(document).ready(function(){initNavTree('") +
- QCString(name) + (hasExtension(name) ? "" : Doxygen::htmlFileExtension) +
+ QCString(addHtmlExtensionIfMissing(name)) +
QCString("','") + relpath +
QCString("'); initResizable(); });\n"
"/* @license-end */\n"
@@ -2556,12 +2554,12 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa
void HtmlGenerator::writeSplitBar(const char *name)
{
- t << writeSplitBarAsString(name,relPath);
+ t << writeSplitBarAsString(name,m_relPath);
}
void HtmlGenerator::writeNavigationPath(const char *s)
{
- t << substitute(s,"$relpath^",relPath);
+ t << substitute(s,"$relpath^",m_relPath);
}
void HtmlGenerator::startContents()
@@ -2586,7 +2584,7 @@ void HtmlGenerator::endPageDoc()
void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const char *file)
{
- writeDefaultQuickLinks(t,compact,hli,file,relPath);
+ writeDefaultQuickLinks(t,compact,hli,file,m_relPath);
}
// PHP based search script
@@ -2975,18 +2973,18 @@ void HtmlGenerator::writeInheritedSectionTitle(
{
classLink+= externalLinkTarget();
classLink += " href=\"";
- classLink+= externalRef(relPath,ref,TRUE);
+ classLink+= externalRef(m_relPath,ref,TRUE);
}
else
{
classLink += "href=\"";
- classLink+=relPath;
+ classLink+=m_relPath;
}
- classLink=classLink+file+(hasExtension(file) ? "" : Doxygen::htmlFileExtension)+a;
+ classLink=classLink+addHtmlExtensionIfMissing(file)+a;
classLink+=QCString("\">")+convertToHtml(name,FALSE)+"</a>";
t << "<tr class=\"inherit_header " << id << "\">"
<< "<td colspan=\"2\" onclick=\"javascript:toggleInherit('" << id << "')\">"
- << "<img src=\"" << relPath << "closed.png\" alt=\"-\"/>&#160;"
+ << "<img src=\"" << m_relPath << "closed.png\" alt=\"-\"/>&#160;"
<< theTranslator->trInheritedFrom(convertToHtml(title,FALSE),classLink)
<< "</td></tr>" << endl;
}
@@ -3004,8 +3002,7 @@ void HtmlGenerator::writeSummaryLink(const char *file,const char *anchor,const c
t << "<a href=\"";
if (file)
{
- t << relPath << file;
- t << (hasExtension(file) ? "" : Doxygen::htmlFileExtension);
+ t << m_relPath << addHtmlExtensionIfMissing(file);
}
else
{