Rename the findByName method to findReferenceByName, and add a findReferencesById method.
This commit is contained in:
parent
9871cc66c7
commit
3c703e55b5
|
@ -63,8 +63,14 @@ public:
|
||||||
return reinterpret_cast<T*>(it);
|
return reinterpret_cast<T*>(it);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
IS_PARSECOMPONENT
|
||||||
|
auto findReferencesById() const {
|
||||||
|
return findById<T>() | views::transform([](T* it) {
|
||||||
|
return static_cast<T&>(*it);
|
||||||
|
});
|
||||||
|
}
|
||||||
IS(StandardComponents::NamedIdentifier)
|
IS(StandardComponents::NamedIdentifier)
|
||||||
optional<reference_wrapper<T>> findByName(const string& name) const {
|
optional<reference_wrapper<T>> findReferenceByName(const string& name) const {
|
||||||
auto identifiers = findById<T>();
|
auto identifiers = findById<T>();
|
||||||
for (T* identifier: identifiers) {
|
for (T* identifier: identifiers) {
|
||||||
if (identifier->getId() == typeid(T) && identifier->name == name) {
|
if (identifier->getId() == typeid(T) && identifier->name == name) {
|
||||||
|
|
Loading…
Reference in New Issue