Skip to main content

The LayoutDocManager Class Reference

Singleton providing access to the (user configurable) layout of the documentation. More...

Declaration

class LayoutDocManager { ... }

Included Headers

#include <src/layout.h>

Enumerations Index

enumLayoutPart { ... }

Friends Index

classLayoutParser

Private Constructors Index

LayoutDocManager ()

Private Destructor Index

~LayoutDocManager ()

Public Member Functions Index

const LayoutDocEntryList &docEntries (LayoutPart part) const

Returns the list of LayoutDocEntry's in representation order for a given page identified by part. More...

LayoutNavEntry *rootNavEntry () const

returns the (invisible) root of the navigation tree. More...

LayoutNavEntry *createChildNavEntry (LayoutNavEntry *root, LayoutNavEntry::Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)

append a new node as a child to root. More...

voidparse (const QCString &fileName, const char *data=nullptr)

Parses a user provided layout. More...

voidinit ()
intmajorVersion () const
intminorVersion () const

Private Member Functions Index

voidaddEntry (LayoutPart p, LayoutDocEntryPtr &&e)
voidmergeNavEntries (LayoutDocManager &manager)
voidmergeDocEntries (const QCString &fileName, LayoutDocManager &manager)
voidremoveInvisibleDocEntries ()

Private Member Attributes Index

std::unique_ptr< Private >d

Public Static Functions Index

static LayoutDocManager &instance ()

Returns a reference to this singleton. More...

static std::stringpartToString (int k)

Description

Singleton providing access to the (user configurable) layout of the documentation.

Definition at line 261 of file layout.h.

Enumerations

LayoutPart

enum LayoutDocManager::LayoutPart
Enumeration values
PART_SPECIFICATIONS

Definition at line 265 of file layout.h.

266 {
267#define PSPEC(x,y) x y,
269#undef PSPEC
270 };

Friends

LayoutParser

friend class LayoutParser

Definition at line 306 of file layout.h.

306 friend class LayoutParser;

References LayoutParser, printLayout and writeDefaultLayoutFile.

Referenced by init, LayoutParser and parse.

Private Constructors

LayoutDocManager()

LayoutDocManager::LayoutDocManager ()

Declaration at line 302 of file layout.h, definition at line 1407 of file layout.cpp.

1408{
1409}

Reference d.

Referenced by instance, mergeDocEntries, mergeNavEntries and parse.

Private Destructor

~LayoutDocManager()

LayoutDocManager::~LayoutDocManager ()

Declaration at line 303 of file layout.h, definition at line 1411 of file layout.cpp.

Public Member Functions

createChildNavEntry()

LayoutNavEntry * LayoutDocManager::createChildNavEntry (LayoutNavEntry * root, LayoutNavEntry::Kind k, bool vs, const QCString & bf, const QCString & tl, const QCString & intro)

append a new node as a child to root.

Declaration at line 289 of file layout.h, definition at line 1451 of file layout.cpp.

1452 LayoutNavEntry::Kind k,bool vs,const QCString &bf,
1453 const QCString &tl,const QCString &intro)
1454{
1455 if (parent==nullptr) parent = &d->rootNav;
1456 auto ptr = std::make_unique<LayoutNavEntry>(parent,k,vs,bf,tl,intro);
1457 auto child = ptr.get();
1458 parent->appendChild(std::move(ptr));
1459 return child;
1460}

References d and parent.

docEntries()

const LayoutDocEntryList & LayoutDocManager::docEntries (LayoutPart part)

Returns the list of LayoutDocEntry's in representation order for a given page identified by part.

Declaration at line 284 of file layout.h, definition at line 1441 of file layout.cpp.

1442{
1443 return d->docEntries[static_cast<int>(part)];
1444}

Reference d.

init()

void LayoutDocManager::init ()

Declaration at line 294 of file layout.h, definition at line 1415 of file layout.cpp.

1416{
1418 XMLHandlers handlers;
1419 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1420 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1421 handlers.error = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); };
1422 XMLParser parser(handlers);
1423 layoutParser.setDocumentLocator(&parser);
1424 constexpr auto layoutFile = "layout_default.xml";
1425 QCString layout_default = ResourceMgr::instance().getAsString(layoutFile);
1426 parser.parse(layoutFile,layout_default.data(),Debug::isFlagSet(Debug::Lex_xml),
1427 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",layoutFile); },
1428 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",layoutFile); }
1429 );
1431 d->majorVersion = layoutParser.majorVersion();
1432 d->minorVersion = layoutParser.minorVersion();
1433}

References d, QCString::data, LayoutParser::endElement, XMLHandlers::endElement, LayoutParser::error, XMLHandlers::error, ResourceMgr::getAsString, instance, ResourceMgr::instance, Debug::isFlagSet, LayoutParser, Debug::Lex_xml, LayoutParser::majorVersion, LayoutParser::minorVersion, msg, XMLParser::parse, removeInvisibleDocEntries, LayoutParser::setDocumentLocator, LayoutParser::startElement and XMLHandlers::startElement.

Referenced by parseInput.

majorVersion()

int LayoutDocManager::majorVersion ()

Declaration at line 295 of file layout.h, definition at line 1529 of file layout.cpp.

1530{
1531 return d->majorVersion;
1532}

Reference d.

minorVersion()

int LayoutDocManager::minorVersion ()

Declaration at line 296 of file layout.h, definition at line 1534 of file layout.cpp.

1535{
1536 return d->minorVersion;
1537}

Reference d.

parse()

void LayoutDocManager::parse (const QCString & fileName, const char * data=nullptr)

Parses a user provided layout.

Declaration at line 293 of file layout.h, definition at line 1468 of file layout.cpp.

1468void LayoutDocManager::parse(const QCString &fileName, const char *data)
1469{
1470 //printf("============ LayoutDocManager::parse(%s)\n",qPrint(fileName));
1471 LayoutDocManager layoutDocManager;
1472 LayoutParser layoutParser(layoutDocManager);
1473 XMLHandlers handlers;
1474 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1475 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1476 handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); };
1477 XMLParser parser(handlers);
1478 layoutParser.setDocumentLocator(&parser);
1479 parser.parse(fileName.data(),
1480 data ? data : fileToString(fileName).data(),
1482 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",qPrint(fileName)); },
1483 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",qPrint(fileName)); },
1485 );
1486
1487 // version in the user defined layout overrides default one
1488 d->majorVersion = layoutParser.majorVersion();
1489 d->minorVersion = layoutParser.minorVersion();
1490
1491 // merge missing parts of the default layout into the user defined layout
1492 // For now merging in defaults has been disabled for navigation entries
1493 // to avoid "extra entries" for projects that work with partial layout files.
1494 //mergeNavEntries(layoutDocManager);
1495
1496 // for compatibility reasons we only merge defaults when the user defined layout has at least version 2 or higher
1497 if (d->majorVersion>=2)
1498 {
1499 mergeDocEntries(fileName,layoutDocManager);
1500 }
1501
1502 layoutDocManager.removeInvisibleDocEntries();
1503
1504 // replace default layout with merged layout
1505 d->docEntries.swap(layoutDocManager.d->docEntries);
1506 d->rootNav.swap(layoutDocManager.d->rootNav);
1507}

References d, QCString::data, LayoutParser::endElement, XMLHandlers::endElement, LayoutParser::error, XMLHandlers::error, fileToString, Debug::isFlagSet, LayoutDocManager, LayoutParser, Debug::Lex_xml, LayoutParser::majorVersion, mergeDocEntries, LayoutParser::minorVersion, msg, XMLParser::parse, DebugLex::print, qPrint, removeInvisibleDocEntries, LayoutParser::setDocumentLocator, LayoutParser::startElement, XMLHandlers::startElement and transcodeCharacterStringToUTF8.

Referenced by parseInput.

rootNavEntry()

Private Member Functions

addEntry()

void LayoutDocManager::addEntry (LayoutPart p, LayoutDocEntryPtr && e)

Declaration at line 298 of file layout.h, definition at line 1462 of file layout.cpp.

1463{
1464 auto &docEntry = d->docEntries[static_cast<int>(p)];
1465 docEntry.push_back(std::move(e)); // add
1466}

Reference d.

mergeDocEntries()

void LayoutDocManager::mergeDocEntries (const QCString & fileName, LayoutDocManager & manager)

Declaration at line 300 of file layout.h, definition at line 1721 of file layout.cpp.

1722{
1723 for (size_t i=0; i<d->docEntries.size(); i++)
1724 {
1725 //printf("========= part %zu\n",i);
1726 mergeDocEntryLists(fileName,other.d->docEntries[i],d->docEntries[i]);
1727 }
1728}

References d, LayoutDocManager and mergeDocEntryLists.

Referenced by parse.

mergeNavEntries()

void LayoutDocManager::mergeNavEntries (LayoutDocManager & manager)

Declaration at line 299 of file layout.h, definition at line 1633 of file layout.cpp.

References LayoutDocManager, mergeNavTreeNodesRec and rootNavEntry.

removeInvisibleDocEntries()

void LayoutDocManager::removeInvisibleDocEntries ()

Declaration at line 301 of file layout.h, definition at line 1509 of file layout.cpp.

1510{
1511 // remove invisible entries
1512 for (auto &list : d->docEntries)
1513 {
1514 auto it = list.begin();
1515 while (it!=list.end())
1516 {
1517 if (*it==nullptr || !(*it)->visible())
1518 {
1519 it = list.erase(it);
1520 }
1521 else
1522 {
1523 ++it;
1524 }
1525 }
1526 }
1527}

Reference d.

Referenced by init and parse.

Private Member Attributes

d

std::unique_ptr<Private> LayoutDocManager::d

Public Static Functions

instance()

LayoutDocManager & LayoutDocManager::instance ()
static

Returns a reference to this singleton.

Declaration at line 272 of file layout.h, definition at line 1435 of file layout.cpp.

1436{
1437 static LayoutDocManager theInstance;
1438 return theInstance;
1439}

Reference LayoutDocManager.

Referenced by addMembersToIndex, ClassDefImpl::countAdditionalInheritedMembers, ModuleDefImpl::countVisibleMembers, NamespaceDefImpl::countVisibleMembers, generateJSNavTree, ClassDefImpl::getTitleForMemberListType, init, parseInput, printLayout, renderQuickLinksAsTabs, ClassDefImpl::setAnonymousEnumType, ClassDefImpl::writeAdditionalInheritedMembers, writeAlphabeticalExceptionIndex, writeAlphabeticalIndex, writeAlphabeticalInterfaceIndex, writeAlphabeticalStructIndex, writeAnnotatedIndexGeneric, writeClassMemberIndex, writeClassMemberIndexFiltered, writeConceptIndex, ClassDefImpl::writeDeclaration, writeDefaultQuickLinks, ClassDefImpl::writeDocumentation, ConceptDefImpl::writeDocumentation, DirDefImpl::writeDocumentation, FileDefImpl::writeDocumentation, GroupDefImpl::writeDocumentation, ModuleDefImpl::writeDocumentation, NamespaceDefImpl::writeDocumentation, ClassDefImpl::writeDocumentationContents, writeExampleIndex, writeFileIndex, writeFileMemberIndex, writeFileMemberIndexFiltered, writeGraphicalClassHierarchy, writeGraphicalExceptionHierarchy, writeGraphicalInterfaceHierarchy, writeGroupTreeNode, writeHierarchicalExceptionIndex, writeHierarchicalIndex, writeHierarchicalInterfaceIndex, writeIndex, writeIndexHierarchy, writeIndexHierarchyEntries, ClassDefImpl::writeInlineDocumentation, writeMenuData, writeModuleIndex, writeModuleMemberIndex, writeModuleMemberIndexFiltered, writeModuleMembers, writeNamespaceIndex, writeNamespaceMemberIndex, writeNamespaceMemberIndexFiltered, writeNamespaceMembers, writePageIndex, writePages, ClassDefImpl::writeSummaryLinks, FileDefImpl::writeSummaryLinks, GroupDefImpl::writeSummaryLinks, ModuleDefImpl::writeSummaryLinks, NamespaceDefImpl::writeSummaryLinks, ClassDefImpl::writeTagFile, DirDefImpl::writeTagFile, FileDefImpl::writeTagFile, GroupDefImpl::writeTagFile, ModuleDefImpl::writeTagFile, NamespaceDefImpl::writeTagFile and writeTopicIndex.

partToString()

std::string LayoutDocManager::partToString (int k)
inline static

Definition at line 273 of file layout.h.

273 static std::string partToString(int k)
274 {
275 switch (k)
276 {
277#define PSPEC(x,y) case x: return #x; break;
279#undef PSPEC
280 default: return "unknown"; // to satisfy compiler
281 }
282 }

Reference PART_SPECIFICATIONS.

Referenced by printLayout.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.