Skip to main content

The SymbolMap Class Template Reference

Declaration

template <class T> class SymbolMap<T> { ... }

Included Headers

#include <src/symbolmap.h>

Public Member Typedefs Index

template <class T>
usingPtr = T *
template <class T>
usingVectorPtr = std::vector< Ptr >
template <class T>
usingMap = std::unordered_map< std::string, VectorPtr >
template <class T>
usingiterator = typename Map::iterator
template <class T>
usingconst_iterator = typename Map::const_iterator

Public Member Functions Index

template <class T>
voidadd (const QCString &name, Ptr def)

Add a symbol def into the map under key name. More...

template <class T>
voidremove (const QCString &name, Ptr def)

Remove a symbol def from the map that was stored under key name. More...

template <class T>
const VectorPtr &find (const QCString &name)
template <class T>
iteratorbegin ()
template <class T>
iteratorend ()
template <class T>
const_iteratorbegin () const
template <class T>
const_iteratorend () const
template <class T>
boolempty () const

Private Member Attributes Index

template <class T>
Mapm_map
template <class T>
VectorPtrm_noMatch

Description

Class implementing a symbol map that maps symbol names to objects. Symbol names do not have to be unique. Supports adding symbols with add(), removing symbols with remove(), and finding symbols with find().

Definition at line 31 of file symbolmap.h.

Public Member Typedefs

const_iterator

template <class T>
using SymbolMap< T >::const_iterator = typename Map::const_iterator

Definition at line 38 of file symbolmap.h.

38 using const_iterator = typename Map::const_iterator;

iterator

template <class T>
using SymbolMap< T >::iterator = typename Map::iterator

Definition at line 37 of file symbolmap.h.

37 using iterator = typename Map::iterator;

Map

template <class T>
using SymbolMap< T >::Map = std::unordered_map<std::string,VectorPtr>

Definition at line 36 of file symbolmap.h.

36 using Map = std::unordered_map<std::string,VectorPtr>;

Ptr

template <class T>
using SymbolMap< T >::Ptr = T *

Definition at line 34 of file symbolmap.h.

34 using Ptr = T *;

VectorPtr

template <class T>
using SymbolMap< T >::VectorPtr = std::vector<Ptr>

Definition at line 35 of file symbolmap.h.

35 using VectorPtr = std::vector<Ptr>;

Public Member Functions

add()

template <class T>
void SymbolMap< T >::add (const QCString & name, Ptr def)
inline

Add a symbol def into the map under key name.

Definition at line 41 of file symbolmap.h.

41 void add(const QCString &name,Ptr def)
42 {
43 auto it = m_map.find(name.str());
44 if (it!=m_map.end())
45 {
46 it->second.push_back(def);
47 }
48 else
49 {
50 m_map.emplace(name.str(),VectorPtr({def}));
51 }
52 }

References SymbolMap< T >::m_map and QCString::str.

begin()

template <class T>
iterator SymbolMap< T >::begin ()
inline

Definition at line 82 of file symbolmap.h.

82 iterator begin() { return m_map.begin(); }

Reference SymbolMap< T >::m_map.

begin()

template <class T>
const_iterator SymbolMap< T >::begin ()
inline

Definition at line 84 of file symbolmap.h.

84 const_iterator begin() const { return m_map.cbegin(); }

Reference SymbolMap< T >::m_map.

empty()

template <class T>
bool SymbolMap< T >::empty ()
inline

Definition at line 86 of file symbolmap.h.

86 bool empty() const { return m_map.empty(); }

Reference SymbolMap< T >::m_map.

end()

template <class T>
iterator SymbolMap< T >::end ()
inline

Definition at line 83 of file symbolmap.h.

83 iterator end() { return m_map.end(); }

Reference SymbolMap< T >::m_map.

end()

template <class T>
const_iterator SymbolMap< T >::end ()
inline

Definition at line 85 of file symbolmap.h.

85 const_iterator end() const { return m_map.cend(); }

Reference SymbolMap< T >::m_map.

find()

template <class T>
const VectorPtr & SymbolMap< T >::find (const QCString & name)
inline

Find the list of symbols stored under key name Returns a pair of iterators pointing to the start and end of the range of matching symbols

Definition at line 75 of file symbolmap.h.

75 const VectorPtr &find(const QCString &name)
76 {
77 assert(m_noMatch.empty());
78 auto it = m_map.find(name.str());
79 return it==m_map.end() ? m_noMatch : it->second;
80 }

References SymbolMap< T >::m_map, SymbolMap< T >::m_noMatch and QCString::str.

remove()

template <class T>
void SymbolMap< T >::remove (const QCString & name, Ptr def)
inline

Remove a symbol def from the map that was stored under key name.

Definition at line 55 of file symbolmap.h.

55 void remove(const QCString &name,Ptr def)
56 {
57 auto it1 = m_map.find(name.str());
58 if (it1!=m_map.end())
59 {
60 VectorPtr &v = it1->second;
61 auto it2 = std::find(v.begin(),v.end(),def);
62 if (it2!=v.end())
63 {
64 v.erase(it2);
65 if (v.empty())
66 {
67 m_map.erase(it1);
68 }
69 }
70 }
71 }

References SymbolMap< T >::m_map and QCString::str.

Private Member Attributes

m_map

m_noMatch

template <class T>
VectorPtr SymbolMap< T >::m_noMatch

Definition at line 90 of file symbolmap.h.

Referenced by SymbolMap< T >::find.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.