80 if (!n->children.empty())
82 int d = n->computeTreeDepth(level+1);
83 if (d>maxDepth) maxDepth=d;
97 num+=n->numNodesAtLevel(level+1,maxLevel);
147 p->indentNodes.resize(
p->indent+1);
161 auto &nl =
p->indentNodes[
p->indent];
165 auto &children =
p->indentNodes[
p->indent+1];
166 for (
const auto &child : children)
168 parent->children.push_back(child);
198 auto &nl =
p->indentNodes[
p->indent];
201 nl.back()->isLast=
FALSE;
203 auto newNode = std::make_shared<FTVNode>(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def,nameAsHtml);
204 nl.push_back(newNode);
205 newNode->index =
static_cast<int>(nl.size()-1);
208 auto &pnl =
p->indentNodes[
p->indent-1];
211 newNode->parent = pnl.back();
224 else if (!url.
isEmpty() && url.
at(0)==
'^')
243 if (!n->anchor.isEmpty()) url+=
"#"+n->anchor;
251 auto parent = n->parent.lock();
263 auto parent = n->parent.lock();
267 const char *ARROW_DOWN =
"<span class=\"arrowhead opened\"></span>";
268 const char *ARROW_RIGHT =
"<span class=\"arrowhead closed\"></span>";
269 QCString dir = opened ? ARROW_DOWN : ARROW_RIGHT;
270 t <<
"<span style=\"width:" << (indent*16) <<
"px;display:inline-block;\"> </span>"
278 t <<
"<span style=\"width:" << ((indent+1)*16) <<
"px;display:inline-block;\"> </span>";
286 bool setTarget =
FALSE;
287 bool nameAsHtml = !n->nameAsHtml.isEmpty();
289 if (n->file.isEmpty())
291 t <<
"<b>" << text <<
"</b>";
295 if (!n->ref.isEmpty())
297 t <<
"<a class=\"elRef\" ";
299 if (result !=
"") setTarget =
TRUE;
304 t <<
"<a class=\"el\" ";
312 t <<
"\" target=\"basefrm\">";
314 t <<
"\" target=\"_self\">";
322 if (!n->ref.isEmpty())
324 t <<
" [external]";
347 std::visit(visitor,astImpl->
root);
375 for (
const auto &n : nl)
379 t <<
" class=\"even\"";
381 t <<
" class=\"odd\"";
383 t <<
" style=\"display:none;\"";
386 t <<
"><td class=\"entry\">";
387 bool nodeOpened = level+1<maxLevel;
401 if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran))
403 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
405 else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL))
407 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
411 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
416 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
421 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
427 <<
"')\"><div class=\"folder-icon"
428 << (nodeOpened ?
" open" :
"")
429 <<
"\"></div></span>";
432 t <<
"</td><td class=\"desc\">";
445 (
toFileDef(n->def))->generateSourceFile())
453 t <<
"<a href=\"" << fn <<
"\">";
465 if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran))
467 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
469 else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL))
471 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
475 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
480 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
485 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
489 t <<
"<span class=\"icona\"><span class=\"icon\">R</span></span>";
493 t <<
"<span class=\"iconfolder\"><div class=\"folder-icon\"></div></span>";
497 t <<
"<span class=\"icondoc\"><div class=\"doc-icon\"></div></span>";
504 t <<
"</td><td class=\"desc\">";
530 auto parent = n->parent.lock();
536 if (leaf!=n) result+=
",";
542 auto parent = n->parent.lock();
550 bool nameAsHtml = !n->nameAsHtml.isEmpty();
551 QCString result = nameAsHtml ? n->nameAsHtml : n->name;
553 if (n->file.isEmpty())
555 t <<
"\"" << link <<
"\", null, ";
560 t <<
"\"" << link <<
"\", \"";
571 if (i>=0) varId = varId.
mid(i+1);
588 for (
const auto &n : nl)
590 if (n->separateIndex)
592 if (!n->children.empty())
595 files.emplace_back(fileId,n);
609 const FTVNodes &nl,
int level,
bool &first)
613 indentStr.
fill(
' ',level*2);
616 for (
const auto &n : nl)
619 if (!first) t <<
",\n";
629 if (n->addToNavIndex)
652 if (n->separateIndex)
654 t << indentStr <<
" [ ";
656 if (!n->children.empty())
659 if (!n->anchor.isEmpty())
661 fileId+=
"_"+n->anchor;
667 t <<
"\"" << fileId <<
"\" ]";
676 bool firstChild=
TRUE;
677 t << indentStr <<
" [ ";
679 bool emptySection = !
generateJSTree(navIndex,t,n->children,level+1,firstChild);
683 t <<
"\n" << indentStr <<
" ] ]";
696 if (!n->anchor.isEmpty()) fileId+=
"_"+n->anchor;
701 auto generateJSFile = [&](
const JSTreeFile &tf)
703 QCString fileId = getVarName(tf.node);
704 QCString fileName = htmlOutput+
"/"+fileId+
".js";
708 bool firstChild =
true;
719 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
723 std::vector< std::future<void> > results;
724 for (
const auto &tf : jsTreeFiles)
726 results.emplace_back(threadPool.
queue([&](){ generateJSFile(tf); }));
729 for (
auto &f : results) f.get();
733 for (
const auto &tf : jsTreeFiles)
752 t <<
"var NAVTREE =\n";
790 std::stable_sort(navIndex.begin(),navIndex.end(),[](
const auto &n1,
const auto &n2)
791 { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); });
795 const int maxElemCount=250;
799 t <<
"var NAVTREEINDEX =\n";
801 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
804 auto it = navIndex.begin();
805 while (it!=navIndex.end())
818 t <<
"\"" << e.
url <<
"\"";
820 tsidx <<
"\"" << e.
url <<
"\":[" << e.
path <<
"]";
822 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx <<
",";
826 if (it!=navIndex.end() && elemCount>=maxElemCount)
834 if (!tsidx.is_open())
break;
835 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
842 t <<
"\nvar SYNCONMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
FALSE) <<
"';";
843 t <<
"\nvar SYNCOFFMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
TRUE) <<
"';";
844 t <<
"\nvar LISTOFALLMEMBERS = '" <<
theTranslator->trListOfAllMembers() <<
"';";
875 int preferredNumEntries =
Config_getInt(HTML_INDEX_NUM_ENTRIES);
876 t <<
"<div class=\"directory\">\n";
878 for (
const auto &n :
p->indentNodes[0])
880 if (!n->children.empty())
882 d = n->computeTreeDepth(2);
883 if (d>depth) depth=d;
886 int preferredDepth = depth;
890 t <<
"<div class=\"levels\">[";
893 for (
int i=1;i<=depth;i++)
895 t <<
"<span onclick=\"javascript:dynsection.toggleLevel(" << i <<
");\">" << i <<
"</span>";
899 if (preferredNumEntries>0)
902 for (
int i=1;i<=depth;i++)
905 for (
const auto &n :
p->indentNodes[0])
907 num+=n->numNodesAtLevel(0,i);
909 if (num<=preferredNumEntries)
922 if (!
p->indentNodes[0].empty())
924 t <<
"<table class=\"directory\">\n";
926 p->generateTree(t,
p->indentNodes[0],0,preferredDepth,index);
930 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, const QCString &nameAsHtml=QCString())
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.
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, bool autolinkSupport)
IDocParserPtr createDocParser()
factory function to create a parser
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
FTVNode(bool dir, const QCString &r, const QCString &f, const QCString &a, const QCString &n, bool sepIndex, bool navIndex, const Definition *df, const QCString &nameAsHtml_)
int numNodesAtLevel(int level, int maxLevel) const
int computeTreeDepth(int level) const
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, bool keepEntities)
QCString externalLinkTarget(const bool parent)
void addHtmlExtensionIfMissing(QCString &fName)
A bunch of utility functions.