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

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 DString &name, const DString &ref, const DString &file, const DString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def, const DString &nameAsHtml=DString())
void addIndexItem (const Definition *, const MemberDef *, const DString &, const DString &)
void addIndexFile (const DString &)
void addImageFile (const DString &)
void addStyleSheetFile (const DString &)
void generateTreeView ()
void generateTreeViewInline (TextStream &t)
void generateTreeViewScripts ()

Private Attributes

std::unique_ptr< Private > p

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

123: 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 DString & name,
const DString & ref,
const DString & file,
const DString & anchor,
bool separateIndex,
bool addToNavIndex,
const Definition * def,
const DString & nameAsHtml = DString() )
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 189 of file ftvhelp.cpp.

199{
200 //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));
201 auto &nl = p->indentNodes[p->indent];
202 if (!nl.empty())
203 {
204 nl.back()->isLast=false;
205 }
206 auto newNode = std::make_shared<FTVNode>(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def,nameAsHtml);
207 nl.push_back(newNode);
208 newNode->index = static_cast<int>(nl.size()-1);
209 if (p->indent>0)
210 {
211 auto &pnl = p->indentNodes[p->indent-1];
212 if (!pnl.empty())
213 {
214 newNode->parent = pnl.back();
215 }
216 }
217}

References p.

Referenced by writeClassTree(), writeClassTreeForList(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeDirHierarchy(), writeDirTreeNode(), and writeNamespaceTreeElement().

◆ addImageFile()

void FTVHelp::addImageFile ( const DString & )
inlinevirtual

Implements IndexIntf.

Definition at line 62 of file ftvhelp.h.

62{}

◆ addIndexFile()

void FTVHelp::addIndexFile ( const DString & )
inlinevirtual

Implements IndexIntf.

Definition at line 61 of file ftvhelp.h.

61{}

◆ addIndexItem()

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

Implements IndexIntf.

Definition at line 60 of file ftvhelp.h.

60{}

◆ addStyleSheetFile()

void FTVHelp::addStyleSheetFile ( const DString & )
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 157 of file ftvhelp.cpp.

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

References ASSERT, p, and parent().

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

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

138{
140}
void generateTreeView()
Definition ftvhelp.cpp:954

References generateTreeView().

◆ generateTreeView()

void FTVHelp::generateTreeView ( )

Definition at line 954 of file ftvhelp.cpp.

955{
957}
void generateTreeViewScripts()
Definition ftvhelp.cpp:880

References generateTreeViewScripts().

Referenced by finalize().

◆ generateTreeViewInline()

void FTVHelp::generateTreeViewInline ( TextStream & t)

Definition at line 889 of file ftvhelp.cpp.

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

References Config_getBool, Config_getInt, p, theTranslator, and Translator::trDetailLevel().

Referenced by writeAnnotatedIndexGeneric(), writeConceptList(), writeFileIndex(), writeHierarchicalExceptionIndex(), writeHierarchicalIndex(), writeHierarchicalInterfaceIndex(), and writeNamespaceIndex().

◆ generateTreeViewScripts()

void FTVHelp::generateTreeViewScripts ( )

Definition at line 880 of file ftvhelp.cpp.

881{
882 DString htmlOutput = Config_getString(HTML_OUTPUT);
883
884 // generate navtree.js & navtreeindex.js
885 generateJSNavTree(p->indentNodes[0]);
886}
#define Config_getString(name)
Definition config.h:32
static void generateJSNavTree(const FTVNodes &nodeList)
Definition ftvhelp.cpp:756

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

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

References p.

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

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

130{
131}

Member Data Documentation

◆ p

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

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