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.
在文件 linkedmap.h 第 231 行定义.
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
在文件 linkedmap.h 第 284 行定义.
286 if (
find(k)==
nullptr)
288 std::string key(k ? k :
"");
被这些函数引用 GroupDefImpl::addClass(), GroupDefImpl::addConcept(), GroupDefImpl::addExample(), PageDefImpl::addInnerCompound(), NamespaceDefImpl::addInnerCompound(), ClassDefImpl::addInnerCompound(), GroupDefImpl::addNamespace(), GroupDefImpl::addPage(), NamespaceDefImpl::addUsingDeclaration(), FileDefImpl::addUsingDeclaration(), NamespaceDefImpl::addUsingDirective(), FileDefImpl::addUsingDirective(), NamespaceDefImpl::insertClass(), FileDefImpl::insertClass(), NamespaceDefImpl::insertConcept(), FileDefImpl::insertConcept(), NamespaceDefImpl::insertMember(), NamespaceDefImpl::insertNamespace() , 以及 FileDefImpl::insertNamespace().
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.
在文件 linkedmap.h 第 348 行定义.
353 auto vecit = std::find_if(
m_entries.begin(),
m_entries.end(),[obj=it->second](
auto &el) { return el.get()==obj; });
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 |
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.
在文件 linkedmap.h 第 259 行定义.
261 return find(std::string(key ? key :
""));
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.
在文件 linkedmap.h 第 251 行定义.
254 return it!=
m_lookup.end() ? it->second :
nullptr;
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 |
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 |
find an object given the key.
Returns a pointer to the object if found or nullptr if it is not found.
在文件 linkedmap.h 第 243 行定义.
246 return it!=
m_lookup.end() ? it->second :
nullptr;
被这些函数引用 LinkedRefMap< const ConceptDef >::add(), GroupDefImpl::addClass(), GroupDefImpl::addConcept(), ClassDefImpl::addMembersToTemplateInstance(), GroupDefImpl::addNamespace(), LinkedRefMap< const ConceptDef >::find(), findGlobalMember(), NamespaceDefImpl::findInnerCompound(), ClassDefImpl::findInnerCompound(), NamespaceDefImpl::getMemberByName() , 以及 LinkedRefMap< const ConceptDef >::prepend().
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
在文件 linkedmap.h 第 317 行定义.
319 if (
find(k)==
nullptr)
321 std::string key(k ? k :
"");
被这些函数引用 FileDefImpl::addIncludedUsingDirectives().