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();
264 auto parent = n->parent.lock();
266 if (n->isDir && dynamicSections)
268 const char *ARROW_DOWN =
"<span class=\"arrowhead opened\"></span>";
269 const char *ARROW_RIGHT =
"<span class=\"arrowhead closed\"></span>";
270 QCString dir = opened ? ARROW_DOWN : ARROW_RIGHT;
271 for(
int i=0;i<indent;i++) t <<
"<span class=\"spacer\"> </span>";
277 for(
int i=0;i<=indent;i++) t <<
"<span class=\"spacer\"> </span>";
285 bool setTarget =
FALSE;
286 bool nameAsHtml = !n->nameAsHtml.isEmpty();
288 if (n->file.isEmpty())
290 t <<
"<b>" << text <<
"</b>";
294 if (!n->ref.isEmpty())
296 t <<
"<a class=\"elRef\" ";
298 if (result !=
"") setTarget =
TRUE;
303 t <<
"<a class=\"el\" ";
311 t <<
"\" target=\"basefrm\">";
313 t <<
"\" target=\"_self\">";
321 if (!n->ref.isEmpty())
323 t <<
" [external]";
343 .setLinkFromIndex(
true))
352 std::visit(visitor,astImpl->
root);
381 for (
const auto &n : nl)
389 if (level>=maxLevel && dynamicSections)
394 t <<
"><td class=\"entry\">";
395 bool nodeOpened = level+1<maxLevel;
409 if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran))
411 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
413 else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL))
415 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
419 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
424 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
429 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
431 else if (dynamicSections)
434 <<
"<div class=\"folder-icon"
435 << (nodeOpened ?
" open" :
"")
436 <<
"\"></div></span>";
439 t <<
"</td><td class=\"desc\">";
452 (
toFileDef(n->def))->generateSourceFile())
460 t <<
"<a href=\"" << fn <<
"\">";
472 if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran))
474 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
476 else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL))
478 t <<
"<span class=\"icona\"><span class=\"icon\">P</span></span>";
482 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
487 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
492 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
496 t <<
"<span class=\"icona\"><span class=\"icon\">R</span></span>";
500 t <<
"<span class=\"iconfolder\"><div class=\"folder-icon\"></div></span>";
504 t <<
"<span class=\"icondoc\"><div class=\"doc-icon\"></div></span>";
511 t <<
"</td><td class=\"desc\">";
537 auto parent = n->parent.lock();
543 if (leaf!=n) result+=
",";
549 auto parent = n->parent.lock();
557 bool nameAsHtml = !n->nameAsHtml.isEmpty();
559 if (n->file.isEmpty())
561 t <<
"\"" << link <<
"\", null, ";
565 t <<
"\"" << link <<
"\", \"";
576 if (i>=0) varId = varId.
mid(i+1);
577 if (isdigit(varId[0])) varId.
prepend(
"_");
595 for (
const auto &n : nl)
597 if (n->separateIndex)
599 if (!n->children.empty())
602 files.emplace_back(fileId,n);
616 const FTVNodes &nl,
int level,
bool &first)
620 indentStr.
fill(
' ',level*2);
623 for (
const auto &n : nl)
626 if (!first) t <<
",\n";
636 if (n->addToNavIndex)
659 if (n->separateIndex)
661 t << indentStr <<
" [ ";
663 if (!n->children.empty())
666 if (!n->anchor.isEmpty())
668 fileId+=
"_"+n->anchor;
674 t <<
"\"" << fileId <<
"\" ]";
683 bool firstChild=
TRUE;
684 t << indentStr <<
" [ ";
686 bool emptySection = !
generateJSTree(navIndex,t,n->children,level+1,firstChild);
690 t <<
"\n" << indentStr <<
" ] ]";
703 if (!n->anchor.isEmpty()) fileId+=
"_"+n->anchor;
708 auto generateJSFile = [&](
const JSTreeFile &tf)
710 QCString fileId = getVarName(tf.node);
711 QCString fileName = htmlOutput+
"/"+fileId+
".js";
715 bool firstChild =
true;
726 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
730 std::vector< std::future<void> > results;
731 for (
const auto &tf : jsTreeFiles)
733 results.emplace_back(threadPool.
queue([&](){ generateJSFile(tf); }));
736 for (
auto &f : results) f.get();
740 for (
const auto &tf : jsTreeFiles)
759 t <<
"var NAVTREE =\n";
797 std::stable_sort(navIndex.begin(),navIndex.end(),[](
const auto &n1,
const auto &n2)
798 { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); });
802 const int maxElemCount=250;
806 t <<
"var NAVTREEINDEX =\n";
808 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
811 auto it = navIndex.begin();
812 while (it!=navIndex.end())
825 t <<
"\"" << e.
url <<
"\"";
827 tsidx <<
"\"" << e.
url <<
"\":[" << e.
path <<
"]";
829 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx <<
",";
833 if (it!=navIndex.end() && elemCount>=maxElemCount)
841 if (!tsidx.is_open())
break;
842 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
849 t <<
"\nconst SYNCONMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
FALSE) <<
"';";
850 t <<
"\nconst SYNCOFFMSG = '" <<
theTranslator->trPanelSynchronisationTooltip(
TRUE) <<
"';";
851 t <<
"\nconst LISTOFALLMEMBERS = '" <<
theTranslator->trListOfAllMembers() <<
"';";
883 int preferredNumEntries =
Config_getInt(HTML_INDEX_NUM_ENTRIES);
884 t <<
"<div class=\"directory\">\n";
886 for (
const auto &n :
p->indentNodes[0])
888 if (!n->children.empty())
890 d = n->computeTreeDepth(2);
891 if (d>depth) depth=d;
894 int preferredDepth = depth;
900 t <<
"<div class=\"levels\">[";
903 for (
int i=1;i<=depth;i++)
905 t <<
"<span class=\"dyn-level-" << i <<
"\">" << i <<
"</span>";
910 if (preferredNumEntries>0)
913 for (
int i=1;i<=depth;i++)
916 for (
const auto &n :
p->indentNodes[0])
918 num+=n->numNodesAtLevel(0,i);
920 if (num<=preferredNumEntries)
933 if (!
p->indentNodes[0].empty())
935 t <<
"<table class=\"directory\">\n";
937 p->generateTree(t,
p->indentNodes[0],0,preferredDepth,index);
941 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.
QCString & prepend(const char *s)
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 fill(char c, int len=-1)
Fills a string with a predefined character.
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, const DocOptions &options)
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 convertToJSString(const QCString &s, bool keepEntities, bool singleQuotes)
QCString convertToHtml(const QCString &s, bool keepEntities)
QCString relativePathToRoot(const QCString &name)
bool fileVisibleInIndex(const FileDef *fd, bool &genSourceFile)
QCString externalLinkTarget(const bool parent)
void addHtmlExtensionIfMissing(QCString &fName)
A bunch of utility functions.