Doxygen
Loading...
Searching...
No Matches
LayoutDocManager Class Reference

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

#include <src/layout.h>

Classes

class  Private
 

Public Types

enum  LayoutPart { PART_SPECIFICATIONS }
 

Public Member Functions

const LayoutDocEntryListdocEntries (LayoutPart part) const
 Returns the list of LayoutDocEntry's in representation order for a given page identified by part.
 
LayoutNavEntryrootNavEntry () const
 returns the (invisible) root of the navigation tree.
 
LayoutNavEntrycreateChildNavEntry (LayoutNavEntry *root, LayoutNavEntry::Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
 
void parse (const QCString &fileName, const char *data=nullptr)
 Parses a user provided layout.
 
void init ()
 

Static Public Member Functions

static LayoutDocManagerinstance ()
 Returns a reference to this singleton.
 
static std::string partToString (int k)
 

Private Member Functions

void addEntry (LayoutPart p, LayoutDocEntryPtr &&e)
 
void clear (LayoutPart p)
 
 LayoutDocManager ()
 
 ~LayoutDocManager ()
 

Private Attributes

std::unique_ptr< Privated
 

Friends

class LayoutParser
 

Detailed Description

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

Definition at line 232 of file layout.h.

Member Enumeration Documentation

◆ LayoutPart

Enumerator
PART_SPECIFICATIONS 

Definition at line 236 of file layout.h.

237 {
238#define PSPEC(x,y) x y,
240#undef PSPEC
241 };

Constructor & Destructor Documentation

◆ LayoutDocManager()

LayoutDocManager::LayoutDocManager ( )
private

Definition at line 1398 of file layout.cpp.

1398 : d(std::make_unique<Private>())
1399{
1400}
std::unique_ptr< Private > d
Definition layout.h:271

References d.

Referenced by instance().

◆ ~LayoutDocManager()

LayoutDocManager::~LayoutDocManager ( )
private

Definition at line 1402 of file layout.cpp.

1403{
1404}

Member Function Documentation

◆ addEntry()

◆ clear()

void LayoutDocManager::clear ( LayoutDocManager::LayoutPart p)
private

Definition at line 1454 of file layout.cpp.

1455{
1456 d->docEntries[static_cast<int>(p)].clear();
1457}
void clear(LayoutPart p)
Definition layout.cpp:1454

References clear(), and d.

Referenced by clear(), and LayoutParser::startTop().

◆ createChildNavEntry()

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

Definition at line 1439 of file layout.cpp.

1441{
1442 if (parent==nullptr) parent = &d->rootNav;
1443 auto ptr = std::make_unique<LayoutNavEntry>(parent,k,vs,bf,tl,intro);
1444 auto child = ptr.get();
1445 parent->addChild(std::move(ptr));
1446 return child;
1447}
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324

References d, and parent().

Referenced by LayoutParser::startNavEntry().

◆ docEntries()

const LayoutDocEntryList & LayoutDocManager::docEntries ( LayoutDocManager::LayoutPart part) const

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

Definition at line 1429 of file layout.cpp.

1430{
1431 return d->docEntries[static_cast<int>(part)];
1432}

References d.

◆ init()

void LayoutDocManager::init ( )

Definition at line 1406 of file layout.cpp.

1407{
1408 LayoutParser &layoutParser = LayoutParser::instance();
1409 XMLHandlers handlers;
1410 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1411 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1412 handlers.error = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); };
1413 XMLParser parser(handlers);
1414 layoutParser.setDocumentLocator(&parser);
1415 constexpr auto layoutFile = "layout_default.xml";
1416 QCString layout_default = ResourceMgr::instance().getAsString(layoutFile);
1417 parser.parse(layoutFile,layout_default.data(),Debug::isFlagSet(Debug::Lex_xml),
1418 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",layoutFile); },
1419 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",layoutFile); }
1420 );
1421}
@ Lex_xml
Definition debug.h:69
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:135
friend class LayoutParser
Definition layout.h:272
void setDocumentLocator(const XMLLocator *locator)
Definition layout.cpp:193
void error(const std::string &fileName, int lineNr, const std::string &msg)
Definition layout.cpp:197
static LayoutParser & instance()
Definition layout.cpp:186
void endElement(const std::string &name)
Definition layout.cpp:1366
void startElement(const std::string &name, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:1350
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
static ResourceMgr & instance()
Returns the one and only instance of this class.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string.
std::unordered_map< std::string, std::string > Attributes
Definition xml.h:29
std::function< EndElementType > endElement
handler invoked when a closing tag has been found
Definition xml.h:40
std::function< StartElementType > startElement
handler invoked when an opening tag has been found
Definition xml.h:39
std::function< ErrorType > error
handler invoked when the parser encounters an error
Definition xml.h:42
void msg(const char *fmt,...)
Definition message.cpp:98

References QCString::data(), LayoutParser::endElement(), XMLHandlers::endElement, LayoutParser::error(), XMLHandlers::error, ResourceMgr::getAsString(), LayoutParser::instance(), ResourceMgr::instance(), Debug::isFlagSet(), LayoutParser, Debug::Lex_xml, msg(), XMLParser::parse(), LayoutParser::setDocumentLocator(), LayoutParser::startElement(), and XMLHandlers::startElement.

Referenced by parseInput().

◆ instance()

LayoutDocManager & LayoutDocManager::instance ( )
static

Returns a reference to this singleton.

Definition at line 1423 of file layout.cpp.

1424{
1425 static LayoutDocManager theInstance;
1426 return theInstance;
1427}

References LayoutDocManager().

Referenced by addMembersToIndex(), ClassDefImpl::countAdditionalInheritedMembers(), ModuleDefImpl::countVisibleMembers(), NamespaceDefImpl::countVisibleMembers(), LayoutParser::endMemberDecl(), LayoutParser::endMemberDef(), generateJSNavTree(), ClassDefImpl::getTitleForMemberListType(), parseInput(), printLayout(), renderQuickLinksAsTabs(), ClassDefImpl::setAnonymousEnumType(), LayoutParser::startMemberDecl(), LayoutParser::startMemberDeclEntry(), LayoutParser::startMemberDef(), LayoutParser::startMemberDefEntry(), LayoutParser::startNavEntry(), LayoutParser::startNavIndex(), LayoutParser::startSectionEntry(), LayoutParser::startSimpleEntry(), LayoutParser::startTop(), ClassDefImpl::writeAdditionalInheritedMembers(), writeAlphabeticalExceptionIndex(), writeAlphabeticalIndex(), writeAlphabeticalInterfaceIndex(), writeAlphabeticalStructIndex(), writeAnnotatedIndexGeneric(), writeClassMemberIndex(), writeClassMemberIndexFiltered(), writeConceptIndex(), ClassDefImpl::writeDeclaration(), writeDefaultQuickLinks(), 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().

◆ parse()

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

Parses a user provided layout.

Definition at line 1459 of file layout.cpp.

1460{
1461 LayoutParser &layoutParser = LayoutParser::instance();
1462 XMLHandlers handlers;
1463 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1464 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1465 handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); };
1466 XMLParser parser(handlers);
1467 layoutParser.setDocumentLocator(&parser);
1468 parser.parse(fileName.data(),
1469 data ? data : fileToString(fileName).data(),
1471 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",qPrint(fileName)); },
1472 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",qPrint(fileName)); },
1474 );
1475}
static void print(Debug::DebugMask mask, const char *state, const char *lexName, const char *fileName)
Definition debug.cpp:159
const char * qPrint(const char *s)
Definition qcstring.h:672
bool transcodeCharacterStringToUTF8(std::string &input, const char *inputEncoding)
Definition util.cpp:1376
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1414

References QCString::data(), LayoutParser::endElement(), XMLHandlers::endElement, LayoutParser::error(), XMLHandlers::error, fileToString(), LayoutParser::instance(), Debug::isFlagSet(), LayoutParser, Debug::Lex_xml, msg(), XMLParser::parse(), DebugLex::print(), qPrint(), LayoutParser::setDocumentLocator(), LayoutParser::startElement(), XMLHandlers::startElement, and transcodeCharacterStringToUTF8().

Referenced by parseInput().

◆ partToString()

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

Definition at line 244 of file layout.h.

245 {
246 switch (k)
247 {
248#define PSPEC(x,y) case x: return #x; break;
250#undef PSPEC
251 default: return "unknown"; // to satisfy compiler
252 }
253 }

References PART_SPECIFICATIONS.

Referenced by printLayout().

◆ rootNavEntry()

Friends And Related Symbol Documentation

◆ LayoutParser

friend class LayoutParser
friend

Definition at line 272 of file layout.h.

References LayoutParser, and writeDefaultLayoutFile().

Referenced by init(), LayoutParser, and parse().

Member Data Documentation

◆ d

std::unique_ptr<Private> LayoutDocManager::d
private

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