Doxygen
Loading...
Searching...
No Matches
ftvhelp.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include "ftvhelp.h"
#include "config.h"
#include "message.h"
#include "doxygen.h"
#include "language.h"
#include "htmlgen.h"
#include "layout.h"
#include "pagedef.h"
#include "docparser.h"
#include "htmldocvisitor.h"
#include "filedef.h"
#include "classdef.h"
#include "util.h"
#include "resourcemgr.h"
#include "portable.h"
#include "outputlist.h"
#include "threadpool.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 QCString node2URL (const FTVNodePtr &n, bool overruleFile=FALSE, bool srcLink=FALSE)
static QCString 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 QCString pathToNode (const FTVNodePtr &leaf, const FTVNodePtr &n)
static bool dupOfParent (const FTVNodePtr &n)
static void generateJSLink (TextStream &t, const FTVNodePtr &n)
static QCString convertFileId2Var (const QCString &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 47 of file ftvhelp.cpp.

◆ FTVNodes

using FTVNodes = std::vector<FTVNodePtr>

Definition at line 49 of file ftvhelp.cpp.

◆ FTVNodeWeakPtr

using FTVNodeWeakPtr = std::weak_ptr<FTVNode>

Definition at line 48 of file ftvhelp.cpp.

◆ JSTreeFiles

using JSTreeFiles = std::vector<JSTreeFile>

Definition at line 589 of file ftvhelp.cpp.

Function Documentation

◆ collectJSTreeFiles()

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

Definition at line 591 of file ftvhelp.cpp.

592{
593 QCString htmlOutput = Config_getString(HTML_OUTPUT);
594 for (const auto &n : nl)
595 {
596 if (n->separateIndex) // add new file if there are children
597 {
598 if (!n->children.empty())
599 {
600 QCString fileId = n->file;
601 files.emplace_back(fileId,n);
602 collectJSTreeFiles(n->children,files);
603 }
604 }
605 else // traverse without adding a new file
606 {
607 collectJSTreeFiles(n->children,files);
608 }
609 }
610}
This is an alternative implementation of QCString.
Definition qcstring.h:101
#define Config_getString(name)
Definition config.h:32
static void collectJSTreeFiles(const FTVNodes &nl, JSTreeFiles &files)
Definition ftvhelp.cpp:591

References collectJSTreeFiles(), and Config_getString.

Referenced by collectJSTreeFiles(), and generateJSTreeFiles().

◆ compoundIcon()

char compoundIcon ( const ClassDef * cd)
static

Definition at line 358 of file ftvhelp.cpp.

359{
360 char icon='C';
361 if (cd->getLanguage() == SrcLangExt::Slice)
362 {
364 {
365 icon='I';
366 }
367 else if (cd->compoundType()==ClassDef::Struct)
368 {
369 icon='S';
370 }
371 else if (cd->compoundType()==ClassDef::Exception)
372 {
373 icon='E';
374 }
375 }
376 return icon;
377}
@ Interface
Definition classdef.h:112
@ Exception
Definition classdef.h:115
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e.
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.

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

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

◆ convertFileId2Var()

QCString convertFileId2Var ( const QCString & fileId)
static

Definition at line 573 of file ftvhelp.cpp.

574{
575 QCString varId = fileId;
576 int i=varId.findRev('/');
577 if (i>=0) varId = varId.mid(i+1);
578 return substitute(varId,"-","_");
579}
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:96
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:482

References QCString::findRev(), QCString::mid(), and substitute().

Referenced by generateJSTreeFiles().

◆ dupOfParent()

bool dupOfParent ( const FTVNodePtr & n)
static

Definition at line 546 of file ftvhelp.cpp.

547{
548 auto parent = n->parent.lock();
549 if (!parent) return FALSE;
550 if (n->file==parent->file) return TRUE;
551 return FALSE;
552}
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:1330
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References FALSE, parent(), and TRUE.

Referenced by generateJSTree(), and generateJSTreeFiles().

◆ generateBriefDoc()

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

Definition at line 329 of file ftvhelp.cpp.

330{
331 QCString brief = def->briefDescription(TRUE);
332 //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,qPrint(def->name()),qPrint(brief));
333 if (!brief.isEmpty())
334 {
335 auto parser { createDocParser() };
336 auto ast { validatingParseDoc(*parser.get(),
337 def->briefFile(),
338 def->briefLine(),
339 def,
340 nullptr,
341 brief,
342 DocOptions()
343 .setSingleLine(true)
344 .setLinkFromIndex(true))
345 };
346 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
347 if (astImpl)
348 {
350 OutputCodeList htmlList;
351 htmlList.add<HtmlCodeGenerator>(&t,relPath);
352 HtmlDocVisitor visitor(t,htmlList,def);
353 std::visit(visitor,astImpl->root);
354 }
355 }
356}
virtual int briefLine() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString briefFile() const =0
virtual QCString getOutputFileBase() const =0
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1466
DocNodeVariant root
Definition docnode.h:1491
Generator for HTML code fragments.
Definition htmlgen.h:26
Concrete visitor implementation for HTML output.
Class representing a list of different code generators.
Definition outputlist.h:165
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:195
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
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
Definition docparser.cpp:55
QCString relativePathToRoot(const QCString &name)
Definition util.cpp:3500

References OutputCodeList::add(), Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), createDocParser(), Definition::getOutputFileBase(), QCString::isEmpty(), relativePathToRoot(), DocNodeAST::root, TRUE, and validatingParseDoc().

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

◆ generateIndent()

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

Definition at line 260 of file ftvhelp.cpp.

261{
262 int indent=0;
263 auto parent = n->parent.lock();
264 while (parent) { indent++; parent=parent->parent.lock(); }
265 if (n->isDir)
266 {
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;\">&#160;</span>"
271 << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" ";
272 t << "onclick=\"dynsection.toggleFolder('" << generateIndentLabel(n,0) << "')\"";
273 t << ">" << dir
274 << "</span>";
275 }
276 else
277 {
278 t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>";
279 }
280}
static QCString generateIndentLabel(const FTVNodePtr &n, int level)
Definition ftvhelp.cpp:248

References generateIndentLabel(), and parent().

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

◆ generateIndentLabel()

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

Definition at line 248 of file ftvhelp.cpp.

249{
250 QCString result;
251 auto parent = n->parent.lock();
252 if (parent)
253 {
254 result=generateIndentLabel(parent,level+1);
255 }
256 result+=QCString().setNum(n->index)+"_";
257 return result;
258}
QCString & setNum(short n)
Definition qcstring.h:459

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

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

◆ generateJSLink()

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

Definition at line 554 of file ftvhelp.cpp.

555{
556 bool nameAsHtml = !n->nameAsHtml.isEmpty();
557 QCString result = nameAsHtml ? n->nameAsHtml : n->name;
558 QCString link = convertToJSString(result,nameAsHtml);
559 if (n->file.isEmpty()) // no link
560 {
561 t << "\"" << link << "\", null, ";
562 }
563 else // link into other page
564 {
565 if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result);
566 t << "\"" << link << "\", \"";
567 t << externalRef("",n->ref,TRUE);
568 t << node2URL(n);
569 t << "\", ";
570 }
571}
#define Config_getBool(name)
Definition config.h:33
static QCString node2URL(const FTVNodePtr &n, bool overruleFile=FALSE, bool srcLink=FALSE)
Definition ftvhelp.cpp:216
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:5665
QCString convertToJSString(const QCString &s, bool keepEntities, bool singleQuotes)
Definition util.cpp:3944
QCString stripScope(const QCString &name)
Definition util.cpp:3700

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

Referenced by generateJSTree().

◆ generateJSNavTree()

void generateJSNavTree ( const FTVNodes & nodeList)
static

Definition at line 746 of file ftvhelp.cpp.

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

References Config_getInt, Config_getString, convertToJSString(), FALSE, LayoutNavEntry::find(), generateJSTree(), generateJSTreeFiles(), getProjectId(), Doxygen::htmlFileExtension, LayoutDocManager::instance(), ResourceMgr::instance(), QCString::isEmpty(), JAVASCRIPT_LICENSE_TEXT, Doxygen::mainPage, mainPageHasTitle(), Portable::openOutputStream(), NavIndexEntry::path, LayoutDocManager::rootNavEntry(), QCString::setNum(), substitute(), theTranslator, LayoutNavEntry::title(), TRUE, 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 614 of file ftvhelp.cpp.

616{
617 QCString htmlOutput = Config_getString(HTML_OUTPUT);
618 QCString indentStr;
619 indentStr.fill(' ',level*2);
620
621 bool found=FALSE;
622 for (const auto &n : nl)
623 {
624 // terminate previous entry
625 if (!first) t << ",\n";
626 first=FALSE;
627
628 // start entry
629 if (!found)
630 {
631 t << "[\n";
632 }
633 found=TRUE;
634
635 if (n->addToNavIndex) // add entry to the navigation index
636 {
637 std::lock_guard lock(g_navIndexMutex);
638 if (n->def && n->def->definitionType()==Definition::TypeFile)
639 {
640 const FileDef *fd = toFileDef(n->def);
641 bool src = false;
642 bool doc = fileVisibleInIndex(fd,src);
643 if (doc)
644 {
645 navIndex.emplace_back(node2URL(n,TRUE,FALSE),pathToNode(n,n));
646 }
647 if (src)
648 {
649 navIndex.emplace_back(node2URL(n,TRUE,TRUE),pathToNode(n,n));
650 }
651 }
652 else
653 {
654 navIndex.emplace_back(node2URL(n),pathToNode(n,n));
655 }
656 }
657
658 if (n->separateIndex) // store items in a separate file for dynamic loading
659 {
660 t << indentStr << " [ ";
661 generateJSLink(t,n);
662 if (!n->children.empty()) // write children to separate file for dynamic loading
663 {
664 QCString fileId = n->file;
665 if (!n->anchor.isEmpty())
666 {
667 fileId+="_"+n->anchor;
668 }
669 if (dupOfParent(n))
670 {
671 fileId+="_dup";
672 }
673 t << "\"" << fileId << "\" ]";
674 }
675 else // no children
676 {
677 t << "null ]";
678 }
679 }
680 else // show items in this file
681 {
682 bool firstChild=TRUE;
683 t << indentStr << " [ ";
684 generateJSLink(t,n);
685 bool emptySection = !generateJSTree(navIndex,t,n->children,level+1,firstChild);
686 if (emptySection)
687 t << "null ]";
688 else
689 t << "\n" << indentStr << " ] ]";
690 }
691 }
692 return found;
693}
A model of a file symbol.
Definition filedef.h:99
QCString fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:193
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:1954
static bool dupOfParent(const FTVNodePtr &n)
Definition ftvhelp.cpp:546
static void generateJSLink(TextStream &t, const FTVNodePtr &n)
Definition ftvhelp.cpp:554
static std::mutex g_navIndexMutex
Definition ftvhelp.cpp:612
static QCString pathToNode(const FTVNodePtr &leaf, const FTVNodePtr &n)
Definition ftvhelp.cpp:533
bool fileVisibleInIndex(const FileDef *fd, bool &genSourceFile)
Definition util.cpp:5999

References Config_getString, dupOfParent(), FALSE, fileVisibleInIndex(), QCString::fill(), g_navIndexMutex, generateJSLink(), generateJSTree(), node2URL(), pathToNode(), toFileDef(), TRUE, and Definition::TypeFile.

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

◆ generateJSTreeFiles()

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

Definition at line 695 of file ftvhelp.cpp.

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

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

Referenced by generateJSNavTree().

◆ node2URL()

QCString node2URL ( const FTVNodePtr & n,
bool overruleFile = FALSE,
bool srcLink = FALSE )
static

Definition at line 216 of file ftvhelp.cpp.

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

References addHtmlExtensionIfMissing(), QCString::at(), FALSE, Definition::getOutputFileBase(), Definition::getSourceFileBase(), QCString::isEmpty(), QCString::mid(), toFileDef(), and Definition::TypeFile.

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

◆ pathToNode()

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

Definition at line 533 of file ftvhelp.cpp.

534{
535 QCString result;
536 auto parent = n->parent.lock();
537 if (parent)
538 {
539 result+=pathToNode(leaf,parent);
540 }
541 result+=QCString().setNum(n->index);
542 if (leaf!=n) result+=",";
543 return result;
544}

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

Referenced by generateJSTree(), and pathToNode().

Variable Documentation

◆ folderId

int folderId =1
static

Definition at line 43 of file ftvhelp.cpp.

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

◆ g_navIndexMutex

std::mutex g_navIndexMutex
static

Definition at line 612 of file ftvhelp.cpp.

Referenced by generateJSTree().