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 576 of file ftvhelp.cpp.

Function Documentation

◆ collectJSTreeFiles()

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

Definition at line 578 of file ftvhelp.cpp.

579{
580 QCString htmlOutput = Config_getString(HTML_OUTPUT);
581 for (const auto &n : nl)
582 {
583 if (n->separateIndex) // add new file if there are children
584 {
585 if (!n->children.empty())
586 {
587 QCString fileId = n->file;
588 files.emplace_back(fileId,n);
589 collectJSTreeFiles(n->children,files);
590 }
591 }
592 else // traverse without adding a new file
593 {
594 collectJSTreeFiles(n->children,files);
595 }
596 }
597}
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:578

References collectJSTreeFiles(), and Config_getString.

Referenced by collectJSTreeFiles(), and generateJSTreeFiles().

◆ compoundIcon()

char compoundIcon ( const ClassDef * cd)
static

Definition at line 347 of file ftvhelp.cpp.

348{
349 char icon='C';
350 if (cd->getLanguage() == SrcLangExt::Slice)
351 {
353 {
354 icon='I';
355 }
356 else if (cd->compoundType()==ClassDef::Struct)
357 {
358 icon='S';
359 }
360 else if (cd->compoundType()==ClassDef::Exception)
361 {
362 icon='E';
363 }
364 }
365 return icon;
366}
@ 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 560 of file ftvhelp.cpp.

561{
562 QCString varId = fileId;
563 int i=varId.findRev('/');
564 if (i>=0) varId = varId.mid(i+1);
565 return substitute(varId,"-","_");
566}
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477

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

Referenced by generateJSTreeFiles().

◆ dupOfParent()

bool dupOfParent ( const FTVNodePtr & n)
static

Definition at line 535 of file ftvhelp.cpp.

536{
537 auto parent = n->parent.lock();
538 if (!parent) return FALSE;
539 if (n->file==parent->file) return TRUE;
540 return FALSE;
541}
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:1324
#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 324 of file ftvhelp.cpp.

325{
326 QCString brief = def->briefDescription(TRUE);
327 //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,qPrint(def->name()),qPrint(brief));
328 if (!brief.isEmpty())
329 {
330 auto parser { createDocParser() };
331 auto ast { validatingParseDoc(*parser.get(),
332 def->briefFile(),def->briefLine(),
333 def,nullptr,brief,FALSE,FALSE,
334 QCString(),TRUE,TRUE,Config_getBool(MARKDOWN_SUPPORT)) };
335 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
336 if (astImpl)
337 {
339 OutputCodeList htmlList;
340 htmlList.add<HtmlCodeGenerator>(&t,relPath);
341 HtmlDocVisitor visitor(t,htmlList,def);
342 std::visit(visitor,astImpl->root);
343 }
344 }
345}
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:1460
DocNodeVariant root
Definition docnode.h:1481
Generator for HTML code fragments.
Definition htmlgen.h:25
Concrete visitor implementation for HTML output.
Class representing a list of different code generators.
Definition outputlist.h:164
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:194
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
#define Config_getBool(name)
Definition config.h:33
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:55
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)
QCString relativePathToRoot(const QCString &name)
Definition util.cpp:4088

References OutputCodeList::add(), Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), Config_getBool, createDocParser(), FALSE, 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 257 of file ftvhelp.cpp.

258{
259 int indent=0;
260 auto parent = n->parent.lock();
261 while (parent) { indent++; parent=parent->parent.lock(); }
262 if (n->isDir)
263 {
264 const char *ARROW_DOWN = "<span class=\"arrowhead opened\"></span>";
265 const char *ARROW_RIGHT = "<span class=\"arrowhead closed\"></span>";
266 QCString dir = opened ? ARROW_DOWN : ARROW_RIGHT;
267 t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\">&#160;</span>"
268 << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" ";
269 t << "onclick=\"dynsection.toggleFolder('" << generateIndentLabel(n,0) << "')\"";
270 t << ">" << dir
271 << "</span>";
272 }
273 else
274 {
275 t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>";
276 }
277}
static QCString generateIndentLabel(const FTVNodePtr &n, int level)
Definition ftvhelp.cpp:245

References generateIndentLabel(), and parent().

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

◆ generateIndentLabel()

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

Definition at line 245 of file ftvhelp.cpp.

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

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 543 of file ftvhelp.cpp.

544{
545 if (n->file.isEmpty()) // no link
546 {
547 t << "\"" << convertToJSString(n->name) << "\", null, ";
548 }
549 else // link into other page
550 {
551 QCString result = n->name;
552 if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result);
553 t << "\"" << convertToJSString(result) << "\", \"";
554 t << externalRef("",n->ref,TRUE);
555 t << node2URL(n);
556 t << "\", ";
557 }
558}
static QCString node2URL(const FTVNodePtr &n, bool overruleFile=FALSE, bool srcLink=FALSE)
Definition ftvhelp.cpp:213
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:6231
QCString stripScope(const QCString &name)
Definition util.cpp:4288
QCString convertToJSString(const QCString &s)
Definition util.cpp:4532

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

Referenced by generateJSTree().

◆ generateJSNavTree()

void generateJSNavTree ( const FTVNodes & nodeList)
static

Definition at line 733 of file ftvhelp.cpp.

734{
735 QCString htmlOutput = Config_getString(HTML_OUTPUT);
736 std::ofstream f = Portable::openOutputStream(htmlOutput+"/navtreedata.js");
737 NavIndexEntryList navIndex;
738 if (f.is_open())
739 {
740 TextStream t(&f);
741 //TextStream tidx(&fidx);
742 //tidx << "var NAVTREEINDEX =\n";
743 //tidx << "{\n";
745 t << "var NAVTREE =\n";
746 t << "[\n";
747 t << " [ ";
748 QCString projName = Config_getString(PROJECT_NAME);
749 if (projName.isEmpty())
750 {
751 if (mainPageHasTitle()) // Use title of main page as root
752 {
753 t << "\"" << convertToJSString(Doxygen::mainPage->title()) << "\", ";
754 }
755 else // Use default section title as root
756 {
757 LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::MainPage);
758 t << "\"" << convertToJSString(lne->title()) << "\", ";
759 }
760 }
761 else // use PROJECT_NAME as root tree element
762 {
763 t << "\"" << convertToJSString(projName) << "\", ";
764 }
765 t << "\"index" << Doxygen::htmlFileExtension << "\", ";
766
767 // add special entry for index page
768 navIndex.emplace_back("index"+Doxygen::htmlFileExtension,"");
769 // related page index is written as a child of index.html, so add this as well
770 navIndex.emplace_back("pages"+Doxygen::htmlFileExtension,"");
771
772 bool first=TRUE;
773 generateJSTree(navIndex,t,nodeList,1,first);
774 generateJSTreeFiles(navIndex,t,nodeList);
775
776 if (first)
777 t << "]\n";
778 else
779 t << "\n ] ]\n";
780 t << "];\n\n";
781
782 // write the navigation index (and sub-indices)
783 std::stable_sort(navIndex.begin(),navIndex.end(),[](const auto &n1,const auto &n2)
784 { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); });
785
786 int subIndex=0;
787 int elemCount=0;
788 const int maxElemCount=250;
789 std::ofstream tsidx = Portable::openOutputStream(htmlOutput+"/navtreeindex0.js");
790 if (tsidx.is_open())
791 {
792 t << "var NAVTREEINDEX =\n";
793 t << "[\n";
794 tsidx << "var NAVTREEINDEX" << subIndex << " =\n";
795 tsidx << "{\n";
796 first=TRUE;
797 auto it = navIndex.begin();
798 while (it!=navIndex.end())
799 {
800 const NavIndexEntry &e = *it;
801 if (elemCount==0)
802 {
803 if (!first)
804 {
805 t << ",\n";
806 }
807 else
808 {
809 first=FALSE;
810 }
811 t << "\"" << e.url << "\"";
812 }
813 tsidx << "\"" << e.url << "\":[" << e.path << "]";
814 ++it;
815 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx << ","; // not last entry
816 tsidx << "\n";
817
818 elemCount++;
819 if (it!=navIndex.end() && elemCount>=maxElemCount) // switch to new sub-index
820 {
821 tsidx << "};\n";
822 elemCount=0;
823 tsidx.close();
824 subIndex++;
825 QCString fileName = htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js";
826 tsidx = Portable::openOutputStream(fileName);
827 if (!tsidx.is_open()) break;
828 tsidx << "var NAVTREEINDEX" << subIndex << " =\n";
829 tsidx << "{\n";
830 }
831 }
832 tsidx << "};\n";
833 t << "\n];\n";
834 }
835 t << "\nvar SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(FALSE) << "';";
836 t << "\nvar SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(TRUE) << "';";
837 }
838
839 auto &mgr = ResourceMgr::instance();
840 {
841 std::ofstream fn = Portable::openOutputStream(htmlOutput+"/navtree.js");
842 if (fn.is_open())
843 {
844 TextStream t(&fn);
845 t << substitute(mgr.getAsString("navtree.js"),"$PROJECTID",getProjectId());
846 }
847 }
848}
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:519
static ResourceMgr & instance()
Returns the one and only instance of this class.
Text streaming class that buffers data.
Definition textstream.h:36
static bool generateJSTree(NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nl, int level, bool &first)
Definition ftvhelp.cpp:601
static void generateJSTreeFiles(NavIndexEntryList &navIndex, TextStream &t, const FTVNodes &nodeList)
Definition ftvhelp.cpp:682
constexpr auto JAVASCRIPT_LICENSE_TEXT
Definition ftvhelp.h:71
Translator * theTranslator
Definition language.cpp:71
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:665
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:512
QCString url
Definition ftvhelp.cpp:514
QCString path
Definition ftvhelp.cpp:515
bool mainPageHasTitle()
Definition util.cpp:6760
QCString getProjectId()
Definition util.cpp:7287

References 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 601 of file ftvhelp.cpp.

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

References Config_getString, dupOfParent(), FALSE, fileVisibleInIndex(), QCString::fill(), found, 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 682 of file ftvhelp.cpp.

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

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 213 of file ftvhelp.cpp.

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

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 522 of file ftvhelp.cpp.

523{
524 QCString result;
525 auto parent = n->parent.lock();
526 if (parent)
527 {
528 result+=pathToNode(leaf,parent);
529 }
530 result+=QCString().setNum(n->index);
531 if (leaf!=n) result+=",";
532 return result;
533}

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 599 of file ftvhelp.cpp.

Referenced by generateJSTree().