Doxygen
Loading...
Searching...
No Matches
FTVHelp Class Reference

A class that generates a dynamic tree view side panel. More...

#include <src/ftvhelp.h>

Inheritance diagram for FTVHelp:
Collaboration diagram for FTVHelp:

Classes

struct  Private

Public Member Functions

 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, const QCString &nameAsHtml=QCString())
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 ()

Private Attributes

std::unique_ptr< Privatep

Detailed Description

A class that generates a dynamic tree view side panel.

Definition at line 40 of file ftvhelp.h.

Constructor & Destructor Documentation

◆ FTVHelp()

FTVHelp::FTVHelp ( bool TLI)

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

Definition at line 120 of file ftvhelp.cpp.

120: p(std::make_unique<Private>(TLI)) {}
std::unique_ptr< Private > p
Definition ftvhelp.h:69

References p.

Referenced by ~FTVHelp().

◆ ~FTVHelp()

FTVHelp::~FTVHelp ( )
default

References FTVHelp().

Member Function Documentation

◆ 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,
const QCString & nameAsHtml = QCString() )
virtual

Add a list item to the contents file.

Parameters
isDirTRUE if the item is a directory, FALSE if it is a text
namethe name of the item.
nameAsHtmlthe name of the item in HTML format.
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

Implements IndexIntf.

Definition at line 186 of file ftvhelp.cpp.

196{
197 //printf("%p: p->indent=%d addContentsItem(isDir=%d,name=%s,ref=%s,file=%s,anchor=%s,nameAsHtml=%s)\n",(void*)this,p->indent,isDir,qPrint(name),qPrint(ref),qPrint(file),qPrint(anchor),qPrint(nameAsHtml));
198 auto &nl = p->indentNodes[p->indent];
199 if (!nl.empty())
200 {
201 nl.back()->isLast=FALSE;
202 }
203 auto newNode = std::make_shared<FTVNode>(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def,nameAsHtml);
204 nl.push_back(newNode);
205 newNode->index = static_cast<int>(nl.size()-1);
206 if (p->indent>0)
207 {
208 auto &pnl = p->indentNodes[p->indent-1];
209 if (!pnl.empty())
210 {
211 newNode->parent = pnl.back();
212 }
213 }
214}
#define FALSE
Definition qcstring.h:34

References FALSE, and p.

Referenced by writeClassTree(), writeClassTreeForList(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptList(), writeConceptRootList(), writeConceptTreeInsideNamespaceElement(), writeDirHierarchy(), writeDirTreeNode(), writeGroupTreeNode(), writeModuleTreeNode(), writeNamespaceTreeElement(), and writePages().

◆ addImageFile()

void FTVHelp::addImageFile ( const QCString & )
inlinevirtual

Implements IndexIntf.

Definition at line 62 of file ftvhelp.h.

62{}

◆ addIndexFile()

void FTVHelp::addIndexFile ( const QCString & )
inlinevirtual

Implements IndexIntf.

Definition at line 61 of file ftvhelp.h.

61{}

◆ addIndexItem()

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

Implements IndexIntf.

Definition at line 60 of file ftvhelp.h.

60{}

◆ addStyleSheetFile()

void FTVHelp::addStyleSheetFile ( const QCString & )
inlinevirtual

Implements IndexIntf.

Definition at line 63 of file ftvhelp.h.

63{}

◆ decContentsDepth()

void FTVHelp::decContentsDepth ( )
virtual

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

See also
incContentsDepth()

Implements IndexIntf.

Definition at line 154 of file ftvhelp.cpp.

155{
156 //printf("%p: decContentsDepth() indent=%d\n",this,p->indent);
157 ASSERT(p->indent>0);
158 if (p->indent>0)
159 {
160 p->indent--;
161 auto &nl = p->indentNodes[p->indent];
162 if (!nl.empty())
163 {
164 auto &parent = nl.back();
165 auto &children = p->indentNodes[p->indent+1];
166 for (const auto &child : children)
167 {
168 parent->children.push_back(child);
169 }
170 children.clear();
171 }
172 }
173}
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:1327
#define ASSERT(x)
Definition qcstring.h:39

References ASSERT, p, and parent().

Referenced by writeClassTree(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptTreeInsideNamespaceElement(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement(), and writePages().

◆ finalize()

void FTVHelp::finalize ( )
virtual

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

See also
initialize()

Implements IndexIntf.

Definition at line 134 of file ftvhelp.cpp.

135{
137}
void generateTreeView()
Definition ftvhelp.cpp:946

References generateTreeView().

◆ generateTreeView()

void FTVHelp::generateTreeView ( )

Definition at line 946 of file ftvhelp.cpp.

947{
949}
void generateTreeViewScripts()
Definition ftvhelp.cpp:872

References generateTreeViewScripts().

Referenced by finalize().

◆ generateTreeViewInline()

void FTVHelp::generateTreeViewInline ( TextStream & t)

Definition at line 881 of file ftvhelp.cpp.

882{
883 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
884 int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES);
885 t << "<div class=\"directory\">\n";
886 int d=1, depth=1;
887 for (const auto &n : p->indentNodes[0])
888 {
889 if (!n->children.empty())
890 {
891 d = n->computeTreeDepth(2);
892 if (d>depth) depth=d;
893 }
894 }
895 int preferredDepth = depth;
896 // write level selector
897 if (depth>1)
898 {
899 if (dynamicSections)
900 {
901 t << "<div class=\"levels\">[";
903 t << " ";
904 for (int i=1;i<=depth;i++)
905 {
906 t << "<span onclick=\"javascript:dynsection.toggleLevel(" << i << ");\">" << i << "</span>";
907 }
908 t << "]</div>";
909 }
910
911 if (preferredNumEntries>0)
912 {
913 preferredDepth=1;
914 for (int i=1;i<=depth;i++)
915 {
916 int num=0;
917 for (const auto &n : p->indentNodes[0])
918 {
919 num+=n->numNodesAtLevel(0,i);
920 }
921 if (num<=preferredNumEntries)
922 {
923 preferredDepth=i;
924 }
925 else
926 {
927 break;
928 }
929 }
930 }
931 }
932 //printf("preferred depth=%d\n",preferredDepth);
933
934 if (!p->indentNodes[0].empty())
935 {
936 t << "<table class=\"directory\">\n";
937 int index=0;
938 p->generateTree(t,p->indentNodes[0],0,preferredDepth,index);
939 t << "</table>\n";
940 }
941
942 t << "</div><!-- directory -->\n";
943}
virtual QCString trDetailLevel()=0
#define Config_getInt(name)
Definition config.h:34
#define Config_getBool(name)
Definition config.h:33
Translator * theTranslator
Definition language.cpp:71

References Config_getBool, Config_getInt, p, and theTranslator.

Referenced by writeAnnotatedIndexGeneric(), writeConceptIndex(), writeFileIndex(), writeHierarchicalExceptionIndex(), writeHierarchicalIndex(), writeHierarchicalInterfaceIndex(), writeModuleIndex(), writeNamespaceIndex(), writePageIndex(), and writeTopicIndex().

◆ generateTreeViewScripts()

void FTVHelp::generateTreeViewScripts ( )

Definition at line 872 of file ftvhelp.cpp.

873{
874 QCString htmlOutput = Config_getString(HTML_OUTPUT);
875
876 // generate navtree.js & navtreeindex.js
877 generateJSNavTree(p->indentNodes[0]);
878}
#define Config_getString(name)
Definition config.h:32
static void generateJSNavTree(const FTVNodes &nodeList)
Definition ftvhelp.cpp:748

References Config_getString, generateJSNavTree(), and p.

Referenced by generateTreeView().

◆ incContentsDepth()

void FTVHelp::incContentsDepth ( )
virtual

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

See also
decContentsDepth()

Implements IndexIntf.

Definition at line 143 of file ftvhelp.cpp.

144{
145 //printf("%p: incContentsDepth() indent=%d\n",this,p->indent);
146 p->indent++;
147 p->indentNodes.resize(p->indent+1);
148}

References p.

Referenced by writeClassTree(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptTreeInsideNamespaceElement(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement(), and writePages().

◆ initialize()

void FTVHelp::initialize ( )
virtual

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

See also
finalize()

Implements IndexIntf.

Definition at line 126 of file ftvhelp.cpp.

127{
128}

Member Data Documentation

◆ p

std::unique_ptr<Private> FTVHelp::p
private

The documentation for this class was generated from the following files: