Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Avoid code duplication by adding function addHtmlExtensionIfMissing() and
avoid member shadowing by using 'm_' prefix for member variables
  • Loading branch information
doxygen committed Dec 25, 2019
1 parent b294263 commit 5970cae
Show file tree
Hide file tree
Showing 17 changed files with 316 additions and 362 deletions.
2 changes: 1 addition & 1 deletion src/definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void DefinitionImpl::writeDocAnchorsToTagFile(FTextStream &tagFile) const
{
//printf("write an entry!\n");
if (definitionType()==TypeMember) tagFile << " ";
tagFile << " <docanchor file=\"" << si->fileName << (hasExtension(si->fileName) ? "" : Doxygen::htmlFileExtension) << "\"";
tagFile << " <docanchor file=\"" << addHtmlExtensionIfMissing(si->fileName) << "\"";
if (!si->title.isEmpty())
{
tagFile << " title=\"" << convertToXML(si->title) << "\"";
Expand Down
14 changes: 7 additions & 7 deletions src/docbookgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void DocbookCodeGenerator::endCodeFragment()
DocbookGenerator::DocbookGenerator() : OutputGenerator()
{
DB_GEN_C
dir=Config_getString(DOCBOOK_OUTPUT);
m_dir=Config_getString(DOCBOOK_OUTPUT);
//insideTabbing=FALSE;
//firstDescItem=TRUE;
//disableLinks=FALSE;
Expand Down Expand Up @@ -917,7 +917,7 @@ DB_GEN_C
t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\""
<< relPath << fileName << ".png\">" << "</imagedata>" << endl;
t << " </imageobject>" << endl;
d.writeImage(t,dir,relPath,fileName,FALSE);
d.writeImage(t,m_dir,relPath,fileName,FALSE);
t << " </mediaobject>" << endl;
t << " </informalfigure>" << endl;
t << "</para>" << endl;
Expand Down Expand Up @@ -1108,7 +1108,7 @@ DB_GEN_C
void DocbookGenerator::endGroupCollaboration(DotGroupCollaboration &g)
{
DB_GEN_C
g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE);
g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),m_fileName,relPath,FALSE);
}
void DocbookGenerator::startDotGraph()
{
Expand All @@ -1117,7 +1117,7 @@ DB_GEN_C
void DocbookGenerator::endDotGraph(DotClassGraph &g)
{
DB_GEN_C
g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,TRUE,FALSE);
g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),m_fileName,relPath,TRUE,FALSE);
}
void DocbookGenerator::startInclDepGraph()
{
Expand All @@ -1126,7 +1126,7 @@ DB_GEN_C
void DocbookGenerator::endInclDepGraph(DotInclDepGraph &g)
{
DB_GEN_C
QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), fileName,relPath,FALSE);
QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), m_fileName,relPath,FALSE);
}
void DocbookGenerator::startCallGraph()
{
Expand All @@ -1135,7 +1135,7 @@ DB_GEN_C
void DocbookGenerator::endCallGraph(DotCallGraph &g)
{
DB_GEN_C
QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), fileName,relPath,FALSE);
QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), m_fileName,relPath,FALSE);
}
void DocbookGenerator::startDirDepGraph()
{
Expand All @@ -1144,7 +1144,7 @@ DB_GEN_C
void DocbookGenerator::endDirDepGraph(DotDirDeps &g)
{
DB_GEN_C
QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), fileName,relPath,FALSE);
QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), m_fileName,relPath,FALSE);
}
void DocbookGenerator::startMemberDocList()
{
Expand Down
6 changes: 3 additions & 3 deletions src/docbookgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ class DocbookGenerator : public OutputGenerator
// generic generator methods
///////////////////////////////////////////////////////////////
void enable()
{ if (genStack->top()) active=*genStack->top(); else active=TRUE; }
void disable() { active=FALSE; }
{ if (m_genStack->top()) m_active=*m_genStack->top(); else m_active=TRUE; }
void disable() { m_active=FALSE; }
void enableIf(OutputType o) { if (o==Docbook) enable(); }
void disableIf(OutputType o) { if (o==Docbook) disable(); }
void disableIfNot(OutputType o) { if (o!=Docbook) disable(); }
bool isEnabled(OutputType o) { return (o==Docbook && active); }
bool isEnabled(OutputType o) { return (o==Docbook && m_active); }
OutputGenerator *get(OutputType o) { return (o==Docbook) ? this : 0; }

// --- CodeOutputInterface
Expand Down
2 changes: 1 addition & 1 deletion src/filedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile)
tagFile << " <compound kind=\"file\">" << endl;
tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
tagFile << " <path>" << convertToXML(getPath()) << "</path>" << endl;
tagFile << " <filename>" << convertToXML(getOutputFileBase()) << (hasExtension(getOutputFileBase()) ? "" : Doxygen::htmlFileExtension) << "</filename>" << endl;
tagFile << " <filename>" << convertToXML(addHtmlExtensionIfMissing(getOutputFileBase())) << "</filename>" << endl;
if (m_includeList && m_includeList->count()>0)
{
QListIterator<IncludeInfo> ili(*m_includeList);
Expand Down
7 changes: 3 additions & 4 deletions src/htmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1912,8 +1912,7 @@ void HtmlDocVisitor::visitPost(DocRef *ref)
void HtmlDocVisitor::visitPre(DocSecRefItem *ref)
{
if (m_hide) return;
QCString refName=ref->file();
refName+=(hasExtension(refName) ? "" : Doxygen::htmlFileExtension);
QCString refName=addHtmlExtensionIfMissing(ref->file());
m_t << "<li><a href=\"" << refName << "#" << ref->anchor() << "\">";

}
Expand Down Expand Up @@ -2094,7 +2093,7 @@ void HtmlDocVisitor::visitPre(DocXRefItem *x)
{
m_t << "<dl" << getDirHtmlClassOfNode(getTextDirByConfig(x), x->key())
<< "><dt><b><a class=\"el\" href=\""
<< x->relPath() << x->file() << (hasExtension(x->file()) ? "" : Doxygen::htmlFileExtension)
<< x->relPath() << addHtmlExtensionIfMissing(x->file())
<< "#" << x->anchor() << "\">";
}
else
Expand Down Expand Up @@ -2260,7 +2259,7 @@ void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file,
m_t << externalRef(relPath,ref,TRUE);
if (!file.isEmpty())
{
m_t << file << (hasExtension(file) ? "" : Doxygen::htmlFileExtension);
m_t << addHtmlExtensionIfMissing(file);
}
if (!anchor.isEmpty()) m_t << "#" << anchor;
m_t << "\"";
Expand Down
Loading

0 comments on commit 5970cae

Please sign in to comment.