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();
219 if (!url.
empty() && url.
at(0)==
'!')
224 else if (!url.
empty() && url.
at(0)==
'^')
243 if (!n->anchor.empty()) 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 DString 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.empty();
290 t <<
"<b>" << text <<
"</b>";
296 t <<
"<a class=\"elRef\" ";
298 if (result !=
"") setTarget =
true;
303 t <<
"<a class=\"el\" ";
311 t <<
"\" target=\"basefrm\">";
313 t <<
"\" target=\"_self\">";
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();
550 if (!
parent)
return false;
551 if (n->file==
parent->file)
return true;
557 bool nameAsHtml = !n->nameAsHtml.empty();
562 t <<
"\"" << link <<
"\", null, ";
566 t <<
"\"" << link <<
"\", \"";
576 size_t i=varId.
rfind(
'/');
578 if (isdigit(varId[0])) varId.
prepend(
"_");
596 for (
const auto &n : nl)
598 if (n->separateIndex)
600 if (!n->children.empty())
603 files.emplace_back(fileId,n);
617 const FTVNodes &nl,
int level,
bool &first)
621 indentStr.
fill(
' ',level*2);
624 for (
const auto &n : nl)
627 if (!first) t <<
",\n";
637 if (n->addToNavIndex)
660 if (n->separateIndex)
662 t << indentStr <<
" [ ";
664 if (!n->children.empty())
667 if (!n->anchor.empty())
669 fileId+=
"_"+n->anchor;
675 t <<
"\"" << fileId <<
"\" ]";
684 bool firstChild=
true;
685 t << indentStr <<
" [ ";
687 bool emptySection = !
generateJSTree(navIndex,t,n->children,level+1,firstChild);
691 t <<
"\n" << indentStr <<
" ] ]";
704 if (!n->anchor.empty()) fileId+=
"_"+n->anchor;
709 auto generateJSFile = [&](
const JSTreeFile &tf)
711 DString fileId = getVarName(tf.node);
712 DString fileName = htmlOutput+
"/"+fileId+
".js";
716 bool firstChild =
true;
727 std::size_t numThreads =
static_cast<std::size_t
>(
Config_getInt(NUM_PROC_THREADS));
731 std::vector< std::future<void> > results;
732 for (
const auto &tf : jsTreeFiles)
734 results.emplace_back(threadPool.
queue([&](){ generateJSFile(tf); }));
737 for (
auto &f : results) f.get();
741 for (
const auto &tf : jsTreeFiles)
760 t <<
"var NAVTREE =\n";
764 if (projName.
empty())
798 std::stable_sort(navIndex.begin(),navIndex.end(),[](
const auto &n1,
const auto &n2)
799 { return !n1.url.empty() && (n2.url.empty() || (n1.url<n2.url)); });
803 const int maxElemCount=250;
807 t <<
"var NAVTREEINDEX =\n";
809 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
812 auto it = navIndex.begin();
813 while (it!=navIndex.end())
826 t <<
"\"" << e.
url <<
"\"";
828 tsidx <<
"\"" << e.
url <<
"\":[" << e.
path <<
"]";
830 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx <<
",";
834 if (it!=navIndex.end() && elemCount>=maxElemCount)
842 if (!tsidx.is_open())
break;
843 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
884 int preferredNumEntries =
Config_getInt(HTML_INDEX_NUM_ENTRIES);
885 t <<
"<div class=\"directory\">\n";
887 for (
const auto &n :
p->indentNodes[0])
889 if (!n->children.empty())
891 d = n->computeTreeDepth(2);
892 if (d>depth) depth=d;
895 int preferredDepth = depth;
901 t <<
"<div class=\"levels\">[";
904 for (
int i=1;i<=depth;i++)
906 t <<
"<span class=\"dyn-level-" << i <<
"\">" << i <<
"</span>";
911 if (preferredNumEntries>0)
914 for (
int i=1;i<=depth;i++)
917 for (
const auto &n :
p->indentNodes[0])
919 num+=n->numNodesAtLevel(0,i);
921 if (num<=preferredNumEntries)
934 if (!
p->indentNodes[0].empty())
936 t <<
"<table class=\"directory\">\n";
938 p->generateTree(t,
p->indentNodes[0],0,preferredDepth,index);
942 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. class/struct/union/...
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString & setNum(short n)
size_t rfind(char c, size_t pos=npos) const
DString fill(char c, size_t len)
Fills a string with a predefined character.
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
char & at(size_t i)
Returns a reference to the character at index i.
DString & prepend(const char *s)
The common base class of all entity definitions found in the sources.
virtual DString briefDescription(bool abbreviate=false) const =0
virtual DString briefFile() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual int briefLine() const =0
virtual DString getSourceFileBase() const =0
virtual DString getOutputFileBase() const =0
Class representing the abstract syntax tree of a documentation block.
static std::unique_ptr< PageDef > mainPage
static DString htmlFileExtension
std::unique_ptr< Private > p
void addContentsItem(bool isDir, const DString &name, const DString &ref, const DString &file, const DString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def, const DString &nameAsHtml=DString())
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)
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.
virtual DString trDetailLevel()=0
virtual DString trPanelSynchronisationTooltip(bool enable)=0
virtual DString trListOfAllMembers()=0
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 DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
FileDef * toFileDef(Definition *d)
static DString node2URL(const FTVNodePtr &n, bool overruleFile=false, bool srcLink=false)
static DString pathToNode(const FTVNodePtr &leaf, const FTVNodePtr &n)
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 DString convertFileId2Var(const DString &fileId)
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
std::vector< FTVNodePtr > FTVNodes
std::weak_ptr< FTVNode > FTVNodeWeakPtr
static void generateIndent(TextStream &t, const FTVNodePtr &n, bool opened)
static DString generateIndentLabel(const FTVNodePtr &n, int level)
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)
constexpr auto JAVASCRIPT_LICENSE_TEXT
Translator * theTranslator
std::ofstream openOutputStream(const DString &name, bool append=false)
Portable versions of functions that are platform dependent.
Helper class to pass options when calling OutputList::generateDoc().
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
FTVNode(bool dir, const DString &r, const DString &f, const DString &a, const DString &n, bool sepIndex, bool navIndex, const Definition *df, const DString &nameAsHtml_)
int computeTreeDepth(int level) const
JSTreeFile(const DString &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 DString &file=DString()) const
NavIndexEntry(const DString &u, const DString &p)
DString externalLinkTarget(const bool parent)
DString convertToJSString(const DString &s, bool keepEntities, bool singleQuotes)
DString externalRef(const DString &relPath, const DString &ref, bool href)
DString convertToHtml(const DString &s, bool keepEntities)
bool fileVisibleInIndex(const FileDef *fd, bool &genSourceFile)
void addHtmlExtensionIfMissing(DString &fName)
DString relativePathToRoot(const DString &name)
A bunch of utility functions.