Skip to content

Commit 8b14bc5

Browse files
committed
Refactoring: better split output generator and code generator
1 parent 875558c commit 8b14bc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1023
-947
lines changed

addon/doxyapp/doxyapp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class XRefDummyCodeGenerator : public CodeOutputInterface
4747

4848
// these are just null functions, they can be used to produce a syntax highlighted
4949
// and cross-linked version of the source code, but who needs that anyway ;-)
50+
OutputType type() const override { return OutputType::Null; }
5051
void codify(const QCString &) override {}
5152
void writeCodeLink(CodeSymbolType,const QCString &,const QCString &,const QCString &,const QCString &,const QCString &) override {}
5253
void writeLineNumber(const QCString &,const QCString &,const QCString &,int,bool) override {}

addon/doxyparse/doxyparse.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Doxyparse : public CodeOutputInterface
5353

5454
// these are just null functions, they can be used to produce a syntax highlighted
5555
// and cross-linked version of the source code, but who needs that anyway ;-)
56+
OutputType type() const override { return OutputType::Null; }
5657
void codify(const QCString &) override {}
5758
void writeCodeLink(CodeSymbolType,const QCString &,const QCString &,const QCString &,const QCString &,const QCString &) override {}
5859
void startCodeLine(bool) override {}

src/classdef.cpp

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,16 +1360,16 @@ void ClassDefImpl::writeBriefDescription(OutputList &ol,bool exampleFlag) const
13601360
{
13611361
ol.startParagraph();
13621362
ol.pushGeneratorState();
1363-
ol.disableAllBut(OutputGenerator::Man);
1363+
ol.disableAllBut(OutputType::Man);
13641364
ol.writeString(" - ");
13651365
ol.popGeneratorState();
13661366
ol.generateDoc(briefFile(),briefLine(),this,0,
13671367
briefDescription(),TRUE,FALSE,QCString(),
13681368
TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
13691369
ol.pushGeneratorState();
1370-
ol.disable(OutputGenerator::RTF);
1370+
ol.disable(OutputType::RTF);
13711371
ol.writeString(" \n");
1372-
ol.enable(OutputGenerator::RTF);
1372+
ol.enable(OutputType::RTF);
13731373
ol.popGeneratorState();
13741374

13751375
if (hasDetailedDescription() || exampleFlag)
@@ -1403,7 +1403,7 @@ void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) const
14031403
!documentation().isEmpty())
14041404
{
14051405
ol.pushGeneratorState();
1406-
ol.disable(OutputGenerator::Html);
1406+
ol.disable(OutputType::Html);
14071407
ol.writeString("\n\n");
14081408
ol.popGeneratorState();
14091409
}
@@ -1448,20 +1448,20 @@ void ClassDefImpl::writeDetailedDescription(OutputList &ol, const QCString &/*pa
14481448
if (hasDetailedDescription() || exampleFlag)
14491449
{
14501450
ol.pushGeneratorState();
1451-
ol.disable(OutputGenerator::Html);
1451+
ol.disable(OutputType::Html);
14521452
ol.writeRuler();
14531453
ol.popGeneratorState();
14541454

14551455
ol.pushGeneratorState();
1456-
ol.disableAllBut(OutputGenerator::Html);
1456+
ol.disableAllBut(OutputType::Html);
14571457
ol.writeAnchor(QCString(),anchor.isEmpty() ? QCString("details") : anchor);
14581458
ol.popGeneratorState();
14591459

14601460
if (!anchor.isEmpty())
14611461
{
14621462
ol.pushGeneratorState();
1463-
ol.disable(OutputGenerator::Html);
1464-
ol.disable(OutputGenerator::Man);
1463+
ol.disable(OutputType::Html);
1464+
ol.disable(OutputType::Man);
14651465
ol.writeAnchor(getOutputFileBase(),anchor);
14661466
ol.popGeneratorState();
14671467
}
@@ -1513,19 +1513,19 @@ QCString ClassDefImpl::generatedFromFiles() const
15131513
void ClassDefImpl::showUsedFiles(OutputList &ol) const
15141514
{
15151515
ol.pushGeneratorState();
1516-
ol.disable(OutputGenerator::Man);
1516+
ol.disable(OutputType::Man);
15171517

15181518

15191519
ol.writeRuler();
15201520
ol.pushGeneratorState();
1521-
ol.disableAllBut(OutputGenerator::Docbook);
1521+
ol.disableAllBut(OutputType::Docbook);
15221522
ol.startParagraph();
15231523
ol.parseText(generatedFromFiles());
15241524
ol.endParagraph();
15251525
ol.popGeneratorState();
1526-
ol.disable(OutputGenerator::Docbook);
1526+
ol.disable(OutputType::Docbook);
15271527
ol.parseText(generatedFromFiles());
1528-
ol.enable(OutputGenerator::Docbook);
1528+
ol.enable(OutputType::Docbook);
15291529

15301530
bool first=TRUE;
15311531
for (const auto &fd : m_impl->files)
@@ -1551,7 +1551,7 @@ void ClassDefImpl::showUsedFiles(OutputList &ol) const
15511551

15521552
// for HTML
15531553
ol.pushGeneratorState();
1554-
ol.disableAllBut(OutputGenerator::Html);
1554+
ol.disableAllBut(OutputType::Html);
15551555
if (fd->generateSourceFile())
15561556
{
15571557
ol.writeObjectLink(QCString(),fd->getSourceFileBase(),QCString(),fname);
@@ -1568,7 +1568,7 @@ void ClassDefImpl::showUsedFiles(OutputList &ol) const
15681568

15691569
// for other output formats
15701570
ol.pushGeneratorState();
1571-
ol.disable(OutputGenerator::Html);
1571+
ol.disable(OutputType::Html);
15721572
if (fd->isLinkable())
15731573
{
15741574
ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fname);
@@ -1624,7 +1624,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const
16241624
else if (!inheritanceGraph.isTrivial())
16251625
{
16261626
ol.pushGeneratorState();
1627-
ol.disable(OutputGenerator::Man);
1627+
ol.disable(OutputType::Man);
16281628
ol.startDotGraph();
16291629
ol.parseText(theTranslator->trClassDiagram(displayName()));
16301630
ol.endDotGraph(inheritanceGraph);
@@ -1637,17 +1637,17 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const
16371637
{
16381638
ClassDiagram diagram(this); // create a diagram of this class.
16391639
ol.startClassDiagram();
1640-
ol.disable(OutputGenerator::Man);
1640+
ol.disable(OutputType::Man);
16411641
ol.parseText(theTranslator->trClassDiagram(displayName()));
1642-
ol.enable(OutputGenerator::Man);
1642+
ol.enable(OutputType::Man);
16431643
ol.endClassDiagram(diagram,getOutputFileBase(),displayName());
16441644
renderDiagram = TRUE;
16451645
}
16461646

16471647
if (renderDiagram) // if we already show the inheritance relations graphically,
16481648
// then hide the text version
16491649
{
1650-
ol.disableAllBut(OutputGenerator::Man);
1650+
ol.disableAllBut(OutputType::Man);
16511651
}
16521652

16531653
if (!m_impl->inherits.empty())
@@ -1724,7 +1724,7 @@ void ClassDefImpl::writeCollaborationGraph(OutputList &ol) const
17241724
if (!usageImplGraph.isTrivial())
17251725
{
17261726
ol.pushGeneratorState();
1727-
ol.disable(OutputGenerator::Man);
1727+
ol.disable(OutputType::Man);
17281728
ol.startDotGraph();
17291729
ol.parseText(theTranslator->trCollaborationDiagram(displayName()));
17301730
ol.endDotGraph(usageImplGraph);
@@ -1913,10 +1913,10 @@ void ClassDefImpl::writeIncludeFiles(OutputList &ol) const
19131913
else
19141914
ol.docify("<");
19151915
ol.pushGeneratorState();
1916-
ol.disable(OutputGenerator::Html);
1916+
ol.disable(OutputType::Html);
19171917
ol.docify(nm);
1918-
ol.disableAllBut(OutputGenerator::Html);
1919-
ol.enable(OutputGenerator::Html);
1918+
ol.disableAllBut(OutputType::Html);
1919+
ol.enable(OutputType::Html);
19201920
if (m_impl->incInfo->fileDef)
19211921
{
19221922
ol.writeObjectLink(QCString(),m_impl->incInfo->fileDef->includeName(),QCString(),nm);
@@ -1971,7 +1971,7 @@ void ClassDefImpl::startMemberDocumentation(OutputList &ol) const
19711971
//printf("%s: ClassDefImpl::startMemberDocumentation()\n",qPrint(name()));
19721972
if (Config_getBool(SEPARATE_MEMBER_PAGES))
19731973
{
1974-
ol.disable(OutputGenerator::Html);
1974+
ol.disable(OutputType::Html);
19751975
Doxygen::suppressDocWarnings = TRUE;
19761976
}
19771977
}
@@ -1981,7 +1981,7 @@ void ClassDefImpl::endMemberDocumentation(OutputList &ol) const
19811981
//printf("%s: ClassDefImpl::endMemberDocumentation()\n",qPrint(name()));
19821982
if (Config_getBool(SEPARATE_MEMBER_PAGES))
19831983
{
1984-
ol.enable(OutputGenerator::Html);
1984+
ol.enable(OutputType::Html);
19851985
Doxygen::suppressDocWarnings = FALSE;
19861986
}
19871987
}
@@ -2009,7 +2009,7 @@ void ClassDefImpl::endMemberDeclarations(OutputList &ol) const
20092009
void ClassDefImpl::writeAuthorSection(OutputList &ol) const
20102010
{
20112011
ol.pushGeneratorState();
2012-
ol.disableAllBut(OutputGenerator::Man);
2012+
ol.disableAllBut(OutputType::Man);
20132013
ol.writeString("\n");
20142014
ol.startGroupHeader();
20152015
ol.parseText(theTranslator->trAuthor(TRUE,TRUE));
@@ -2022,7 +2022,7 @@ void ClassDefImpl::writeAuthorSection(OutputList &ol) const
20222022
void ClassDefImpl::writeSummaryLinks(OutputList &ol) const
20232023
{
20242024
ol.pushGeneratorState();
2025-
ol.disableAllBut(OutputGenerator::Html);
2025+
ol.disableAllBut(OutputType::Html);
20262026
bool first=TRUE;
20272027
SrcLangExt lang = getLanguage();
20282028

@@ -2195,7 +2195,7 @@ void ClassDefImpl::writeInlineDocumentation(OutputList &ol) const
21952195

21962196
// part 1a
21972197
ol.pushGeneratorState();
2198-
ol.disableAllBut(OutputGenerator::Html);
2198+
ol.disableAllBut(OutputType::Html);
21992199
{ // only HTML only
22002200
ol.writeAnchor(QCString(),anchor());
22012201
ol.startMemberDoc(QCString(),QCString(),anchor(),name(),1,1,FALSE);
@@ -2210,16 +2210,16 @@ void ClassDefImpl::writeInlineDocumentation(OutputList &ol) const
22102210

22112211
// part 1b
22122212
ol.pushGeneratorState();
2213-
ol.disable(OutputGenerator::Html);
2214-
ol.disable(OutputGenerator::Man);
2213+
ol.disable(OutputType::Html);
2214+
ol.disable(OutputType::Man);
22152215
{ // for LaTeX/RTF only
22162216
ol.writeAnchor(getOutputFileBase(),anchor());
22172217
}
22182218
ol.popGeneratorState();
22192219

22202220
// part 1c
22212221
ol.pushGeneratorState();
2222-
ol.disable(OutputGenerator::Html);
2222+
ol.disable(OutputType::Html);
22232223
{
22242224
// for LaTeX/RTF/Man
22252225
ol.startGroupHeader(1);
@@ -2297,7 +2297,7 @@ void ClassDefImpl::writeInlineDocumentation(OutputList &ol) const
22972297

22982298
// part 3: close the block
22992299
ol.pushGeneratorState();
2300-
ol.disableAllBut(OutputGenerator::Html);
2300+
ol.disableAllBut(OutputType::Html);
23012301
{ // HTML only
23022302
ol.endIndent();
23032303
}
@@ -2314,7 +2314,7 @@ void ClassDefImpl::writeMoreLink(OutputList &ol,const QCString &anchor) const
23142314

23152315
// HTML only
23162316
ol.pushGeneratorState();
2317-
ol.disableAllBut(OutputGenerator::Html);
2317+
ol.disableAllBut(OutputType::Html);
23182318
ol.docify(" ");
23192319
ol.startTextLink(getOutputFileBase(),
23202320
anchor.isEmpty() ? QCString("details") : anchor);
@@ -2326,23 +2326,23 @@ void ClassDefImpl::writeMoreLink(OutputList &ol,const QCString &anchor) const
23262326
{
23272327
ol.pushGeneratorState();
23282328
// LaTeX + RTF
2329-
ol.disable(OutputGenerator::Html);
2330-
ol.disable(OutputGenerator::Man);
2331-
ol.disable(OutputGenerator::Docbook);
2329+
ol.disable(OutputType::Html);
2330+
ol.disable(OutputType::Man);
2331+
ol.disable(OutputType::Docbook);
23322332
if (!(usePDFLatex && pdfHyperlinks))
23332333
{
2334-
ol.disable(OutputGenerator::Latex);
2334+
ol.disable(OutputType::Latex);
23352335
}
23362336
if (!rtfHyperlinks)
23372337
{
2338-
ol.disable(OutputGenerator::RTF);
2338+
ol.disable(OutputType::RTF);
23392339
}
23402340
ol.docify(" ");
23412341
ol.startTextLink(getOutputFileBase(), anchor);
23422342
ol.parseText(theTranslator->trMore());
23432343
ol.endTextLink();
23442344
// RTF only
2345-
ol.disable(OutputGenerator::Latex);
2345+
ol.disable(OutputType::Latex);
23462346
ol.writeString("\\par");
23472347
ol.popGeneratorState();
23482348
}
@@ -2480,7 +2480,7 @@ void ClassDefImpl::addClassAttributes(OutputList &ol) const
24802480
if (getLanguage()==SrcLangExt_IDL && isPublished()) sl.push_back("published");
24812481

24822482
ol.pushGeneratorState();
2483-
ol.disableAllBut(OutputGenerator::Html);
2483+
ol.disableAllBut(OutputType::Html);
24842484
if (!sl.empty())
24852485
{
24862486
ol.startLabels();
@@ -2752,7 +2752,7 @@ void ClassDefImpl::writeMemberPages(OutputList &ol) const
27522752
///////////////////////////////////////////////////////////////////////////
27532753

27542754
ol.pushGeneratorState();
2755-
ol.disableAllBut(OutputGenerator::Html);
2755+
ol.disableAllBut(OutputType::Html);
27562756

27572757
for (const auto &ml : m_impl->memberLists)
27582758
{
@@ -2842,7 +2842,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const
28422842
if (m_impl->allMemberNameInfoLinkedMap.empty() || cOpt) return;
28432843
// only for HTML
28442844
ol.pushGeneratorState();
2845-
ol.disableAllBut(OutputGenerator::Html);
2845+
ol.disableAllBut(OutputType::Html);
28462846

28472847
HighlightedItem hli;
28482848
if (sliceOpt)
@@ -4447,7 +4447,7 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet &
44474447
const ClassDef *inheritedFrom,bool invert,bool showAlways) const
44484448
{
44494449
ol.pushGeneratorState();
4450-
ol.disableAllBut(OutputGenerator::Html);
4450+
ol.disableAllBut(OutputType::Html);
44514451
int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE);
44524452
bool process = count>0;
44534453
//printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n",

src/code.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
25292529
{
25302530
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
25312531
bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
2532-
yyextra->tooltipManager.addTooltip(ol,d);
2532+
yyextra->tooltipManager.addTooltip(d);
25332533
QCString ref = d->getReference();
25342534
QCString file = d->getOutputFileBase();
25352535
QCString anchor = d->anchor();

0 commit comments

Comments
 (0)