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

A list of index interfaces. More...

#include <src/indexlist.h>

Public Member Functions

void disable ()
 disable the indices
void enable ()
 enable the indices
bool isEnabled () const
 returns true iff the indices are enabled
template<class T, class... As>
void addIndex (As &&... args)
 Add an index generator to the list, using a syntax similar to std::make_unique<T>()
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=FALSE, bool addToNavIndex=FALSE, const Definition *def=nullptr, const QCString &nameAsHtml=QCString())
void addIndexItem (const Definition *context, const MemberDef *md, const QCString &sectionAnchor=QCString(), const QCString &title=QCString())
void addIndexFile (const QCString &name)
void addImageFile (const QCString &name)
void addStyleSheetFile (const QCString &name)

Private Types

using IndexPtr = std::unique_ptr<IndexIntf>

Private Member Functions

template<class... Ts, class... As>
void foreach (void(IndexIntf::*methodPtr)(Ts...), As &&... args)
template<class... Ts, class... As>
void foreach_locked (void(IndexIntf::*methodPtr)(Ts...), As &&... args)

Private Attributes

bool m_enabled = true
std::mutex m_mutex
std::vector< IndexPtrm_indices

Detailed Description

A list of index interfaces.

This class itself implements all methods of IndexIntf and just forwards the calls to all items in the list (composite design pattern).

Definition at line 63 of file indexlist.h.

Member Typedef Documentation

◆ IndexPtr

using IndexList::IndexPtr = std::unique_ptr<IndexIntf>
private

Definition at line 65 of file indexlist.h.

Member Function Documentation

◆ addContentsItem()

void IndexList::addContentsItem ( bool isDir,
const QCString & name,
const QCString & ref,
const QCString & file,
const QCString & anchor,
bool separateIndex = FALSE,
bool addToNavIndex = FALSE,
const Definition * def = nullptr,
const QCString & nameAsHtml = QCString() )
inline

Definition at line 116 of file indexlist.h.

119 { if (m_enabled) foreach_locked(&IndexIntf::addContentsItem,isDir,name,ref,file,anchor,separateIndex,addToNavIndex,def,nameAsHtml); }
virtual 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)=0
bool m_enabled
Definition indexlist.h:134
void foreach_locked(void(IndexIntf::*methodPtr)(Ts...), As &&... args)
Definition indexlist.h:77

References IndexIntf::addContentsItem(), FALSE, foreach_locked(), and m_enabled.

◆ addImageFile()

void IndexList::addImageFile ( const QCString & name)
inline

Definition at line 127 of file indexlist.h.

virtual void addImageFile(const QCString &)=0

References IndexIntf::addImageFile(), foreach_locked(), and m_enabled.

◆ addIndex()

template<class T, class... As>
void IndexList::addIndex ( As &&... args)
inline

Add an index generator to the list, using a syntax similar to std::make_unique<T>()

Definition at line 101 of file indexlist.h.

102 { m_indices.push_back(std::make_unique<T>(std::forward<As>(args)...)); }
std::vector< IndexPtr > m_indices
Definition indexlist.h:136

References m_indices.

◆ addIndexFile()

void IndexList::addIndexFile ( const QCString & name)
inline

Definition at line 124 of file indexlist.h.

virtual void addIndexFile(const QCString &name)=0

References IndexIntf::addIndexFile(), foreach_locked(), and m_enabled.

◆ addIndexItem()

void IndexList::addIndexItem ( const Definition * context,
const MemberDef * md,
const QCString & sectionAnchor = QCString(),
const QCString & title = QCString() )
inline

Definition at line 121 of file indexlist.h.

122 { if (m_enabled) foreach_locked(&IndexIntf::addIndexItem,context,md,sectionAnchor,title); }
virtual void addIndexItem(const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title)=0

References IndexIntf::addIndexItem(), foreach_locked(), and m_enabled.

◆ addStyleSheetFile()

void IndexList::addStyleSheetFile ( const QCString & name)
inline

Definition at line 130 of file indexlist.h.

virtual void addStyleSheetFile(const QCString &)=0

References IndexIntf::addStyleSheetFile(), foreach_locked(), and m_enabled.

◆ decContentsDepth()

void IndexList::decContentsDepth ( )
inline

Definition at line 113 of file indexlist.h.

virtual void decContentsDepth()=0

References IndexIntf::decContentsDepth(), foreach_locked(), and m_enabled.

◆ disable()

void IndexList::disable ( )
inline

disable the indices

Definition at line 88 of file indexlist.h.

89 { m_enabled = FALSE; }
#define FALSE
Definition qcstring.h:34

References FALSE, and m_enabled.

◆ enable()

void IndexList::enable ( )
inline

enable the indices

Definition at line 92 of file indexlist.h.

93 { m_enabled = TRUE; }
#define TRUE
Definition qcstring.h:37

References m_enabled, and TRUE.

◆ finalize()

void IndexList::finalize ( )
inline

Definition at line 107 of file indexlist.h.

108 { foreach(&IndexIntf::finalize); }
virtual void finalize()=0

References IndexIntf::finalize().

◆ foreach()

template<class... Ts, class... As>
void IndexList::foreach ( void(IndexIntf::* methodPtr )(Ts...),
As &&... args )
inlineprivate

Definition at line 68 of file indexlist.h.

69 {
70 for (const auto &intf : m_indices)
71 {
72 (intf.get()->*methodPtr)(std::forward<As>(args)...);
73 }
74 }

◆ foreach_locked()

template<class... Ts, class... As>
void IndexList::foreach_locked ( void(IndexIntf::* methodPtr )(Ts...),
As &&... args )
inlineprivate

Definition at line 77 of file indexlist.h.

78 {
79 std::lock_guard<std::mutex> lock(m_mutex);
80 for (const auto &intf : m_indices)
81 {
82 (intf.get()->*methodPtr)(std::forward<As>(args)...);
83 }
84 }
std::mutex m_mutex
Definition indexlist.h:135

References m_indices, and m_mutex.

Referenced by addContentsItem(), addImageFile(), addIndexFile(), addIndexItem(), addStyleSheetFile(), decContentsDepth(), and incContentsDepth().

◆ incContentsDepth()

void IndexList::incContentsDepth ( )
inline

Definition at line 110 of file indexlist.h.

virtual void incContentsDepth()=0

References foreach_locked(), IndexIntf::incContentsDepth(), and m_enabled.

◆ initialize()

void IndexList::initialize ( )
inline

Definition at line 104 of file indexlist.h.

105 { foreach(&IndexIntf::initialize); }
virtual void initialize()=0

References IndexIntf::initialize().

◆ isEnabled()

bool IndexList::isEnabled ( ) const
inline

returns true iff the indices are enabled

Definition at line 96 of file indexlist.h.

97 { return m_enabled; }

References m_enabled.

Member Data Documentation

◆ m_enabled

bool IndexList::m_enabled = true
private

◆ m_indices

std::vector<IndexPtr> IndexList::m_indices
private

Definition at line 136 of file indexlist.h.

Referenced by addIndex(), and foreach_locked().

◆ m_mutex

std::mutex IndexList::m_mutex
private

Definition at line 135 of file indexlist.h.

Referenced by foreach_locked().


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