template<class T, class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
class LinkedMap< T, Hash, KeyEqual, Map >
Container class representing a vector of objects with keys.
Objects can efficiently be looked up given the key. Objects are owned by the container. When adding objects the order of addition is kept, and used while iterating.
Definition at line 35 of file linkedmap.h.
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
template<class... Args>
T * LinkedMap< T, Hash, KeyEqual, Map >::add |
( |
const char * | k, |
|
|
Args &&... | args ) |
|
inline |
Adds a new object to the ordered vector if it was not added already.
Return a non-owning pointer to the newly added object, or to the existing object if it was already inserted before under the given key.
Definition at line 90 of file linkedmap.h.
91 {
94 {
100 }
102 }
Container class representing a vector of objects with keys.
const T * find(const std::string &key) const
Find an object given the key.
References find(), m_entries, and m_lookup.
Referenced by SectionManager::add(), SectionManager::add(), addEnumValuesToEnums(), ClassDefImpl::addMembersToTemplateInstance(), addXRefItem(), DirDefImpl::createNewDir(), ClassDefImpl::deepCopy(), findEnums(), NamespaceDefImpl::insertMember(), ClassDefImpl::mergeCategory(), ClassDefImpl::mergeMembersFromBaseClasses(), readDir(), readFileOrDirectory(), and SectionManager::replace().
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
T * LinkedMap< T, Hash, KeyEqual, Map >::add |
( |
const char * | k, |
|
|
Ptr && | ptr ) |
|
inline |
Adds an existing object to the ordered vector (unless another object was already added under the same key).
Ownership is transferred. Return a non-owning pointer to the newly added object, or to the existing object if it was already inserted before under the given key.
Definition at line 123 of file linkedmap.h.
References find(), m_entries, and m_lookup.
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
void LinkedMap< T, Hash, KeyEqual, Map >::clear |
( |
| ) |
|
|
inline |
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
Removes an object from the container and deletes it.
Returns true if the object was deleted or false it is was not found.
Definition at line 183 of file linkedmap.h.
184 {
187 {
190 {
193 return true;
194 }
195 }
196 return false;
197 }
References m_entries, m_lookup, and QCString::str().
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
T * LinkedMap< T, Hash, KeyEqual, Map >::find |
( |
const char * | key | ) |
|
|
inline |
A non-const wrapper for find() const.
Definition at line 69 of file linkedmap.h.
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
const T * LinkedMap< T, Hash, KeyEqual, Map >::find |
( |
const char * | key | ) |
const |
|
inline |
Find an object given the key.
Returns a pointer to the element if found or nullptr if it is not found.
Definition at line 63 of file linkedmap.h.
References find().
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
A non-const wrapper for find() const.
Definition at line 75 of file linkedmap.h.
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
Find an object given the key.
Returns a pointer to the element if found or nullptr if it is not found.
Definition at line 55 of file linkedmap.h.
References m_lookup, and QCString::str().
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
T * LinkedMap< T, Hash, KeyEqual, Map >::find |
( |
const std::string & | key | ) |
|
|
inline |
A non-const wrapper for find() const.
Definition at line 81 of file linkedmap.h.
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
const T * LinkedMap< T, Hash, KeyEqual, Map >::find |
( |
const std::string & | key | ) |
const |
|
inline |
Find an object given the key.
Returns a pointer to the element if found or nullptr if it is not found.
Definition at line 47 of file linkedmap.h.
References m_lookup.
Referenced by add(), add(), add(), add(), addAnchor(), addEnumValuesToEnums(), addRelatedPage(), addSection(), DefinitionImpl::addSectionsToDefinition(), addXRefItem(), computeMemberRelationsForBaseClass(), DirDefImpl::createNewDir(), DocAnchor::DocAnchor(), DocHtmlCaption::DocHtmlCaption(), DocRef::DocRef(), find(), DocParser::findDocsForMemberOrCompound(), findFileDef(), findMainPage(), findUsingDeclImports(), PerlModGenerator::generatePerlModForPage(), generateSqlite3ForPage(), generateXMLForPage(), getClass(), VhdlDocGen::getClass(), ClassDefImpl::insertTemplateInstance(), ClassDefImpl::mergeCategory(), ClassDefImpl::mergeMembersFromBaseClasses(), DocRoot::parse(), DocSecRefItem::parse(), DocSection::parse(), DocXRefItem::parse(), prepend(), prepend(), processSection(), SectionManager::replace(), resolveLink(), resolveTypeDef(), showFileDefMatches(), PageDefImpl::writeDocumentation(), writeGroupTreeNode(), and GroupDefImpl::writePageDocumentation().
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
template<class... Args>
T * LinkedMap< T, Hash, KeyEqual, Map >::prepend |
( |
const char * | k, |
|
|
Args &&... | args ) |
|
inline |
Prepends a new object to the ordered vector if it was not added already.
Return a non-owning pointer to the newly added object, or to the existing object if it was already inserted before under the given key.
Definition at line 153 of file linkedmap.h.
References find(), m_entries, and m_lookup.
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
Definition at line 221 of file linkedmap.h.
Referenced by add(), add(), add(), add(), begin(), begin(), clear(), del(), empty(), end(), end(), operator[](), operator[](), prepend(), prepend(), rbegin(), rbegin(), rend(), rend(), and size().
template<class T , class Hash = std::hash<std::string>, class KeyEqual = std::equal_to<std::string>, class Map = std::unordered_map<std::string,T*,Hash,KeyEqual >>
Map LinkedMap< T, Hash, KeyEqual, Map >::m_lookup |
|
private |