浏览该文件的文档.
43 @licstart The following is the entire license notice for the JavaScript code in this file.
47 Copyright (C) 1997-2020 by Dimitri van Heesch
49 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
50 and associated documentation files (the "Software"), to deal in the Software without restriction,
51 including without limitation the rights to use, copy, modify, merge, publish, distribute,
52 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
53 furnished to do so, subject to the following conditions:
55 The above copyright notice and this permission notice shall be included in all copies or
56 substantial portions of the Software.
58 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
59 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
60 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
61 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64 @licend The above is the entire license notice for the JavaScript code in this file
97 if (!n->children.empty())
99 int d = n->computeTreeDepth(level+1);
100 if (d>maxDepth) maxDepth=d;
114 num+=n->numNodesAtLevel(level+1,maxLevel);
191 for (
const auto &child : children)
222 FTVNode *newNode =
new FTVNode(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def);
225 nl.back()->isLast=
FALSE;
227 nl.push_back(newNode);
228 newNode->
index =
static_cast<int>(nl.size()-1);
234 newNode->
parent = pnl.back();
247 else if (!url.
isEmpty() && url.
at(0)==
'^')
286 while (p) { indent++; p=p->
parent; }
289 QCString dir = opened ?
"▼" :
"►";
290 t <<
"<span style=\"width:" << (indent*16) <<
"px;display:inline-block;\"> </span>"
298 t <<
"<span style=\"width:" << ((indent+1)*16) <<
"px;display:inline-block;\"> </span>";
306 bool setTarget =
FALSE;
315 t <<
"<a class=\"elRef\" ";
317 if (result !=
"") setTarget =
TRUE;
322 t <<
"<a class=\"el\" ";
330 t <<
"\" target=\"basefrm\">";
332 t <<
"\" target=\"_self\">";
342 t <<
" [external]";
360 auto visitor = std::make_unique<HtmlDocVisitor>(t,htmlGen,def);
361 root->accept(visitor.get());
388 for (
const auto &n : nl)
392 t <<
" class=\"even\"";
394 t <<
" style=\"display:none;\"";
397 t <<
"><td class=\"entry\">";
398 bool nodeOpened = level+1<maxLevel;
414 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
418 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
424 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
429 <<
"\" class=\"iconf"
430 << (nodeOpened?
"open":
"closed")
432 <<
"')\"> </span>";
435 t <<
"</td><td class=\"desc\">";
448 (
toFileDef(n->def))->generateSourceFile())
469 t <<
"<span class=\"icona\"><span class=\"icon\">M</span></span>";
473 t <<
"<span class=\"icona\"><span class=\"icon\">N</span></span>";
479 t <<
"<span class=\"icona\"><span class=\"icon\">" << icon <<
"</span></span>";
483 t <<
"<span class=\"icona\"><span class=\"icon\">R</span></span>";
487 t <<
"<span class=\"iconfclosed\"></span>";
491 t <<
"<span class=\"icondoc\"></span>";
498 t <<
"</td><td class=\"desc\">";
529 if (leaf!=n) result+=
",";
559 if (i>=0) varId = varId.
mid(i+1);
564 const std::vector<FTVNode*> &nl,
int level,
bool &first)
568 indentStr.
fill(
' ',level*2);
570 for (
const auto &n : nl)
573 if (!first) t <<
",\n";
583 if (n->addToNavIndex)
605 if (n->separateIndex)
607 bool firstChild=
TRUE;
608 t << indentStr <<
" [ ";
610 if (!n->children.empty())
613 if (!n->anchor.isEmpty())
615 fileId+=
"_"+n->anchor;
621 QCString fileName = htmlOutput+
"/"+fileId+
".js";
622 std::ofstream f(fileName.
str(),std::ofstream::out | std::ofstream::binary);
631 t <<
"\"" << fileId <<
"\" ]";
640 bool firstChild=
TRUE;
641 t << indentStr <<
" [ ";
643 bool emptySection = !
generateJSTree(navIndex,t,n->children,level+1,firstChild);
647 t <<
"\n" << indentStr <<
" ] ]";
656 std::ofstream f(htmlOutput.
str()+
"/navtreedata.js",std::ofstream::out | std::ofstream::binary);
665 t <<
"var NAVTREE =\n";
702 std::sort(navIndex.begin(),navIndex.end(),[](
const auto &n1,
const auto &n2)
703 { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); });
707 const int maxElemCount=250;
708 std::ofstream tsidx(htmlOutput.
str()+
"/navtreeindex0.js",std::ofstream::out | std::ofstream::binary);
711 t <<
"var NAVTREEINDEX =\n";
713 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
716 auto it = navIndex.begin();
717 while (it!=navIndex.end())
730 t <<
"\"" << e.
url <<
"\"";
732 tsidx <<
"\"" << e.
url <<
"\":[" << e.
path <<
"]";
734 if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx <<
",";
738 if (it!=navIndex.end() && elemCount>=maxElemCount)
745 tsidx.open(fileName.
str(),std::ofstream::out | std::ofstream::binary);
746 if (!tsidx.is_open())
break;
747 tsidx <<
"var NAVTREEINDEX" << subIndex <<
" =\n";
789 int preferredNumEntries =
Config_getInt(HTML_INDEX_NUM_ENTRIES);
790 t <<
"<div class=\"directory\">\n";
794 if (!n->children.empty())
796 d = n->computeTreeDepth(2);
797 if (d>depth) depth=d;
800 int preferredDepth = depth;
804 t <<
"<div class=\"levels\">[";
807 for (
int i=1;i<=depth;i++)
809 t <<
"<span onclick=\"javascript:toggleLevel(" << i <<
");\">" << i <<
"</span>";
813 if (preferredNumEntries>0)
816 for (
int i=1;i<=depth;i++)
821 num+=n->numNodesAtLevel(0,i);
823 if (num<=preferredNumEntries)
838 t <<
"<table class=\"directory\">\n";
844 t <<
"</div><!-- directory -->\n";
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory
static ResourceMgr & instance()
Returns the one and only instance of this class
Base class for the layout of a navigation item at the top of the HTML pages.
virtual QCString getSourceFileBase() const =0
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
static std::unique_ptr< PageDef > mainPage
static void generateJSLink(TextStream &t, const FTVNode *n)
virtual QCString trDetailLevel()=0
The common base class of all entity definitions found in the sources.
QCString relativePathToRoot(const QCString &name)
static char compoundIcon(const ClassDef *cd)
static QCString pathToNode(const FTVNode *leaf, const FTVNode *n)
int findRev(char c, int index=-1, bool cs=TRUE) const
bool isEmpty() const
Returns TRUE iff the string is empty
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
static bool dupOfParent(const FTVNode *n)
void generateTree(TextStream &t, const std::vector< FTVNode * > &nl, int level, int maxLevel, int &index)
void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)
void generateTreeViewInline(TextStream &t)
char & at(size_t i)
Returns a reference to the character at index i.
Text streaming class that buffers data.
virtual int briefLine() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
QCString generateIndentLabel(FTVNode *n, int level)
NavIndexEntry(const QCString &u, const QCString &p)
static bool generateJSTree(NavIndexEntryList &navIndex, TextStream &t, const std::vector< FTVNode * > &nl, int level, bool &first)
FTVNode(bool dir, const QCString &r, const QCString &f, const QCString &a, const QCString &n, bool sepIndex, bool navIndex, const Definition *df)
QCString addHtmlExtensionIfMissing(const QCString &fName)
void generateLink(TextStream &t, FTVNode *n)
A abstract class representing of a compound symbol.
#define Config_getInt(name)
bool fileVisibleInIndex(const FileDef *fd, bool &genSourceFile)
static void generateBriefDoc(TextStream &t, const Definition *def)
Translator * theTranslator
const char * JAVASCRIPT_LICENSE_TEXT
DocRoot * 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)
static void generateJSNavTree(const std::vector< FTVNode * > &nodeList)
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString getOutputFileBase() const =0
int numNodesAtLevel(int level, int maxLevel) const
ClassDef * toClassDef(Definition *d)
bool fill(char c, int len=-1)
Fills a string with a predefined character
virtual DefType definitionType() const =0
virtual QCString briefFile() const =0
QCString externalLinkTarget(const bool parent)
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e.
QCString & setNum(short n)
static QCString node2URL(const FTVNode *n, bool overruleFile=FALSE, bool srcLink=FALSE)
static void generateTreeViewImages()
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
#define Config_getBool(name)
static QCString htmlFileExtension
Singleton for managing resources compiled into an executable
static LayoutDocManager & instance()
Returns a reference to this singleton.
virtual QCString trPanelSynchronisationTooltip(bool enable)=0
std::vector< FTVNode * > children
#define Config_getString(name)
A model of a file symbol.
QCString convertToJSString(const QCString &s)
void generateTreeViewScripts()
FileDef * toFileDef(Definition *d)
std::vector< std::vector< FTVNode * > > m_indentNodes
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
virtual QCString getOutputFileBase() const =0
A bunch of utility functions.
int computeTreeDepth(int level) const
void generateIndent(TextStream &t, FTVNode *n, bool opened)
QCString convertToHtml(const QCString &s, bool keepEntities)
static QCString convertFileId2Var(const QCString &fileId)
std::unique_ptr< IDocParser > createDocParser()
This is an alternative implementation of QCString.