Doxygen
Loading...
Searching...
No Matches
ftvhelp.cpp File Reference
#include "ftvhelp.h"
#include <memory>
#include <variant>
#include <vector>
#include "classdef.h"
#include "config.h"
#include "docparser.h"
#include "doxygen.h"
#include "filedef.h"
#include "htmldocvisitor.h"
#include "language.h"
#include "layout.h"
#include "message.h"
#include "outputlist.h"
#include "pagedef.h"
#include "portable.h"
#include "resourcemgr.h"
#include "threadpool.h"
#include "util.h"
Include dependency graph for ftvhelp.cpp:

Go to the source code of this file.

Classes

struct  FTVNode
struct  FTVHelp::Private
struct  NavIndexEntry
class  NavIndexEntryList
struct  JSTreeFile

Typedefs

using FTVNodePtr = std::shared_ptr<FTVNode>
using FTVNodeWeakPtr = std::weak_ptr<FTVNode>
using FTVNodes = std::vector<FTVNodePtr>
using JSTreeFiles = std::vector<JSTreeFile>

Functions

static DString node2URL (const FTVNodePtr &n, bool overruleFile=false, bool srcLink=false)
static DString generateIndentLabel (const FTVNodePtr &n, int level)
static void generateIndent (TextStream &t, const FTVNodePtr &n, bool opened)
static void generateBriefDoc (TextStream &t, const Definition *def)
static char compoundIcon (const ClassDef *cd)
static DString pathToNode (const FTVNodePtr &leaf, const FTVNodePtr &n)
static bool dupOfParent (const FTVNodePtr &n)
static void generateJSLink (TextStream &t, const FTVNodePtr &n)
static DString convertFileId2Var (const DString &fileId)
static void collectJSTreeFiles (const FTVNodes &nl, JSTreeFiles &files)
static bool generateJSTree (NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nl, int level, bool &first)
static void generateJSTreeFiles (NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nodeList)
static void generateJSNavTree (const FTVNodes &nodeList)

Variables

static int folderId =1
static std::mutex g_navIndexMutex

Typedef Documentation

◆ FTVNodePtr

using FTVNodePtr = std::shared_ptr<FTVNode>

Definition at line 50 of file ftvhelp.cpp.

◆ FTVNodes

using FTVNodes = std::vector<FTVNodePtr>

Definition at line 52 of file ftvhelp.cpp.

◆ FTVNodeWeakPtr

using FTVNodeWeakPtr = std::weak_ptr<FTVNode>

Definition at line 51 of file ftvhelp.cpp.

◆ JSTreeFiles

using JSTreeFiles = std::vector<JSTreeFile>

Definition at line 599 of file ftvhelp.cpp.

Function Documentation

◆ collectJSTreeFiles()

void collectJSTreeFiles ( const FTVNodes & nl,
JSTreeFiles & files )
static

Definition at line 601 of file ftvhelp.cpp.

602{
603 DString htmlOutput = Config_getString(HTML_OUTPUT);
604 for (const auto &n : nl)
605 {
606 if (n->separateIndex) // add new file if there are children
607 {
608 if (!n->children.empty())
609 {
610 DString fileId = n->file;
611 files.emplace_back(fileId,n);
612 collectJSTreeFiles(n->children,files);
613 }
614 }
615 else // traverse without adding a new file
616 {
617 collectJSTreeFiles(n->children,files);
618 }
619 }
620}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
#define Config_getString(name)
Definition config.h:32
static void collectJSTreeFiles(const FTVNodes &nl, JSTreeFiles &files)
Definition ftvhelp.cpp:601

References collectJSTreeFiles(), and Config_getString.

Referenced by collectJSTreeFiles(), and generateJSTreeFiles().

◆ compoundIcon()

char compoundIcon ( const ClassDef * cd)
static

Definition at line 360 of file ftvhelp.cpp.

361{
362 char icon='C';
363 if (cd->getLanguage() == SrcLangExt::Slice)
364 {
366 {
367 icon='I';
368 }
369 else if (cd->compoundType()==ClassDef::Struct)
370 {
371 icon='S';
372 }
373 else if (cd->compoundType()==ClassDef::Record)
374 {
375 icon='R';
376 }
377 else if (cd->compoundType()==ClassDef::Exception)
378 {
379 icon='E';
380 }
381 }
382 return icon;
383}
@ Interface
Definition classdef.h:109
@ Exception
Definition classdef.h:112
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e. class/struct/union/...
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.

References ClassDef::compoundType(), ClassDef::Exception, Definition::getLanguage(), ClassDef::Interface, ClassDef::Record, and ClassDef::Struct.

Referenced by FTVHelp::Private::generateTree().

◆ convertFileId2Var()

DString convertFileId2Var ( const DString & fileId)
static

Definition at line 581 of file ftvhelp.cpp.

582{
583 DString varId = fileId;
584 size_t i=varId.rfind('/');
585 if (i!=DString::npos) varId = varId.mid(i+1);
586 if (isdigit(varId[0])) varId.prepend("_");
587
588 return substitute(varId,"-","_");
589}
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
DString & prepend(const char *s)
Definition dstring.h:515
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485

References DString::mid(), DString::npos, DString::prepend(), DString::rfind(), and substitute().

Referenced by generateJSTreeFiles().

◆ dupOfParent()

bool dupOfParent ( const FTVNodePtr & n)
static

Definition at line 554 of file ftvhelp.cpp.

555{
556 auto parent = n->parent.lock();
557 if (!parent) return false;
558 if (n->file==parent->file) return true;
559 return false;
560}
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1335

References parent().

Referenced by generateJSTree(), and generateJSTreeFiles().

◆ generateBriefDoc()

void generateBriefDoc ( TextStream & t,
const Definition * def )
static

Definition at line 331 of file ftvhelp.cpp.

332{
333 DString brief = def->briefDescription(true);
334 //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,qPrint(def->name()),qPrint(brief));
335 if (!brief.empty())
336 {
337 auto parser { createDocParser() };
338 auto ast { validatingParseDoc(*parser.get(),
339 def->briefFile(),
340 def->briefLine(),
341 def,
342 nullptr,
343 brief,
344 DocOptions()
345 .setSingleLine(true)
346 .setLinkFromIndex(true))
347 };
348 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
349 if (astImpl)
350 {
352 OutputCodeList htmlList;
353 htmlList.add<HtmlCodeGenerator>(&t,relPath);
354 HtmlDocVisitor visitor(t,htmlList,def);
355 std::visit(visitor,astImpl->root);
356 }
357 }
358}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
virtual DString briefDescription(bool abbreviate=false) const =0
virtual DString briefFile() const =0
virtual int briefLine() const =0
virtual DString getOutputFileBase() const =0
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1471
DocNodeVariant root
Definition docnode.h:1496
Generator for HTML code fragments.
Definition htmlgen.h:23
Concrete visitor implementation for HTML output.
Class representing a list of different code generators.
Definition outputlist.h:162
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:192
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
DString relativePathToRoot(const DString &name)
Definition util.cpp:2921

References OutputCodeList::add(), Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), createDocParser(), DString::empty(), Definition::getOutputFileBase(), relativePathToRoot(), DocNodeAST::root, and validatingParseDoc().

Referenced by FTVHelp::Private::generateTree().

◆ generateIndent()

void generateIndent ( TextStream & t,
const FTVNodePtr & n,
bool opened )
static

Definition at line 263 of file ftvhelp.cpp.

264{
265 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
266 int indent=0;
267 auto parent = n->parent.lock();
268 while (parent) { indent++; parent=parent->parent.lock(); }
269 if (n->isDir && dynamicSections)
270 {
271 const char *ARROW_DOWN = "<span class=\"arrowhead opened\"></span>";
272 const char *ARROW_RIGHT = "<span class=\"arrowhead closed\"></span>";
273 DString dir = opened ? ARROW_DOWN : ARROW_RIGHT;
274 for(int i=0;i<indent;i++) t << "<span class=\"spacer\">&#160;</span>";
275 t << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\">" << dir
276 << "</span>";
277 }
278 else
279 {
280 for(int i=0;i<=indent;i++) t << "<span class=\"spacer\">&#160;</span>";
281 }
282}
#define Config_getBool(name)
Definition config.h:33
static DString generateIndentLabel(const FTVNodePtr &n, int level)
Definition ftvhelp.cpp:251

References Config_getBool, generateIndentLabel(), and parent().

Referenced by FTVHelp::Private::generateTree().

◆ generateIndentLabel()

DString generateIndentLabel ( const FTVNodePtr & n,
int level )
static

Definition at line 251 of file ftvhelp.cpp.

252{
253 DString result;
254 auto parent = n->parent.lock();
255 if (parent)
256 {
257 result=generateIndentLabel(parent,level+1);
258 }
259 result+=DString().setNum(n->index)+"_";
260 return result;
261}
DString & setNum(short n)
Definition dstring.h:552

References generateIndentLabel(), parent(), and DString::setNum().

Referenced by generateIndent(), generateIndentLabel(), and FTVHelp::Private::generateTree().

◆ generateJSLink()

void generateJSLink ( TextStream & t,
const FTVNodePtr & n )
static

Definition at line 562 of file ftvhelp.cpp.

563{
564 bool nameAsHtml = !n->nameAsHtml.empty();
565 DString link = nameAsHtml ? convertToJSString(n->nameAsHtml,true) : convertToJSString(n->name);
566 if (Config_getBool(HIDE_SCOPE_NAMES)) link=stripScope(link);
567 link = substitute(link,"\n","");
568 if (n->file.empty()) // no link
569 {
570 t << "\"" << link << "\", null, ";
571 }
572 else // link into other page
573 {
574 t << "\"" << link << "\", \"";
575 t << externalRef("",n->ref);
576 t << node2URL(n);
577 t << "\", ";
578 }
579}
static DString node2URL(const FTVNodePtr &n, bool overruleFile=false, bool srcLink=false)
Definition ftvhelp.cpp:219
const char * name(int level)
Definition latexgen.h:368
DString convertToJSString(const DString &s, bool keepEntities, bool singleQuotes)
Definition util.cpp:3360
DString stripScope(const DString &name)
Definition util.cpp:3118
DString externalRef(const DString &relPath, const DString &ref)
Definition util.cpp:4551

References Config_getBool, convertToJSString(), externalRef(), node2URL(), stripScope(), and substitute().

Referenced by generateJSTree().

◆ generateJSNavTree()

void generateJSNavTree ( const FTVNodes & nodeList)
static

Definition at line 756 of file ftvhelp.cpp.

757{
758 DString htmlOutput = Config_getString(HTML_OUTPUT);
759 std::ofstream f = Portable::openOutputStream(htmlOutput+"/navtreedata.js");
760 NavIndexEntryList navIndex;
761 if (f.is_open())
762 {
763 TextStream t(&f);
764 //TextStream tidx(&fidx);
765 //tidx << "var NAVTREEINDEX =\n";
766 //tidx << "{\n";
768 t << "var NAVTREE =\n";
769 t << "[\n";
770 t << " [ ";
771 DString projName = Config_getString(PROJECT_NAME);
772 if (projName.empty())
773 {
774 if (mainPageHasTitle()) // Use title of main page as root
775 {
776 t << "\"" << convertToJSString(Doxygen::mainPage->title()) << "\", ";
777 }
778 else // Use default section title as root
779 {
780 LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::MainPage);
781 t << "\"" << convertToJSString(lne->title()) << "\", ";
782 }
783 }
784 else // use PROJECT_NAME as root tree element
785 {
786 t << "\"" << convertToJSString(projName) << "\", ";
787 }
788 t << "\"index" << Doxygen::htmlFileExtension << "\", ";
789
790 // add special entry for index page
791 navIndex.emplace_back("index"+Doxygen::htmlFileExtension,"");
792 // related page index is written as a child of index.html, so add this as well
793 navIndex.emplace_back("pages"+Doxygen::htmlFileExtension,"");
794
795 bool first=true;
796 generateJSTree(navIndex,t,nodeList,1,first);
797 generateJSTreeFiles(navIndex,t,nodeList);
798
799 if (first)
800 t << "]\n";
801 else
802 t << "\n ] ]\n";
803 t << "];\n\n";
804
805 // write the navigation index (and sub-indices)
806 std::stable_sort(navIndex.begin(),navIndex.end(),[](const auto &n1,const auto &n2)
807 { return !n1.url.empty() && (n2.url.empty() || (n1.url<n2.url)); });
808
809 int subIndex=0;
810 int elemCount=0;
811 const int maxElemCount=250;
812 std::ofstream tsidx = Portable::openOutputStream(htmlOutput+"/navtreeindex0.js");
813 if (tsidx.is_open())
814 {
815 t << "var NAVTREEINDEX =\n";
816 t << "[\n";
817 tsidx << "var NAVTREEINDEX" << subIndex << " =\n";
818 tsidx << "{\n";
819 first=true;
820 auto it = navIndex.begin();
821 while (it!=navIndex.end())
822 {
823 const NavIndexEntry &e = *it;
824 if (elemCount==0)
825 {
826 if (!first)
827 {
828 t << ",\n";
829 }
830 else
831 {
832 first=false;
833 }
834 t << "\"" << e.url << "\"";
835 }
836 tsidx << "\"" << e.url << "\":[" << e.path << "]";
837 ++it;
838 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx << ","; // not last entry
839 tsidx << "\n";
840
841 elemCount++;
842 if (it!=navIndex.end() && elemCount>=maxElemCount) // switch to new sub-index
843 {
844 tsidx << "};\n";
845 elemCount=0;
846 tsidx.close();
847 subIndex++;
848 DString fileName = htmlOutput+"/navtreeindex"+DString().setNum(subIndex)+".js";
849 tsidx = Portable::openOutputStream(fileName);
850 if (!tsidx.is_open()) break;
851 tsidx << "var NAVTREEINDEX" << subIndex << " =\n";
852 tsidx << "{\n";
853 }
854 }
855 tsidx << "};\n";
856 t << "\n];\n";
857 }
858 t << "\nconst SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(false) << "';";
859 t << "\nconst SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(true) << "';";
860 t << "\nconst LISTOFALLMEMBERS = '" << theTranslator->trListOfAllMembers() << "';";
861 }
862
863 auto &mgr = ResourceMgr::instance();
864 {
865 std::ofstream fn = Portable::openOutputStream(htmlOutput+"/navtree.js");
866 if (fn.is_open())
867 {
868 TextStream t(&fn);
869 t << substitute(
870 substitute(mgr.getAsString("navtree.js"),
871 "$TREEVIEW_WIDTH", DString().setNum(Config_getInt(TREEVIEW_WIDTH))),
872 "$PROJECTID",getProjectId());
873 }
874 }
875}
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:93
static DString htmlFileExtension
Definition doxygen.h:115
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1476
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1487
Definition ftvhelp.cpp:538
static ResourceMgr & instance()
Returns the one and only instance of this class.
Text streaming class that buffers data.
Definition textstream.h:36
virtual DString trPanelSynchronisationTooltip(bool enable)=0
virtual DString trListOfAllMembers()=0
#define Config_getInt(name)
Definition config.h:34
static bool generateJSTree(NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nl, int level, bool &first)
Definition ftvhelp.cpp:624
static void generateJSTreeFiles(NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nodeList)
Definition ftvhelp.cpp:705
constexpr auto JAVASCRIPT_LICENSE_TEXT
Definition ftvhelp.h:72
Translator * theTranslator
Definition language.cpp:76
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:681
Base class for the layout of a navigation item at the top of the HTML pages.
Definition layout.h:156
LayoutNavEntry * find(LayoutNavEntry::Kind k, const DString &file=DString()) const
Definition layout.cpp:135
DString title() const
Definition layout.cpp:194
Definition ftvhelp.cpp:531
DString path
Definition ftvhelp.cpp:534
DString url
Definition ftvhelp.cpp:533
bool mainPageHasTitle()
Definition util.cpp:4972
DString getProjectId()
Definition util.cpp:5304

References Config_getInt, Config_getString, convertToJSString(), DString::empty(), LayoutNavEntry::find(), generateJSTree(), generateJSTreeFiles(), getProjectId(), Doxygen::htmlFileExtension, LayoutDocManager::instance(), ResourceMgr::instance(), JAVASCRIPT_LICENSE_TEXT, Doxygen::mainPage, mainPageHasTitle(), Portable::openOutputStream(), NavIndexEntry::path, LayoutDocManager::rootNavEntry(), DString::setNum(), substitute(), theTranslator, LayoutNavEntry::title(), Translator::trListOfAllMembers(), Translator::trPanelSynchronisationTooltip(), and NavIndexEntry::url.

Referenced by FTVHelp::generateTreeViewScripts().

◆ generateJSTree()

bool generateJSTree ( NavIndexEntryList & navIndex,
TextStream & t,
const FTVNodes & nl,
int level,
bool & first )
static

Definition at line 624 of file ftvhelp.cpp.

626{
627 DString htmlOutput = Config_getString(HTML_OUTPUT);
628 DString indentStr;
629 indentStr.fill(' ',level*2);
630
631 bool found=false;
632 for (const auto &n : nl)
633 {
634 // terminate previous entry
635 if (!first) t << ",\n";
636 first=false;
637
638 // start entry
639 if (!found)
640 {
641 t << "[\n";
642 }
643 found=true;
644
645 if (n->addToNavIndex) // add entry to the navigation index
646 {
647 std::lock_guard lock(g_navIndexMutex);
648 if (n->def && n->def->definitionType()==Definition::TypeFile)
649 {
650 const FileDef *fd = toFileDef(n->def);
651 bool src = false;
652 bool doc = fd->visibleInIndex(src);
653 if (doc)
654 {
655 navIndex.emplace_back(node2URL(n,true,false),pathToNode(n,n));
656 }
657 if (src)
658 {
659 navIndex.emplace_back(node2URL(n,true,true),pathToNode(n,n));
660 }
661 }
662 else
663 {
664 navIndex.emplace_back(node2URL(n),pathToNode(n,n));
665 }
666 }
667
668 if (n->separateIndex) // store items in a separate file for dynamic loading
669 {
670 t << indentStr << " [ ";
671 generateJSLink(t,n);
672 if (!n->children.empty()) // write children to separate file for dynamic loading
673 {
674 DString fileId = n->file;
675 if (!n->anchor.empty())
676 {
677 fileId+="_"+n->anchor;
678 }
679 if (dupOfParent(n))
680 {
681 fileId+="_dup";
682 }
683 t << "\"" << fileId << "\" ]";
684 }
685 else // no children
686 {
687 t << "null ]";
688 }
689 }
690 else // show items in this file
691 {
692 bool firstChild=true;
693 t << indentStr << " [ ";
694 generateJSLink(t,n);
695 bool emptySection = !generateJSTree(navIndex,t,n->children,level+1,firstChild);
696 if (emptySection)
697 t << "null ]";
698 else
699 t << "\n" << indentStr << " ] ]";
700 }
701 }
702 return found;
703}
DString fill(char c, size_t len)
Fills a string with a predefined character.
Definition dstring.h:278
A model of a file symbol.
Definition filedef.h:97
virtual bool visibleInIndex(bool &genSourceFile) const =0
Returns true if this file is visible in the index.
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:2054
static DString pathToNode(const FTVNodePtr &leaf, const FTVNodePtr &n)
Definition ftvhelp.cpp:541
static bool dupOfParent(const FTVNodePtr &n)
Definition ftvhelp.cpp:554
static void generateJSLink(TextStream &t, const FTVNodePtr &n)
Definition ftvhelp.cpp:562
static std::mutex g_navIndexMutex
Definition ftvhelp.cpp:622

References Config_getString, dupOfParent(), DString::fill(), g_navIndexMutex, generateJSLink(), generateJSTree(), node2URL(), pathToNode(), toFileDef(), Definition::TypeFile, and FileDef::visibleInIndex().

Referenced by generateJSNavTree(), generateJSTree(), and generateJSTreeFiles().

◆ generateJSTreeFiles()

void generateJSTreeFiles ( NavIndexEntryList & navIndex,
TextStream & t,
const FTVNodes & nodeList )
static

Definition at line 705 of file ftvhelp.cpp.

706{
707 DString htmlOutput = Config_getString(HTML_OUTPUT);
708
709 auto getVarName = [](const FTVNodePtr n)
710 {
711 DString fileId = n->file;
712 if (!n->anchor.empty()) fileId+="_"+n->anchor;
713 if (dupOfParent(n)) fileId+="_dup";
714 return fileId;
715 };
716
717 auto generateJSFile = [&](const JSTreeFile &tf)
718 {
719 DString fileId = getVarName(tf.node);
720 DString fileName = htmlOutput+"/"+fileId+".js";
721 std::ofstream ff = Portable::openOutputStream(fileName);
722 if (ff.is_open())
723 {
724 bool firstChild = true;
725 TextStream tt(&ff);
726 tt << "var " << convertFileId2Var(fileId) << " =\n";
727 generateJSTree(navIndex,tt,tf.node->children,1,firstChild);
728 tt << "\n];";
729 }
730 };
731
732 JSTreeFiles jsTreeFiles;
733 collectJSTreeFiles(nodeList,jsTreeFiles);
734
735 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
736 if (numThreads>1) // multi threaded version
737 {
738 ThreadPool threadPool(numThreads);
739 std::vector< std::future<void> > results;
740 for (const auto &tf : jsTreeFiles)
741 {
742 results.emplace_back(threadPool.queue([&](){ generateJSFile(tf); }));
743 }
744 // wait for the results
745 for (auto &f : results) f.get();
746 }
747 else // single threaded version
748 {
749 for (const auto &tf : jsTreeFiles)
750 {
751 generateJSFile(tf);
752 }
753 }
754}
Class managing a pool of worker threads.
Definition threadpool.h:48
static DString convertFileId2Var(const DString &fileId)
Definition ftvhelp.cpp:581
std::shared_ptr< FTVNode > FTVNodePtr
Definition ftvhelp.cpp:50
std::vector< JSTreeFile > JSTreeFiles
Definition ftvhelp.cpp:599

References collectJSTreeFiles(), Config_getInt, Config_getString, convertFileId2Var(), dupOfParent(), generateJSTree(), Portable::openOutputStream(), and ThreadPool::queue().

Referenced by generateJSNavTree().

◆ node2URL()

DString node2URL ( const FTVNodePtr & n,
bool overruleFile = false,
bool srcLink = false )
static

Definition at line 219 of file ftvhelp.cpp.

220{
221 DString url = n->file;
222 if (!url.empty() && url.at(0)=='!') // relative URL
223 {
224 // remove leading !
225 url = url.mid(1);
226 }
227 else if (!url.empty() && url.at(0)=='^') // absolute URL
228 {
229 // skip, keep ^ in the output
230 }
231 else // local file (with optional anchor)
232 {
233 if (overruleFile && n->def && n->def->definitionType()==Definition::TypeFile)
234 {
235 const FileDef *fd = toFileDef(n->def);
236 if (srcLink)
237 {
238 url = fd->getSourceFileBase();
239 }
240 else
241 {
242 url = fd->getOutputFileBase();
243 }
244 }
246 if (!n->anchor.empty()) url+="#"+n->anchor;
247 }
248 return url;
249}
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
virtual DString getSourceFileBase() const =0
void addHtmlExtensionIfMissing(DString &fName)
Definition util.cpp:3940

References addHtmlExtensionIfMissing(), DString::at(), DString::empty(), Definition::getOutputFileBase(), Definition::getSourceFileBase(), DString::mid(), toFileDef(), and Definition::TypeFile.

Referenced by generateJSLink(), generateJSTree(), and FTVHelp::Private::generateLink().

◆ pathToNode()

DString pathToNode ( const FTVNodePtr & leaf,
const FTVNodePtr & n )
static

Definition at line 541 of file ftvhelp.cpp.

542{
543 DString result;
544 auto parent = n->parent.lock();
545 if (parent)
546 {
547 result+=pathToNode(leaf,parent);
548 }
549 result+=DString().setNum(n->index);
550 if (leaf!=n) result+=",";
551 return result;
552}

References parent(), pathToNode(), and DString::setNum().

Referenced by generateJSTree(), and pathToNode().

Variable Documentation

◆ folderId

int folderId =1
static

Definition at line 46 of file ftvhelp.cpp.

Referenced by FTVHelp::Private::generateTree().

◆ g_navIndexMutex

std::mutex g_navIndexMutex
static

Definition at line 622 of file ftvhelp.cpp.

Referenced by generateJSTree().