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 const char *ARROW_DOWN =
"<span class=\"arrowhead opened\"></span>";
265 const char *ARROW_RIGHT =
"<span class=\"arrowhead closed\"></span>";
266 QCString dir = opened ? ARROW_DOWN : ARROW_RIGHT;
267 t <<
"<span style=\"width:" << (indent*16) <<
"px;display:inline-block;\"> </span>"
275 t <<
"<span style=\"width:" << ((indent+1)*16) <<
"px;display:inline-block;\"> </span>";
283 bool setTarget =
FALSE;
284 if (n->file.isEmpty())
290 if (!n->ref.isEmpty())
292 t <<
"<a class=\"elRef\" ";
294 if (result !=
"") setTarget =
TRUE;
299 t <<
"<a class=\"el\" ";
307 t <<
"\" target=\"basefrm\">";
309 t <<
"\" target=\"_self\">";
317 if (!n->ref.isEmpty())
319 t <<
" [external]";
342 std::visit(visitor,astImpl->
root);
370 for (
const auto &n : nl)
374 t <<
" class=\"even\"";
376 t <<
" class=\"odd\"";
378 t <<
" style=\"display:none;\"";
381 t <<
"><td class=\"entry\">";
382 bool nodeOpened = level+1<maxLevel;
396 if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran))
398 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
400 else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL))
402 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
406 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
411 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
416 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
422 <<
"')\"><div class=\"folder-icon"
423 << (nodeOpened ?
" open" :
"")
424 <<
"\"></div></span>";
427 t <<
"</td><td class=\"desc\">";
440 (
toFileDef(n->def))->generateSourceFile())
448 t <<
"<a href=\"" << fn <<
"\">";
460 if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran))
462 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
464 else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL))
466 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
470 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
475 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
480 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
484 t <<
"<span class=\"icona\"><span class=\"icon\">R</span></span>";
488 t <<
"<span class=\"iconfolder\"><div class=\"folder-icon\"></div></span>";
492 t <<
"<span class=\"icondoc\"><div class=\"doc-icon\"></div></span>";
499 t <<
"</td><td class=\"desc\">";
525 auto parent = n->parent.lock();
531 if (leaf!=n) result+=
",";
537 auto parent = n->parent.lock();
545 if (n->file.isEmpty())
564 if (i>=0) varId = varId.
mid(i+1);
581 for (
const auto &n : nl)
583 if (n->separateIndex)
585 if (!n->children.empty())
588 files.emplace_back(fileId,n);
602 const FTVNodes &nl,
int level,
bool &first)
606 indentStr.
fill(
' ',level*2);
609 for (
const auto &n : nl)
612 if (!first) t <<
",\n";
622 if (n->addToNavIndex)
645 if (n->separateIndex)
647 t << indentStr <<
" [ ";
649 if (!n->children.empty())
652 if (!n->anchor.isEmpty())
654 fileId+=
"_"+n->anchor;
660 t <<
"\"" << fileId <<
"\" ]";
669 bool firstChild=
TRUE;
670 t << indentStr <<
" [ ";
672 bool emptySection = !
generateJSTree(navIndex,t,n->children,level+1,firstChild);
676 t <<
"\n" << indentStr <<
" ] ]";
689 if (!n->anchor.isEmpty()) fileId+=
"_"+n->anchor;
694 auto generateJSFile = [&](
const JSTreeFile &tf)
696 QCString fileId = getVarName(tf.node);
697 QCString fileName = htmlOutput+
"/"+fileId+
".js";
701 bool firstChild =
true;
712 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
716 std::vector< std::future<void> > results;
717 for (
const auto &tf : jsTreeFiles)
719 results.emplace_back(threadPool.
queue([&](){ generateJSFile(tf); }));
722 for (
auto &f : results) f.get();
726 for (
const auto &tf : jsTreeFiles)
745 t <<
"var NAVTREE =\n";
783 std::stable_sort(navIndex.begin(),navIndex.end(),[](
const auto &n1,
const auto &n2)
784 { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); });
788 const int maxElemCount=250;
792 t <<
"var NAVTREEINDEX =\n";
794 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
797 auto it = navIndex.begin();
798 while (it!=navIndex.end())
811 t <<
"\"" << e.
url <<
"\"";
813 tsidx <<
"\"" << e.
url <<
"\":[" << e.
path <<
"]";
815 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx <<
",";
819 if (it!=navIndex.end() && elemCount>=maxElemCount)
827 if (!tsidx.is_open())
break;
828 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
835 t <<
"\nvar SYNCONMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
FALSE) <<
"';";
836 t <<
"\nvar SYNCOFFMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
TRUE) <<
"';";
864 int preferredNumEntries =
Config_getInt(HTML_INDEX_NUM_ENTRIES);
865 t <<
"<div class=\"directory\">\n";
867 for (
const auto &n :
p->indentNodes[0])
869 if (!n->children.empty())
871 d = n->computeTreeDepth(2);
872 if (d>depth) depth=d;
875 int preferredDepth = depth;
879 t <<
"<div class=\"levels\">[";
882 for (
int i=1;i<=depth;i++)
884 t <<
"<span onclick=\"javascript:dynsection.toggleLevel(" << i <<
");\">" << i <<
"</span>";
888 if (preferredNumEntries>0)
891 for (
int i=1;i<=depth;i++)
894 for (
const auto &n :
p->indentNodes[0])
896 num+=n->numNodesAtLevel(0,i);
898 if (num<=preferredNumEntries)
911 if (!
p->indentNodes[0].empty())
913 t <<
"<table class=\"directory\">\n";
915 p->generateTree(t,
p->indentNodes[0],0,preferredDepth,index);
919 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)
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
static ResourceMgr & instance()
Returns the one and only instance of this class.
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.