Skip to content

Commit 7641ce9

Browse files
committed
Refactoring: Move global index counters into a Index singleton class
1 parent 2182574 commit 7641ce9

22 files changed

+769
-689
lines changed

src/classdef.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,24 +2700,24 @@ void ClassDefImpl::writeDocumentation(OutputList &ol) const
27002700
{
27012701
if (compoundType()==Interface)
27022702
{
2703-
hli = HLI_InterfaceVisible;
2703+
hli = HighlightedItem::InterfaceVisible;
27042704
}
27052705
else if (compoundType()==Struct)
27062706
{
2707-
hli = HLI_StructVisible;
2707+
hli = HighlightedItem::StructVisible;
27082708
}
27092709
else if (compoundType()==Exception)
27102710
{
2711-
hli = HLI_ExceptionVisible;
2711+
hli = HighlightedItem::ExceptionVisible;
27122712
}
27132713
else
27142714
{
2715-
hli = HLI_ClassVisible;
2715+
hli = HighlightedItem::ClassVisible;
27162716
}
27172717
}
27182718
else
27192719
{
2720-
hli = HLI_ClassVisible;
2720+
hli = HighlightedItem::ClassVisible;
27212721
}
27222722

27232723
startFile(ol,getOutputFileBase(),name(),pageTitle,hli,!generateTreeView);
@@ -2849,24 +2849,24 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const
28492849
{
28502850
if (compoundType()==Interface)
28512851
{
2852-
hli = HLI_InterfaceVisible;
2852+
hli = HighlightedItem::InterfaceVisible;
28532853
}
28542854
else if (compoundType()==Struct)
28552855
{
2856-
hli = HLI_StructVisible;
2856+
hli = HighlightedItem::StructVisible;
28572857
}
28582858
else if (compoundType()==Exception)
28592859
{
2860-
hli = HLI_ExceptionVisible;
2860+
hli = HighlightedItem::ExceptionVisible;
28612861
}
28622862
else
28632863
{
2864-
hli = HLI_ClassVisible;
2864+
hli = HighlightedItem::ClassVisible;
28652865
}
28662866
}
28672867
else
28682868
{
2869-
hli = HLI_ClassVisible;
2869+
hli = HighlightedItem::ClassVisible;
28702870
}
28712871

28722872
QCString memListFile = getMemberListFileName();

src/conceptdef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ void ConceptDefImpl::writeDocumentation(OutputList &ol)
491491
{
492492
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
493493
QCString pageTitle = theTranslator->trConceptReference(displayName());
494-
startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ConceptVisible,!generateTreeView);
494+
startFile(ol,getOutputFileBase(),name(),pageTitle,HighlightedItem::ConceptVisible,!generateTreeView);
495495

496496
// ---- navigation part
497497
if (!generateTreeView)

src/dirdef.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ void DirDefImpl::writeDocumentation(OutputList &ol)
511511
ol.pushGeneratorState();
512512

513513
QCString title=theTranslator->trDirReference(m_dispName);
514-
startFile(ol,getOutputFileBase(),name(),title,HLI_Files,!generateTreeView);
514+
startFile(ol,getOutputFileBase(),name(),title,HighlightedItem::Files,!generateTreeView);
515515

516516
if (!generateTreeView)
517517
{
@@ -890,7 +890,7 @@ void DirRelation::writeDocumentation(OutputList &ol)
890890
QCString title=theTranslator->trDirRelation(
891891
(m_src->displayName()+" -> "+m_dst->dir()->shortName()));
892892
startFile(ol,getOutputFileBase(),getOutputFileBase(),
893-
title,HLI_None,!generateTreeView,m_src->getOutputFileBase());
893+
title,HighlightedItem::None,!generateTreeView,m_src->getOutputFileBase());
894894

895895
if (!generateTreeView)
896896
{

src/docbookgen.cpp

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -373,131 +373,131 @@ DB_GEN_C
373373
m_codeGen.setSourceFileName("");
374374
}
375375

376-
void DocbookGenerator::startIndexSection(IndexSections is)
376+
void DocbookGenerator::startIndexSection(IndexSection is)
377377
{
378-
DB_GEN_C2("IndexSections " << is)
378+
DB_GEN_C2("IndexSection " << is)
379379
switch (is)
380380
{
381-
case isTitlePageStart:
381+
case IndexSection::isTitlePageStart:
382382
{
383383
QCString dbk_projectName = Config_getString(PROJECT_NAME);
384384
m_t << " <info>\n";
385385
m_t << " <title>" << convertToDocBook(dbk_projectName) << "</title>\n";
386386
m_t << " </info>\n";
387387
}
388388
break;
389-
case isTitlePageAuthor:
389+
case IndexSection::isTitlePageAuthor:
390390
break;
391-
case isMainPage:
391+
case IndexSection::isMainPage:
392392
m_t << "<chapter>\n";
393393
m_t << " <title>";
394394
break;
395-
case isModuleIndex:
396-
//Module Index}\n"
395+
case IndexSection::isModuleIndex:
396+
//Module Index\n"
397397
break;
398-
case isDirIndex:
399-
//Directory Index}\n"
398+
case IndexSection::isDirIndex:
399+
//Directory Index\n"
400400
break;
401-
case isNamespaceIndex:
402-
//Namespace Index}\n"
401+
case IndexSection::isNamespaceIndex:
402+
//Namespace Index\n"
403403
break;
404-
case isConceptIndex:
405-
//Concept Index}\n"
404+
case IndexSection::isConceptIndex:
405+
//Concept Index\n"
406406
break;
407-
case isClassHierarchyIndex:
408-
//Hierarchical Index}\n"
407+
case IndexSection::isClassHierarchyIndex:
408+
//Hierarchical Index\n"
409409
break;
410-
case isCompoundIndex:
410+
case IndexSection::isCompoundIndex:
411411
//m_t << "{"; //Class Index}\n"
412412
break;
413-
case isFileIndex:
414-
//Annotated File Index}\n"
413+
case IndexSection::isFileIndex:
414+
//Annotated File Index\n"
415415
break;
416-
case isPageIndex:
417-
//Annotated Page Index}\n"
416+
case IndexSection::isPageIndex:
417+
//Annotated Page Index\n"
418418
break;
419-
case isModuleDocumentation:
419+
case IndexSection::isModuleDocumentation:
420420
m_t << "<chapter>\n";
421421
m_t << " <title>";
422422
break;
423-
case isDirDocumentation:
423+
case IndexSection::isDirDocumentation:
424424
m_t << "<chapter>\n";
425425
m_t << " <title>";
426426
break;
427-
case isNamespaceDocumentation:
427+
case IndexSection::isNamespaceDocumentation:
428428
m_t << "<chapter>\n";
429429
m_t << " <title>";
430430
break;
431-
case isConceptDocumentation:
431+
case IndexSection::isConceptDocumentation:
432432
m_t << "<chapter>\n";
433433
m_t << " <title>";
434434
break;
435-
case isClassDocumentation:
435+
case IndexSection::isClassDocumentation:
436436
m_t << "<chapter>\n";
437437
m_t << " <title>";
438438
break;
439-
case isFileDocumentation:
439+
case IndexSection::isFileDocumentation:
440440
m_t << "<chapter>\n";
441441
m_t << " <title>";
442442
break;
443-
case isExampleDocumentation:
443+
case IndexSection::isExampleDocumentation:
444444
m_t << "<chapter>\n";
445445
m_t << " <title>";
446446
break;
447-
case isPageDocumentation:
447+
case IndexSection::isPageDocumentation:
448448
break;
449-
case isPageDocumentation2:
449+
case IndexSection::isPageDocumentation2:
450450
break;
451-
case isEndIndex:
451+
case IndexSection::isEndIndex:
452452
break;
453453
}
454454
}
455455

456-
void DocbookGenerator::endIndexSection(IndexSections is)
456+
void DocbookGenerator::endIndexSection(IndexSection is)
457457
{
458-
DB_GEN_C2("IndexSections " << is)
458+
DB_GEN_C2("IndexSection " << is)
459459
switch (is)
460460
{
461-
case isTitlePageStart:
461+
case IndexSection::isTitlePageStart:
462462
break;
463-
case isTitlePageAuthor:
463+
case IndexSection::isTitlePageAuthor:
464464
break;
465-
case isMainPage:
465+
case IndexSection::isMainPage:
466466
m_t << "</title>\n";
467467
m_t << " <xi:include href=\"mainpage.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n";
468468
m_t << "</chapter>\n";
469469
break;
470-
case isModuleIndex:
470+
case IndexSection::isModuleIndex:
471471
//m_t << "</chapter>\n";
472472
break;
473-
case isDirIndex:
473+
case IndexSection::isDirIndex:
474474
//m_t << "<xi:include href=\"dirs.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>";
475475
//m_t << "</chapter>\n";
476476
break;
477-
case isNamespaceIndex:
477+
case IndexSection::isNamespaceIndex:
478478
//m_t << "<xi:include href=\"namespaces.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>";
479479
//m_t << "</chapter>\n";
480480
break;
481-
case isConceptIndex:
481+
case IndexSection::isConceptIndex:
482482
//m_t << "<xi:include href=\"concepts.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>";
483483
//m_t << "</chapter>\n";
484484
break;
485-
case isClassHierarchyIndex:
485+
case IndexSection::isClassHierarchyIndex:
486486
//m_t << "<xi:include href=\"hierarchy.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>";
487487
//m_t << "</chapter>\n";
488488
break;
489-
case isCompoundIndex:
489+
case IndexSection::isCompoundIndex:
490490
//m_t << "</chapter>\n";
491491
break;
492-
case isFileIndex:
492+
case IndexSection::isFileIndex:
493493
//m_t << "<xi:include href=\"files.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>";
494494
//m_t << "</chapter>\n";
495495
break;
496-
case isPageIndex:
496+
case IndexSection::isPageIndex:
497497
//m_t << "<xi:include href=\"pages.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>";
498498
//m_t << "</chapter>\n";
499499
break;
500-
case isModuleDocumentation:
500+
case IndexSection::isModuleDocumentation:
501501
{
502502
m_t << "</title>\n";
503503
for (const auto &gd : *Doxygen::groupLinkedMap)
@@ -510,7 +510,7 @@ DB_GEN_C2("IndexSections " << is)
510510
}
511511
m_t << "</chapter>\n";
512512
break;
513-
case isDirDocumentation:
513+
case IndexSection::isDirDocumentation:
514514
{
515515
m_t << "</title>\n";
516516
for (const auto &dd : *Doxygen::dirLinkedMap)
@@ -523,7 +523,7 @@ DB_GEN_C2("IndexSections " << is)
523523
}
524524
m_t << "</chapter>\n";
525525
break;
526-
case isNamespaceDocumentation:
526+
case IndexSection::isNamespaceDocumentation:
527527
{
528528
m_t << "</title>\n";
529529
for (const auto &nd : *Doxygen::namespaceLinkedMap)
@@ -536,7 +536,7 @@ DB_GEN_C2("IndexSections " << is)
536536
}
537537
m_t << "</chapter>\n";
538538
break;
539-
case isConceptDocumentation:
539+
case IndexSection::isConceptDocumentation:
540540
{
541541
m_t << "</title>\n";
542542
for (const auto &cd : *Doxygen::conceptLinkedMap)
@@ -549,7 +549,7 @@ DB_GEN_C2("IndexSections " << is)
549549
}
550550
m_t << "</chapter>\n";
551551
break;
552-
case isClassDocumentation:
552+
case IndexSection::isClassDocumentation:
553553
{
554554
m_t << "</title>\n";
555555
for (const auto &cd : *Doxygen::classLinkedMap)
@@ -566,7 +566,7 @@ DB_GEN_C2("IndexSections " << is)
566566
}
567567
m_t << "</chapter>\n";
568568
break;
569-
case isFileDocumentation:
569+
case IndexSection::isFileDocumentation:
570570
{
571571
m_t << "</title>\n";
572572
for (const auto &fn : *Doxygen::inputNameLinkedMap)
@@ -586,7 +586,7 @@ DB_GEN_C2("IndexSections " << is)
586586
}
587587
m_t << "</chapter>\n";
588588
break;
589-
case isExampleDocumentation:
589+
case IndexSection::isExampleDocumentation:
590590
{
591591
m_t << "</title>\n";
592592
for (const auto &pd : *Doxygen::exampleLinkedMap)
@@ -596,11 +596,11 @@ DB_GEN_C2("IndexSections " << is)
596596
}
597597
m_t << "</chapter>\n";
598598
break;
599-
case isPageDocumentation:
599+
case IndexSection::isPageDocumentation:
600600
break;
601-
case isPageDocumentation2:
601+
case IndexSection::isPageDocumentation2:
602602
break;
603-
case isEndIndex:
603+
case IndexSection::isEndIndex:
604604
m_t << "<index/>\n";
605605
break;
606606
}

src/docbookgen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class DocbookGenerator : public OutputGenerator //: public CodeOutputForwarder<O
111111
void writeSearchInfo(){DB_GEN_EMPTY};
112112
void writeFooter(const QCString &){DB_GEN_NEW};
113113
void endFile();
114-
void startIndexSection(IndexSections);
115-
void endIndexSection(IndexSections);
114+
void startIndexSection(IndexSection);
115+
void endIndexSection(IndexSection);
116116
void writePageLink(const QCString &,bool);
117117
void startProjectNumber(){DB_GEN_NEW};
118118
void endProjectNumber(){DB_GEN_NEW};

src/doxygen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8126,7 +8126,7 @@ static void generateFileSources()
81268126

81278127
static void generateFileDocs()
81288128
{
8129-
if (documentedFiles==0) return;
8129+
if (Index::instance().numDocumentedFiles()==0) return;
81308130

81318131
if (!Doxygen::inputNameLinkedMap->empty())
81328132
{
@@ -9296,7 +9296,7 @@ static void resolveUserReferences()
92969296
static void generatePageDocs()
92979297
{
92989298
//printf("documentedPages=%d real=%d\n",documentedPages,Doxygen::pageLinkedMap->count());
9299-
if (documentedPages==0) return;
9299+
if (Index::instance().numDocumentedPages()==0) return;
93009300
for (const auto &pd : *Doxygen::pageLinkedMap)
93019301
{
93029302
if (!pd->getGroupDef() && !pd->isReference())
@@ -12310,7 +12310,7 @@ void parseInput()
1231012310
g_s.end();
1231112311

1231212312
g_s.begin("Counting data structures...\n");
12313-
countDataStructures();
12313+
Index::instance().countDataStructures();
1231412314
g_s.end();
1231512315

1231612316
g_s.begin("Resolving user defined references...\n");

0 commit comments

Comments
 (0)