From 3c703e55b5a0429f40797c1d3041073dc475714e Mon Sep 17 00:00:00 2001 From: Username404 Date: Sun, 8 Aug 2021 23:44:42 +0200 Subject: [PATCH] Rename the findByName method to findReferenceByName, and add a findReferencesById method. --- src/headers/parsing/ParseComponents.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/headers/parsing/ParseComponents.hpp b/src/headers/parsing/ParseComponents.hpp index f6edd22..24b7322 100644 --- a/src/headers/parsing/ParseComponents.hpp +++ b/src/headers/parsing/ParseComponents.hpp @@ -63,8 +63,14 @@ public: return reinterpret_cast(it); }); } + IS_PARSECOMPONENT + auto findReferencesById() const { + return findById() | views::transform([](T* it) { + return static_cast(*it); + }); + } IS(StandardComponents::NamedIdentifier) - optional> findByName(const string& name) const { + optional> findReferenceByName(const string& name) const { auto identifiers = findById(); for (T* identifier: identifiers) { if (identifier->getId() == typeid(T) && identifier->name == name) {