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 LinkedRefMap< T, Hash, KeyEqual, Map >
Container class representing a vector of objects with keys.
Objects can be efficiently be looked up given the key. Objects are not owned by the container, the container will only hold references. When adding objects the order of addition is kept, and used while iterating.
Definition at line 231 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 >>
bool LinkedRefMap< T, Hash, KeyEqual, Map >::add |
( |
const char * | k, |
|
|
T * | obj ) |
|
inline |
Adds an object reference to the ordered vector if it was not added already.
Return true if the reference was added, and false if an object with the same key was already added before
Definition at line 284 of file linkedmap.h.
285 {
286 if (
find(
k)==
nullptr)
287 {
291 return true;
292 }
293 else
294 {
295 return false;
296 }
297 }
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 FileDefImpl::insertClass(), and NamespaceDefImpl::insertClass().
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 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 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 348 of file linkedmap.h.
349 {
352 {
355 {
358 return true;
359 }
360 }
361 return false;
362 }
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 * LinkedRefMap< T, Hash, KeyEqual, Map >::find |
( |
const char * | key | ) |
|
|
inline |
non-const wrapper for find() const
Definition at line 265 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 * LinkedRefMap< T, Hash, KeyEqual, Map >::find |
( |
const char * | key | ) |
const |
|
inline |
find an object given the key.
Returns a pointer to the object if found or nullptr if it is not found.
Definition at line 259 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 >>
find an object given the key.
Returns a pointer to the object if found or nullptr if it is not found.
Definition at line 251 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 * LinkedRefMap< T, Hash, KeyEqual, Map >::find |
( |
const std::string & | key | ) |
|
|
inline |
non-const wrapper for find() const
Definition at line 276 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 * LinkedRefMap< T, Hash, KeyEqual, Map >::find |
( |
const std::string & | key | ) |
const |
|
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 >>
bool LinkedRefMap< T, Hash, KeyEqual, Map >::prepend |
( |
const char * | k, |
|
|
T * | obj ) |
|
inline |
Prepends an object reference to the ordered vector if it was not added already.
Return true if the reference was added, and false if an object with the same key was already added before
Definition at line 317 of file linkedmap.h.
318 {
319 if (
find(
k)==
nullptr)
320 {
324 return true;
325 }
326 else
327 {
328 return false;
329 }
330 }
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 >>
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 385 of file linkedmap.h.
Referenced by 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 >>