Doxygen
FTVHelp类 参考

A class that generates a dynamic tree view side panel. 更多...

#include <ftvhelp.h>

+ 类 FTVHelp 继承关系图:
+ FTVHelp 的协作图:

Public 成员函数

 FTVHelp (bool LTI)
 
 ~FTVHelp ()
 
void initialize ()
 
void finalize ()
 
void incContentsDepth ()
 
void decContentsDepth ()
 
void addContentsItem (bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def)
 
void addIndexItem (const Definition *, const MemberDef *, const QCString &, const QCString &)
 
void addIndexFile (const QCString &)
 
void addImageFile (const QCString &)
 
void addStyleSheetFile (const QCString &)
 
void generateTreeView ()
 
void generateTreeViewInline (TextStream &t)
 
void generateTreeViewScripts ()
 
- Public 成员函数 继承自 IndexIntf
virtual ~IndexIntf ()
 

静态 Public 成员函数

static void generateTreeViewImages ()
 

Private 成员函数

void generateTree (TextStream &t, const std::vector< FTVNode * > &nl, int level, int maxLevel, int &index)
 
QCString generateIndentLabel (FTVNode *n, int level)
 
void generateIndent (TextStream &t, FTVNode *n, bool opened)
 
void generateLink (TextStream &t, FTVNode *n)
 

Private 属性

std::vector< std::vector< FTVNode * > > m_indentNodes
 
int m_indent
 
bool m_topLevelIndex
 

详细描述

A class that generates a dynamic tree view side panel.

在文件 ftvhelp.h36 行定义.

构造及析构函数说明

◆ FTVHelp()

FTVHelp::FTVHelp ( bool  TLI)

Constructs an ftv help object. The object has to be initialized before it can be used.

在文件 ftvhelp.cpp126 行定义.

127 {
128  /* initial depth */
129  m_indentNodes.resize(1);
130  m_indent=0;
131  m_topLevelIndex = TLI;
132 }

引用了 m_indent, m_indentNodes , 以及 m_topLevelIndex.

◆ ~FTVHelp()

FTVHelp::~FTVHelp ( )

Destroys the ftv help object.

在文件 ftvhelp.cpp135 行定义.

136 {
137  for (auto &idx : m_indentNodes)
138  {
139  for (auto &n : idx)
140  {
141  delete n;
142  }
143  idx.clear();
144  }
145  m_indentNodes.clear();
146 }

引用了 m_indentNodes.

成员函数说明

◆ addContentsItem()

void FTVHelp::addContentsItem ( bool  isDir,
const QCString name,
const QCString ref,
const QCString file,
const QCString anchor,
bool  separateIndex,
bool  addToNavIndex,
const Definition def 
)
virtual

Add a list item to the contents file.

参数
isDirTRUE if the item is a directory, FALSE if it is a text
namethe name of the item.
refthe URL of to the item.
filethe file containing the definition of the item
anchorthe anchor within the file.
separateIndexput the entries in a separate index file
addToNavIndexadd this entry to the quick navigation index
defDefinition corresponding to this entry

实现了 IndexIntf.

在文件 ftvhelp.cpp210 行定义.

219 {
220  //printf("%p: m_indent=%d addContentsItem(%s,%s,%s,%s)\n",this,m_indent,name,ref,file,anchor);
221  std::vector<FTVNode*> &nl = m_indentNodes[m_indent];
222  FTVNode *newNode = new FTVNode(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def);
223  if (!nl.empty())
224  {
225  nl.back()->isLast=FALSE;
226  }
227  nl.push_back(newNode);
228  newNode->index = static_cast<int>(nl.size()-1);
229  if (m_indent>0)
230  {
231  std::vector<FTVNode*> &pnl = m_indentNodes[m_indent-1];
232  if (!pnl.empty())
233  {
234  newNode->parent = pnl.back();
235  }
236  }
237 }

引用了 FALSE, FTVNode::index, m_indent, m_indentNodes , 以及 FTVNode::parent.

被这些函数引用 writeClassTree(), writeClassTreeForList(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptList(), writeConceptRootList(), writeConceptTreeInsideNamespaceElement(), writeDirHierarchy(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement() , 以及 writePages().

◆ addImageFile()

void FTVHelp::addImageFile ( const QCString )
inlinevirtual

实现了 IndexIntf.

在文件 ftvhelp.h55 行定义.

55 {}

◆ addIndexFile()

void FTVHelp::addIndexFile ( const QCString )
inlinevirtual

实现了 IndexIntf.

在文件 ftvhelp.h54 行定义.

54 {}

◆ addIndexItem()

void FTVHelp::addIndexItem ( const Definition ,
const MemberDef ,
const QCString ,
const QCString  
)
inlinevirtual

实现了 IndexIntf.

在文件 ftvhelp.h53 行定义.

53 {}

◆ addStyleSheetFile()

void FTVHelp::addStyleSheetFile ( const QCString )
inlinevirtual

实现了 IndexIntf.

在文件 ftvhelp.h56 行定义.

56 {}

◆ decContentsDepth()

void FTVHelp::decContentsDepth ( )
virtual

Decrease the level of the contents hierarchy. This will end the current sublist.

参见
incContentsDepth()

实现了 IndexIntf.

在文件 ftvhelp.cpp179 行定义.

180 {
181  //printf("%p: decContentsDepth() indent=%d\n",this,m_indent);
182  ASSERT(m_indent>0);
183  if (m_indent>0)
184  {
185  m_indent--;
186  std::vector<FTVNode*> &nl = m_indentNodes[m_indent];
187  if (!nl.empty())
188  {
189  FTVNode *parent = nl.back();
190  std::vector<FTVNode*> &children = m_indentNodes[m_indent+1];
191  for (const auto &child : children)
192  {
193  parent->children.push_back(child);
194  }
195  children.clear();
196  }
197  }
198 }

引用了 ASSERT, FTVNode::children, m_indent , 以及 m_indentNodes.

被这些函数引用 writeClassTree(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptTreeInsideNamespaceElement(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement() , 以及 writePages().

◆ finalize()

void FTVHelp::finalize ( )
virtual

Finalizes the FTV help. This will finish and close the contents file (index.js).

参见
initialize()

实现了 IndexIntf.

在文件 ftvhelp.cpp159 行定义.

160 {
162 }

引用了 generateTreeView().

◆ generateIndent()

void FTVHelp::generateIndent ( TextStream t,
FTVNode n,
bool  opened 
)
private

在文件 ftvhelp.cpp282 行定义.

283 {
284  int indent=0;
285  FTVNode *p = n->parent;
286  while (p) { indent++; p=p->parent; }
287  if (n->isDir)
288  {
289  QCString dir = opened ? "&#9660;" : "&#9658;";
290  t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\">&#160;</span>"
291  << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" ";
292  t << "onclick=\"toggleFolder('" << generateIndentLabel(n,0) << "')\"";
293  t << ">" << dir
294  << "</span>";
295  }
296  else
297  {
298  t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>";
299  }
300 }

引用了 generateIndentLabel(), FTVNode::isDir , 以及 FTVNode::parent.

被这些函数引用 generateTree().

◆ generateIndentLabel()

QCString FTVHelp::generateIndentLabel ( FTVNode n,
int  level 
)
private

在文件 ftvhelp.cpp271 行定义.

272 {
273  QCString result;
274  if (n->parent)
275  {
276  result=generateIndentLabel(n->parent,level+1);
277  }
278  result+=QCString().setNum(n->index)+"_";
279  return result;
280 }

引用了 FTVNode::index, FTVNode::parent , 以及 QCString::setNum().

被这些函数引用 generateIndent() , 以及 generateTree().

◆ generateLink()

void FTVHelp::generateLink ( TextStream t,
FTVNode n 
)
private

在文件 ftvhelp.cpp302 行定义.

303 {
304  //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n",
305  // qPrint(n->ref),qPrint(n->file),qPrint(n->anchor));
306  bool setTarget = FALSE;
307  if (n->file.isEmpty()) // no link
308  {
309  t << "<b>" << convertToHtml(n->name) << "</b>";
310  }
311  else // link into other frame
312  {
313  if (!n->ref.isEmpty()) // link to entity imported via tag file
314  {
315  t << "<a class=\"elRef\" ";
316  QCString result = externalLinkTarget();
317  if (result != "") setTarget = TRUE;
318  t << result;
319  }
320  else // local link
321  {
322  t << "<a class=\"el\" ";
323  }
324  t << "href=\"";
325  t << externalRef("",n->ref,TRUE);
326  t << node2URL(n);
327  if (!setTarget)
328  {
329  if (m_topLevelIndex)
330  t << "\" target=\"basefrm\">";
331  else
332  t << "\" target=\"_self\">";
333  }
334  else
335  {
336  t << "\">";
337  }
338  t << convertToHtml(n->name);
339  t << "</a>";
340  if (!n->ref.isEmpty())
341  {
342  t << "&#160;[external]";
343  }
344  }
345 }

引用了 convertToHtml(), externalLinkTarget(), externalRef(), FALSE, FTVNode::file, QCString::isEmpty(), m_topLevelIndex, FTVNode::name, node2URL(), FTVNode::ref , 以及 TRUE.

被这些函数引用 generateTree().

◆ generateTree()

void FTVHelp::generateTree ( TextStream t,
const std::vector< FTVNode * > &  nl,
int  level,
int  maxLevel,
int &  index 
)
private

在文件 ftvhelp.cpp386 行定义.

387 {
388  for (const auto &n : nl)
389  {
390  t << "<tr id=\"row_" << generateIndentLabel(n,0) << "\"";
391  if ((index&1)==0) // even row
392  t << " class=\"even\"";
393  if (level>=maxLevel) // item invisible by default
394  t << " style=\"display:none;\"";
395  else // item visible by default
396  index++;
397  t << "><td class=\"entry\">";
398  bool nodeOpened = level+1<maxLevel;
399  generateIndent(t,n,nodeOpened);
400  if (n->isDir)
401  {
402  if (n->def && n->def->definitionType()==Definition::TypeGroup)
403  {
404  // no icon
405  }
406  else if (n->def && n->def->definitionType()==Definition::TypePage)
407  {
408  // no icon
409  }
410  else if (n->def && n->def->definitionType()==Definition::TypeNamespace)
411  {
412  if (n->def->getLanguage() == SrcLangExt_Slice)
413  {
414  t << "<span class=\"icona\"><span class=\"icon\">M</span></span>";
415  }
416  else
417  {
418  t << "<span class=\"icona\"><span class=\"icon\">N</span></span>";
419  }
420  }
421  else if (n->def && n->def->definitionType()==Definition::TypeClass)
422  {
423  char icon=compoundIcon(toClassDef(n->def));
424  t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>";
425  }
426  else
427  {
428  t << "<span id=\"img_" << generateIndentLabel(n,0)
429  << "\" class=\"iconf"
430  << (nodeOpened?"open":"closed")
431  << "\" onclick=\"toggleFolder('" << generateIndentLabel(n,0)
432  << "')\">&#160;</span>";
433  }
434  generateLink(t,n);
435  t << "</td><td class=\"desc\">";
436  if (n->def)
437  {
438  generateBriefDoc(t,n->def);
439  }
440  t << "</td></tr>\n";
441  folderId++;
442  generateTree(t,n->children,level+1,maxLevel,index);
443  }
444  else // leaf node
445  {
446  const FileDef *srcRef=0;
447  if (n->def && n->def->definitionType()==Definition::TypeFile &&
448  (toFileDef(n->def))->generateSourceFile())
449  {
450  srcRef = toFileDef(n->def);
451  }
452  if (srcRef)
453  {
454  t << "<a href=\"" << addHtmlExtensionIfMissing(srcRef->getSourceFileBase())
455  << "\">";
456  }
457  if (n->def && n->def->definitionType()==Definition::TypeGroup)
458  {
459  // no icon
460  }
461  else if (n->def && n->def->definitionType()==Definition::TypePage)
462  {
463  // no icon
464  }
465  else if (n->def && n->def->definitionType()==Definition::TypeNamespace)
466  {
467  if (n->def->getLanguage() == SrcLangExt_Slice)
468  {
469  t << "<span class=\"icona\"><span class=\"icon\">M</span></span>";
470  }
471  else
472  {
473  t << "<span class=\"icona\"><span class=\"icon\">N</span></span>";
474  }
475  }
476  else if (n->def && n->def->definitionType()==Definition::TypeClass)
477  {
478  char icon=compoundIcon(toClassDef(n->def));
479  t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>";
480  }
481  else if (n->def && n->def->definitionType()==Definition::TypeConcept)
482  {
483  t << "<span class=\"icona\"><span class=\"icon\">R</span></span>";
484  }
485  else if (n->def && n->def->definitionType()==Definition::TypeDir)
486  {
487  t << "<span class=\"iconfclosed\"></span>";
488  }
489  else
490  {
491  t << "<span class=\"icondoc\"></span>";
492  }
493  if (srcRef)
494  {
495  t << "</a>";
496  }
497  generateLink(t,n);
498  t << "</td><td class=\"desc\">";
499  if (n->def)
500  {
501  generateBriefDoc(t,n->def);
502  }
503  t << "</td></tr>\n";
504  }
505  }
506 }

引用了 addHtmlExtensionIfMissing(), compoundIcon(), folderId, generateBriefDoc(), generateIndent(), generateIndentLabel(), generateLink(), FileDef::getSourceFileBase(), SrcLangExt_Slice, toClassDef(), toFileDef(), Definition::TypeClass, Definition::TypeConcept, Definition::TypeDir, Definition::TypeFile, Definition::TypeGroup, Definition::TypeNamespace , 以及 Definition::TypePage.

被这些函数引用 generateTreeViewInline().

◆ generateTreeView()

void FTVHelp::generateTreeView ( )

在文件 ftvhelp.cpp848 行定义.

849 {
852 }

引用了 generateTreeViewImages() , 以及 generateTreeViewScripts().

被这些函数引用 finalize().

◆ generateTreeViewImages()

void FTVHelp::generateTreeViewImages ( )
static

在文件 ftvhelp.cpp763 行定义.

764 {
765  QCString dname=Config_getString(HTML_OUTPUT);
766  const ResourceMgr &rm = ResourceMgr::instance();
767  rm.copyResource("doc.luma",dname);
768  rm.copyResource("folderopen.luma",dname);
769  rm.copyResource("folderclosed.luma",dname);
770  rm.copyResource("splitbar.lum",dname);
771 }

引用了 Config_getString, ResourceMgr::copyResource() , 以及 ResourceMgr::instance().

被这些函数引用 generateOutput() , 以及 generateTreeView().

◆ generateTreeViewInline()

void FTVHelp::generateTreeViewInline ( TextStream t)

在文件 ftvhelp.cpp787 行定义.

788 {
789  int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES);
790  t << "<div class=\"directory\">\n";
791  int d=1, depth=1;
792  for (const auto &n : m_indentNodes[0])
793  {
794  if (!n->children.empty())
795  {
796  d = n->computeTreeDepth(2);
797  if (d>depth) depth=d;
798  }
799  }
800  int preferredDepth = depth;
801  // write level selector
802  if (depth>1)
803  {
804  t << "<div class=\"levels\">[";
806  t << " ";
807  for (int i=1;i<=depth;i++)
808  {
809  t << "<span onclick=\"javascript:toggleLevel(" << i << ");\">" << i << "</span>";
810  }
811  t << "]</div>";
812 
813  if (preferredNumEntries>0)
814  {
815  preferredDepth=1;
816  for (int i=1;i<=depth;i++)
817  {
818  int num=0;
819  for (const auto &n : m_indentNodes[0])
820  {
821  num+=n->numNodesAtLevel(0,i);
822  }
823  if (num<=preferredNumEntries)
824  {
825  preferredDepth=i;
826  }
827  else
828  {
829  break;
830  }
831  }
832  }
833  }
834  //printf("preferred depth=%d\n",preferredDepth);
835 
836  if (!m_indentNodes[0].empty())
837  {
838  t << "<table class=\"directory\">\n";
839  int index=0;
840  generateTree(t,m_indentNodes[0],0,preferredDepth,index);
841  t << "</table>\n";
842  }
843 
844  t << "</div><!-- directory -->\n";
845 }

引用了 Config_getInt, generateTree(), m_indentNodes, theTranslator , 以及 Translator::trDetailLevel().

被这些函数引用 writeAnnotatedIndexGeneric(), writeConceptIndex(), writeFileIndex(), writeGroupIndex(), writeHierarchicalExceptionIndex(), writeHierarchicalIndex(), writeHierarchicalInterfaceIndex(), writeNamespaceIndex() , 以及 writePageIndex().

◆ generateTreeViewScripts()

void FTVHelp::generateTreeViewScripts ( )

在文件 ftvhelp.cpp774 行定义.

775 {
776  QCString htmlOutput = Config_getString(HTML_OUTPUT);
777 
778  // generate navtree.js & navtreeindex.js
780 
781  // copy resize.js & navtree.css
782  ResourceMgr::instance().copyResource("resize.js",htmlOutput);
783  ResourceMgr::instance().copyResource("navtree.css",htmlOutput);
784 }

引用了 Config_getString, ResourceMgr::copyResource(), generateJSNavTree(), ResourceMgr::instance() , 以及 m_indentNodes.

被这些函数引用 generateTreeView().

◆ incContentsDepth()

void FTVHelp::incContentsDepth ( )
virtual

Increase the level of the contents hierarchy. This will start a new sublist in contents file.

参见
decContentsDepth()

实现了 IndexIntf.

在文件 ftvhelp.cpp168 行定义.

169 {
170  //printf("%p: incContentsDepth() indent=%d\n",this,m_indent);
171  m_indent++;
172  m_indentNodes.resize(m_indent+1);
173 }

引用了 m_indent , 以及 m_indentNodes.

被这些函数引用 writeClassTree(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptTreeInsideNamespaceElement(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement() , 以及 writePages().

◆ initialize()

void FTVHelp::initialize ( )
virtual

This will create a folder tree view table of contents file (tree.js).

参见
finalize()

实现了 IndexIntf.

在文件 ftvhelp.cpp151 行定义.

152 {
153 }

类成员变量说明

◆ m_indent

int FTVHelp::m_indent
private

在文件 ftvhelp.h67 行定义.

被这些函数引用 addContentsItem(), decContentsDepth(), FTVHelp() , 以及 incContentsDepth().

◆ m_indentNodes

std::vector< std::vector<FTVNode*> > FTVHelp::m_indentNodes
private

◆ m_topLevelIndex

bool FTVHelp::m_topLevelIndex
private

在文件 ftvhelp.h68 行定义.

被这些函数引用 FTVHelp() , 以及 generateLink().


该类的文档由以下文件生成:
ResourceMgr::copyResource
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory
Definition: resourcemgr.cpp:180
ResourceMgr::instance
static ResourceMgr & instance()
Returns the one and only instance of this class
Definition: resourcemgr.cpp:32
FileDef::getSourceFileBase
virtual QCString getSourceFileBase() const =0
Translator::trDetailLevel
virtual QCString trDetailLevel()=0
FTVNode::parent
FTVNode * parent
Definition: ftvhelp.cpp:86
compoundIcon
static char compoundIcon(const ClassDef *cd)
Definition: ftvhelp.cpp:365
FTVNode::isDir
bool isDir
Definition: ftvhelp.cpp:79
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
FTVHelp::generateTree
void generateTree(TextStream &t, const std::vector< FTVNode * > &nl, int level, int maxLevel, int &index)
Definition: ftvhelp.cpp:386
Definition::TypePage
@ TypePage
Definition: definition.h:93
Definition::TypeGroup
@ TypeGroup
Definition: definition.h:91
FTVHelp::generateIndentLabel
QCString generateIndentLabel(FTVNode *n, int level)
Definition: ftvhelp.cpp:271
FTVNode::file
QCString file
Definition: ftvhelp.cpp:81
addHtmlExtensionIfMissing
QCString addHtmlExtensionIfMissing(const QCString &fName)
Definition: util.cpp:5275
FTVHelp::generateLink
void generateLink(TextStream &t, FTVNode *n)
Definition: ftvhelp.cpp:302
Definition::TypeNamespace
@ TypeNamespace
Definition: definition.h:89
Config_getInt
#define Config_getInt(name)
Definition: config.h:34
generateBriefDoc
static void generateBriefDoc(TextStream &t, const Definition *def)
Definition: ftvhelp.cpp:347
FTVHelp::m_topLevelIndex
bool m_topLevelIndex
Definition: ftvhelp.h:68
Definition::TypeFile
@ TypeFile
Definition: definition.h:88
FTVNode::ref
QCString ref
Definition: ftvhelp.cpp:80
theTranslator
Translator * theTranslator
Definition: language.cpp:156
FTVHelp::generateTreeView
void generateTreeView()
Definition: ftvhelp.cpp:848
FTVNode::name
QCString name
Definition: ftvhelp.cpp:83
Definition::TypeConcept
@ TypeConcept
Definition: definition.h:95
FTVNode::index
int index
Definition: ftvhelp.cpp:84
generateJSNavTree
static void generateJSNavTree(const std::vector< FTVNode * > &nodeList)
Definition: ftvhelp.cpp:653
TRUE
#define TRUE
Definition: qcstring.h:36
Definition::TypeDir
@ TypeDir
Definition: definition.h:94
toClassDef
ClassDef * toClassDef(Definition *d)
Definition: classdef.cpp:4907
Definition::TypeClass
@ TypeClass
Definition: definition.h:87
externalLinkTarget
QCString externalLinkTarget(const bool parent)
Definition: util.cpp:6323
QCString::setNum
QCString & setNum(short n)
Definition: qcstring.h:372
node2URL
static QCString node2URL(const FTVNode *n, bool overruleFile=FALSE, bool srcLink=FALSE)
Definition: ftvhelp.cpp:239
FTVHelp::generateTreeViewImages
static void generateTreeViewImages()
Definition: ftvhelp.cpp:763
ResourceMgr
Singleton for managing resources compiled into an executable
Definition: resourcemgr.h:35
FTVNode::children
std::vector< FTVNode * > children
Definition: ftvhelp.cpp:85
Config_getString
#define Config_getString(name)
Definition: config.h:32
folderId
static int folderId
Definition: ftvhelp.cpp:40
ASSERT
#define ASSERT(x)
Definition: qcstring.h:44
FileDef
A model of a file symbol.
Definition: filedef.h:73
FTVHelp::generateTreeViewScripts
void generateTreeViewScripts()
Definition: ftvhelp.cpp:774
toFileDef
FileDef * toFileDef(Definition *d)
Definition: filedef.cpp:1778
FTVHelp::m_indentNodes
std::vector< std::vector< FTVNode * > > m_indentNodes
Definition: ftvhelp.h:66
externalRef
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition: util.cpp:6334
FTVNode
Definition: ftvhelp.cpp:68
FTVHelp::generateIndent
void generateIndent(TextStream &t, FTVNode *n, bool opened)
Definition: ftvhelp.cpp:282
convertToHtml
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition: util.cpp:4063
FTVHelp::m_indent
int m_indent
Definition: ftvhelp.h:67
FALSE
#define FALSE
Definition: qcstring.h:33
SrcLangExt_Slice
@ SrcLangExt_Slice
Definition: types.h:59
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108