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 {
  Undefined = -1 , Class , Concept , Namespace ,
  File , Group , Directory , Module ,
  NrParts
}
 

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.
 

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 205 of file layout.h.

Member Enumeration Documentation

◆ LayoutPart

Enumerator
Undefined 
Class 
Concept 
Namespace 
File 
Group 
Directory 
Module 
NrParts 

Definition at line 209 of file layout.h.

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:235

◆ ~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:1292

References d, and parent().

Referenced by LayoutParser::startNavEntry().

◆ docEntries()

◆ 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:68
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:134
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
This is an alternative implementation of QCString.
Definition qcstring.h:94
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:152
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.
Event handlers that can installed by the client and called while parsing a XML document.
Definition xml.h:27
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(), 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}
Singleton providing access to the (user configurable) layout of the documentation.
Definition layout.h:206

Referenced by addMembersToIndex(), ClassDefImpl::countAdditionalInheritedMembers(), ModuleDefImpl::countVisibleMembers(), NamespaceDefImpl::countVisibleMembers(), LayoutParser::endMemberDecl(), LayoutParser::endMemberDef(), generateJSNavTree(), ClassDefImpl::getTitleForMemberListType(), parseInput(), 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(),
1470 Debug::isFlagSet(Debug::Lex_xml),
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}
Class containing a print function for diagnostics.
Definition debug.h:25
static void print(Debug::DebugMask mask, const char *state, const char *lexName, const char *fileName)
Definition debug.cpp:158
const char * qPrint(const char *s)
Definition qcstring.h:652
bool transcodeCharacterStringToUTF8(std::string &input, const char *inputEncoding)
Definition util.cpp:1375
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1413

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

Referenced by parseInput().

◆ rootNavEntry()

Friends And Related Symbol Documentation

◆ LayoutParser

friend class LayoutParser
friend

Definition at line 236 of file layout.h.

Member Data Documentation

◆ d

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

Definition at line 235 of file layout.h.

Referenced by addEntry(), clear(), createChildNavEntry(), docEntries(), and rootNavEntry().


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