79 if (!n->children.empty())
81 int d = n->computeTreeDepth(level+1);
82 if (d>maxDepth) maxDepth=d;
96 num+=n->numNodesAtLevel(level+1,maxLevel);
146 p->indentNodes.resize(
p->indent+1);
160 auto &nl =
p->indentNodes[
p->indent];
164 auto &children =
p->indentNodes[
p->indent+1];
165 for (
const auto &child : children)
167 parent->children.push_back(child);
195 auto &nl =
p->indentNodes[
p->indent];
198 nl.back()->isLast=
FALSE;
200 auto newNode = std::make_shared<FTVNode>(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def);
201 nl.push_back(newNode);
202 newNode->index =
static_cast<int>(nl.size()-1);
205 auto &pnl =
p->indentNodes[
p->indent-1];
208 newNode->parent = pnl.back();
221 else if (!url.
isEmpty() && url.
at(0)==
'^')
240 if (!n->anchor.isEmpty()) url+=
"#"+n->anchor;
248 auto parent = n->parent.lock();
260 auto parent = n->parent.lock();
264 QCString dir = opened ?
"▼" :
"►";
265 t <<
"<span style=\"width:" << (indent*16) <<
"px;display:inline-block;\"> </span>"
273 t <<
"<span style=\"width:" << ((indent+1)*16) <<
"px;display:inline-block;\"> </span>";
281 bool setTarget =
FALSE;
282 if (n->file.isEmpty())
288 if (!n->ref.isEmpty())
290 t <<
"<a class=\"elRef\" ";
292 if (result !=
"") setTarget =
TRUE;
297 t <<
"<a class=\"el\" ";
305 t <<
"\" target=\"basefrm\">";
307 t <<
"\" target=\"_self\">";
315 if (!n->ref.isEmpty())
317 t <<
" [external]";
340 std::visit(visitor,astImpl->
root);
368 for (
const auto &n : nl)
372 t <<
" class=\"even\"";
374 t <<
" class=\"odd\"";
376 t <<
" style=\"display:none;\"";
379 t <<
"><td class=\"entry\">";
380 bool nodeOpened = level+1<maxLevel;
396 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
400 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
404 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
409 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
414 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
419 <<
"\" class=\"iconf"
420 << (nodeOpened?
"open":
"closed")
422 <<
"')\"> </span>";
425 t <<
"</td><td class=\"desc\">";
438 (
toFileDef(n->def))->generateSourceFile())
446 t <<
"<a href=\"" << fn <<
"\">";
460 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
464 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
468 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
473 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
478 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
482 t <<
"<span class=\"icona\"><span class=\"icon\">R</span></span>";
486 t <<
"<span class=\"iconfclosed\"></span>";
490 t <<
"<span class=\"icondoc\"></span>";
497 t <<
"</td><td class=\"desc\">";
523 auto parent = n->parent.lock();
529 if (leaf!=n) result+=
",";
535 auto parent = n->parent.lock();
543 if (n->file.isEmpty())
562 if (i>=0) varId = varId.
mid(i+1);
579 for (
const auto &n : nl)
581 if (n->separateIndex)
583 if (!n->children.empty())
586 files.emplace_back(fileId,n);
600 const FTVNodes &nl,
int level,
bool &first)
604 indentStr.
fill(
' ',level*2);
607 for (
const auto &n : nl)
610 if (!first) t <<
",\n";
620 if (n->addToNavIndex)
643 if (n->separateIndex)
645 t << indentStr <<
" [ ";
647 if (!n->children.empty())
650 if (!n->anchor.isEmpty())
652 fileId+=
"_"+n->anchor;
658 t <<
"\"" << fileId <<
"\" ]";
667 bool firstChild=
TRUE;
668 t << indentStr <<
" [ ";
670 bool emptySection = !
generateJSTree(navIndex,t,n->children,level+1,firstChild);
674 t <<
"\n" << indentStr <<
" ] ]";
687 if (!n->anchor.isEmpty()) fileId+=
"_"+n->anchor;
692 auto generateJSFile = [&](
const JSTreeFile &tf)
694 QCString fileId = getVarName(tf.node);
695 QCString fileName = htmlOutput+
"/"+fileId+
".js";
699 bool firstChild =
true;
710 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
714 std::vector< std::future<void> > results;
715 for (
const auto &tf : jsTreeFiles)
717 results.emplace_back(threadPool.
queue([&](){ generateJSFile(tf); }));
720 for (
auto &f : results) f.get();
724 for (
const auto &tf : jsTreeFiles)
743 t <<
"var NAVTREE =\n";
781 std::stable_sort(navIndex.begin(),navIndex.end(),[](
const auto &n1,
const auto &n2)
782 { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); });
786 const int maxElemCount=250;
790 t <<
"var NAVTREEINDEX =\n";
792 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
795 auto it = navIndex.begin();
796 while (it!=navIndex.end())
809 t <<
"\"" << e.
url <<
"\"";
811 tsidx <<
"\"" << e.
url <<
"\":[" << e.
path <<
"]";
813 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx <<
",";
817 if (it!=navIndex.end() && elemCount>=maxElemCount)
825 if (!tsidx.is_open())
break;
826 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
833 t <<
"\nvar SYNCONMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
FALSE) <<
"';";
834 t <<
"\nvar SYNCOFFMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
TRUE) <<
"';";
877 int preferredNumEntries =
Config_getInt(HTML_INDEX_NUM_ENTRIES);
878 t <<
"<div class=\"directory\">\n";
880 for (
const auto &n :
p->indentNodes[0])
882 if (!n->children.empty())
884 d = n->computeTreeDepth(2);
885 if (d>depth) depth=d;
888 int preferredDepth = depth;
892 t <<
"<div class=\"levels\">[";
895 for (
int i=1;i<=depth;i++)
897 t <<
"<span onclick=\"javascript:dynsection.toggleLevel(" << i <<
");\">" << i <<
"</span>";
901 if (preferredNumEntries>0)
904 for (
int i=1;i<=depth;i++)
907 for (
const auto &n :
p->indentNodes[0])
909 num+=n->numNodesAtLevel(0,i);
911 if (num<=preferredNumEntries)
924 if (!
p->indentNodes[0].empty())
926 t <<
"<table class=\"directory\">\n";
928 p->generateTree(t,
p->indentNodes[0],0,preferredDepth,index);
932 t <<
"</div><!-- directory -->\n";
A abstract class representing of a compound symbol.
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e.
The common base class of all entity definitions found in the sources.
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual int briefLine() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString getSourceFileBase() const =0
virtual QCString briefFile() const =0
virtual QCString getOutputFileBase() const =0
Class representing the abstract syntax tree of a documentation block.
static std::unique_ptr< PageDef > mainPage
static QCString htmlFileExtension
std::unique_ptr< Private > p
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)
static void generateTreeViewImages()
void generateTreeViewScripts()
void generateTreeViewInline(TextStream &t)
A model of a file symbol.
Generator for HTML code fragments.
Concrete visitor implementation for HTML output.
static LayoutDocManager & instance()
Returns a reference to this singleton.
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Class representing a list of different code generators.
void add(OutputCodeIntfPtr &&p)
This is an alternative implementation of QCString.
void fill(char c, int len=-1)
Fills a string with a predefined character.
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString & setNum(short n)
int findRev(char c, int index=-1, bool cs=TRUE) const
Singleton for managing resources compiled into an executable.
static ResourceMgr & instance()
Returns the one and only instance of this class.
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory.
Text streaming class that buffers data.
Class managing a pool of worker threads.
auto queue(F &&f, Args &&... args) -> std::future< decltype(f(args...))>
Queue the callable function f for the threads to execute.
ClassDef * toClassDef(Definition *d)
#define Config_getInt(name)
#define Config_getBool(name)
#define Config_getString(name)
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
IDocParserPtr createDocParser()
factory function to create a parser
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &input, bool indexWords, bool isExample, const QCString &exampleName, bool singleLine, bool linkFromIndex, bool markdownSupport)
FileDef * toFileDef(Definition *d)
static void generateLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &lname)
static bool dupOfParent(const FTVNodePtr &n)
static bool generateJSTree(NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nl, int level, bool &first)
static void generateJSLink(TextStream &t, const FTVNodePtr &n)
static QCString node2URL(const FTVNodePtr &n, bool overruleFile=FALSE, bool srcLink=FALSE)
static void generateBriefDoc(TextStream &t, const Definition *def)
static void collectJSTreeFiles(const FTVNodes &nl, JSTreeFiles &files)
static char compoundIcon(const ClassDef *cd)
static std::mutex g_navIndexMutex
static QCString pathToNode(const FTVNodePtr &leaf, const FTVNodePtr &n)
std::vector< FTVNodePtr > FTVNodes
std::weak_ptr< FTVNode > FTVNodeWeakPtr
static void generateIndent(TextStream &t, const FTVNodePtr &n, bool opened)
std::shared_ptr< FTVNode > FTVNodePtr
static void generateJSTreeFiles(NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nodeList)
std::vector< JSTreeFile > JSTreeFiles
static void generateJSNavTree(const FTVNodes &nodeList)
static QCString convertFileId2Var(const QCString &fileId)
static QCString generateIndentLabel(const FTVNodePtr &n, int level)
constexpr auto JAVASCRIPT_LICENSE_TEXT
Translator * theTranslator
std::ofstream openOutputStream(const QCString &name, bool append=false)
Portable versions of functions that are platform dependent.
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
void generateTree(TextStream &t, const FTVNodes &nl, int level, int maxLevel, int &index)
void generateLink(TextStream &t, const FTVNodePtr &n)
std::vector< FTVNodes > indentNodes
int numNodesAtLevel(int level, int maxLevel) const
int computeTreeDepth(int level) const
FTVNode(bool dir, const QCString &r, const QCString &f, const QCString &a, const QCString &n, bool sepIndex, bool navIndex, const Definition *df)
JSTreeFile(const QCString &fi, const FTVNodePtr &n)
Base class for the layout of a navigation item at the top of the HTML pages.
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
NavIndexEntry(const QCString &u, const QCString &p)
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
QCString convertToHtml(const QCString &s, bool keepEntities)
QCString relativePathToRoot(const QCString &name)
bool fileVisibleInIndex(const FileDef *fd, bool &genSourceFile)
QCString stripScope(const QCString &name)
QCString convertToJSString(const QCString &s)
QCString externalLinkTarget(const bool parent)
void addHtmlExtensionIfMissing(QCString &fName)
A bunch of utility functions.