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< 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 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:950

References generateTreeView().

◆ generateTreeView()

void FTVHelp::generateTreeView ( )

Definition at line 950 of file ftvhelp.cpp.

951{
953}
void generateTreeViewScripts()
Definition ftvhelp.cpp:876

References generateTreeViewScripts().

Referenced by finalize().

◆ generateTreeViewInline()

void FTVHelp::generateTreeViewInline ( TextStream & t)

Definition at line 885 of file ftvhelp.cpp.

886{
887 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
888 int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES);
889 t << "<div class=\"directory\">\n";
890 int d=1, depth=1;
891 for (const auto &n : p->indentNodes[0])
892 {
893 if (!n->children.empty())
894 {
895 d = n->computeTreeDepth(2);
896 if (d>depth) depth=d;
897 }
898 }
899 int preferredDepth = depth;
900 // write level selector
901 if (depth>1)
902 {
903 if (dynamicSections)
904 {
905 t << "<div class=\"levels\">[";
907 t << " ";
908 for (int i=1;i<=depth;i++)
909 {
910 t << "<span class=\"dyn-level-" << i << "\">" << i << "</span>";
911 }
912 t << "]</div>";
913 }
914
915 if (preferredNumEntries>0)
916 {
917 preferredDepth=1;
918 for (int i=1;i<=depth;i++)
919 {
920 int num=0;
921 for (const auto &n : p->indentNodes[0])
922 {
923 num+=n->numNodesAtLevel(0,i);
924 }
925 if (num<=preferredNumEntries)
926 {
927 preferredDepth=i;
928 }
929 else
930 {
931 break;
932 }
933 }
934 }
935 }
936 //printf("preferred depth=%d\n",preferredDepth);
937
938 if (!p->indentNodes[0].empty())
939 {
940 t << "<table class=\"directory\">\n";
941 int index=0;
942 p->generateTree(t,p->indentNodes[0],0,preferredDepth,index);
943 t << "</table>\n";
944 }
945
946 t << "</div><!-- directory -->\n";
947}
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 876 of file ftvhelp.cpp.

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

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: