Skip to main content

The RefList Class Reference

List of cross-referenced items. More...

Declaration

class RefList { ... }

Included Headers

#include <src/reflist.h>

Public Constructors Index

RefList (const QCString &listName, const QCString &pageTitle, const QCString &secTitle)

Public Member Functions Index

boolisEnabled () const
RefItem *add ()
RefItem *find (int itemId)
QCStringlistName () const
QCStringfileName () const
QCStringpageTitle () const
QCStringsectionTitle () const
voidgeneratePage ()

Private Member Attributes Index

intm_id = 0
QCStringm_listName
QCStringm_fileName
QCStringm_pageTitle
QCStringm_secTitle
std::vector< std::unique_ptr< RefItem > >m_entries
std::unordered_map< int, RefItem * >m_lookup

Description

List of cross-referenced items.

This class represents a list of items that are put at a certain point in the documentation by some special command and are collected in a list. The items cross-reference the documentation and the list.

Examples are the todo list, the test list and the bug list, introduced by the \todo, \test, and \bug commands respectively.

Definition at line 79 of file reflist.h.

Public Constructors

RefList()

RefList::RefList (const QCString & listName, const QCString & pageTitle, const QCString & secTitle)

Create a list of items that are cross referenced with documentation blocks

Parameters
listName

String representing the name of the list.

pageTitle

String representing the title of the list page.

secTitle

String representing the title of the section.

Declaration at line 87 of file reflist.h, definition at line 24 of file reflist.cpp.

References convertNameToFile, FALSE, listName, m_fileName, m_listName, m_pageTitle, m_secTitle, pageTitle and TRUE.

Public Member Functions

add()

RefItem * RefList::add ()

Adds a new item to the list.

Returns

A unique id for this item.

Declaration at line 93 of file reflist.h, definition at line 30 of file reflist.cpp.

31{
32 m_id++;
33 std::unique_ptr<RefItem> item = std::make_unique<RefItem>(m_id,this);
34 RefItem *result = item.get();
35 m_entries.push_back(std::move(item));
36 m_lookup.emplace(m_id,result);
37 return result;
38}

References m_entries, m_id and m_lookup.

Referenced by addXRefItem.

fileName()

QCString RefList::fileName ()
inline

Definition at line 102 of file reflist.h.

102 QCString fileName() const { return m_fileName; }

Reference m_fileName.

Referenced by DocXRefItem::parse.

find()

RefItem * RefList::find (int itemId)

Returns an item given it's id that is obtained with addRefItem()

Parameters
itemId

item's identifier.

Returns

A pointer to the todo item's structure.

Declaration at line 99 of file reflist.h, definition at line 40 of file reflist.cpp.

41{
42 auto it = m_lookup.find(itemId);
43 return it!=m_lookup.end() ? it->second : nullptr;
44}

Reference m_lookup.

Referenced by DocXRefItem::parse.

generatePage()

void RefList::generatePage ()

Declaration at line 106 of file reflist.h, definition at line 55 of file reflist.cpp.

56{
57 if (!isEnabled()) return;
58
59 std::stable_sort(m_entries.begin(),m_entries.end(),
60 [](const std::unique_ptr<RefItem> &left,const std::unique_ptr<RefItem> &right)
61 { return qstricmp_sort(left->title(),right->title()) < 0; });
62 //RefItem *item;
63 QCString doc;
64 int cnt = 0;
65 doc += "<dl class=\"reflist\">";
66 QCString lastGroup;
67 bool first=true;
68 for (const std::unique_ptr<RefItem> &item : m_entries)
69 {
70 if (item->name().isEmpty()) continue;
71 cnt++;
72 bool startNewGroup = item->group()!=lastGroup;
73 if (startNewGroup)
74 {
75 if (!first)
76 {
77 doc += "</dd>";
78 }
79 doc += " <dt>";
80 doc += "\n";
81 if (item->scope())
82 {
83 if (item->scope()->name() != "<globalScope>")
84 {
85 doc += "\\_setscope ";
86 doc += item->scope()->name();
87 doc += " ";
88 }
89 }
90 doc += item->prefix();
91 doc += " \\_internalref ";
92 doc += item->name();
93 // escape \'s in title, see issue #5901
94 QCString escapedTitle = substitute(item->title(),"\\","\\\\");
95 doc += " \""+escapedTitle+"\" ";
96 // write declaration in case a function with arguments
97 if (!item->args().isEmpty())
98 {
99 // escape @'s in argument list, needed for Java annotations (see issue #6208)
100 // escape \'s in argument list (see issue #6533)
101 doc += substitute(substitute(item->args(),"@","@@"),"\\","\\\\");
102 }
103 doc += "</dt><dd>";
104 }
105 else
106 {
107 doc += "<p>";
108 }
109 doc += " \\anchor ";
110 doc += item->anchor();
111 doc += " ";
112 doc += item->text();
113 lastGroup = item->group();
114 first = false;
115 }
116 if (!first)
117 {
118 doc += "</dd>";
119 }
120 doc += "</dl>\n";
121 //printf("generatePage('%s')\n",doc.data());
122 if (cnt>0)
123 {
125 }
126}

References addRelatedPage, isEnabled, m_entries, m_fileName, m_listName, m_pageTitle, substitute and TRUE.

isEnabled()

bool RefList::isEnabled ()

Declaration at line 88 of file reflist.h, definition at line 46 of file reflist.cpp.

47{
48 if (m_listName=="todo" && !Config_getBool(GENERATE_TODOLIST)) return false;
49 else if (m_listName=="test" && !Config_getBool(GENERATE_TESTLIST)) return false;
50 else if (m_listName=="bug" && !Config_getBool(GENERATE_BUGLIST)) return false;
51 else if (m_listName=="deprecated" && !Config_getBool(GENERATE_DEPRECATEDLIST)) return false;
52 return true;
53}

References Config_getBool and m_listName.

Referenced by generatePage and DocXRefItem::parse.

listName()

QCString RefList::listName ()
inline

Definition at line 101 of file reflist.h.

101 QCString listName() const { return m_listName; }

Reference m_listName.

Referenced by DefinitionImpl::_getXRefListId, addXRefItem and RefList.

pageTitle()

QCString RefList::pageTitle ()
inline

Definition at line 103 of file reflist.h.

103 QCString pageTitle() const { return m_pageTitle; }

Reference m_pageTitle.

Referenced by RefList.

sectionTitle()

QCString RefList::sectionTitle ()
inline

Definition at line 104 of file reflist.h.

104 QCString sectionTitle() const { return m_secTitle; }

Reference m_secTitle.

Referenced by DocXRefItem::parse.

Private Member Attributes

m_entries

std::vector< std::unique_ptr< RefItem > > RefList::m_entries

Definition at line 114 of file reflist.h.

114 std::vector< std::unique_ptr< RefItem > > m_entries;

Referenced by add and generatePage.

m_fileName

QCString RefList::m_fileName

Definition at line 111 of file reflist.h.

Referenced by fileName, generatePage and RefList.

m_id

int RefList::m_id = 0

Definition at line 109 of file reflist.h.

109 int m_id = 0;

Referenced by add.

m_listName

QCString RefList::m_listName

Definition at line 110 of file reflist.h.

Referenced by generatePage, isEnabled, listName and RefList.

m_lookup

std::unordered_map< int, RefItem* > RefList::m_lookup

Definition at line 115 of file reflist.h.

115 std::unordered_map< int, RefItem* > m_lookup;

Referenced by add and find.

m_pageTitle

QCString RefList::m_pageTitle

Definition at line 112 of file reflist.h.

Referenced by generatePage, pageTitle and RefList.

m_secTitle

QCString RefList::m_secTitle

Definition at line 113 of file reflist.h.

Referenced by RefList and sectionTitle.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.