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

Function Documentation

◆ collectJSTreeFiles()

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

Definition at line 576 of file ftvhelp.cpp.

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

References collectJSTreeFiles(), and Config_getString.

Referenced by collectJSTreeFiles(), and generateJSTreeFiles().

◆ compoundIcon()

static char compoundIcon ( const ClassDef * cd)
static

Definition at line 345 of file ftvhelp.cpp.

346{
347 char icon='C';
348 if (cd->getLanguage() == SrcLangExt::Slice)
349 {
351 {
352 icon='I';
353 }
354 else if (cd->compoundType()==ClassDef::Struct)
355 {
356 icon='S';
357 }
358 else if (cd->compoundType()==ClassDef::Exception)
359 {
360 icon='E';
361 }
362 }
363 return icon;
364}
@ 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.
@ Slice
Definition types.h:59

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

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

◆ convertFileId2Var()

static QCString convertFileId2Var ( const QCString & fileId)
static

Definition at line 558 of file ftvhelp.cpp.

559{
560 QCString varId = fileId;
561 int i=varId.findRev('/');
562 if (i>=0) varId = varId.mid(i+1);
563 return substitute(varId,"-","_");
564}
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()

static bool dupOfParent ( const FTVNodePtr & n)
static

Definition at line 533 of file ftvhelp.cpp.

534{
535 auto parent = n->parent.lock();
536 if (!parent) return FALSE;
537 if (n->file==parent->file) return TRUE;
538 return FALSE;
539}
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()

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

Definition at line 322 of file ftvhelp.cpp.

323{
324 QCString brief = def->briefDescription(TRUE);
325 //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,qPrint(def->name()),qPrint(brief));
326 if (!brief.isEmpty())
327 {
328 auto parser { createDocParser() };
329 auto ast { validatingParseDoc(*parser.get(),
330 def->briefFile(),def->briefLine(),
331 def,nullptr,brief,FALSE,FALSE,
332 QCString(),TRUE,TRUE,Config_getBool(MARKDOWN_SUPPORT)) };
333 const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
334 if (astImpl)
335 {
337 OutputCodeList htmlList;
338 htmlList.add<HtmlCodeGenerator>(&t,relPath);
339 HtmlDocVisitor visitor(t,htmlList,def);
340 std::visit(visitor,astImpl->root);
341 }
342 }
343}
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:54
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:3933

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()

static 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 QCString dir = opened ? "&#9660;" : "&#9658;";
265 t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\">&#160;</span>"
266 << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" ";
267 t << "onclick=\"dynsection.toggleFolder('" << generateIndentLabel(n,0) << "')\"";
268 t << ">" << dir
269 << "</span>";
270 }
271 else
272 {
273 t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>";
274 }
275}
static QCString generateIndentLabel(const FTVNodePtr &n, int level)
Definition ftvhelp.cpp:245

References generateIndentLabel(), and parent().

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

◆ generateIndentLabel()

static 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()

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

Definition at line 541 of file ftvhelp.cpp.

542{
543 if (n->file.isEmpty()) // no link
544 {
545 t << "\"" << convertToJSString(n->name) << "\", null, ";
546 }
547 else // link into other page
548 {
549 QCString result = n->name;
550 if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result);
551 t << "\"" << convertToJSString(result) << "\", \"";
552 t << externalRef("",n->ref,TRUE);
553 t << node2URL(n);
554 t << "\", ";
555 }
556}
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:6066
QCString stripScope(const QCString &name)
Definition util.cpp:4133
QCString convertToJSString(const QCString &s)
Definition util.cpp:4377

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

Referenced by generateJSTree().

◆ generateJSNavTree()

static void generateJSNavTree ( const FTVNodes & nodeList)
static

Definition at line 731 of file ftvhelp.cpp.

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

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()

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

Definition at line 599 of file ftvhelp.cpp.

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

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()

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

Definition at line 680 of file ftvhelp.cpp.

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

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

Referenced by generateJSNavTree().

◆ node2URL()

static 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:5243

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()

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

Definition at line 520 of file ftvhelp.cpp.

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

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

Referenced by generateJSTree().