From 452b8664e40fd30a274393f4d97ccdedef8c4e15 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 4 Jul 2022 16:09:57 +0200 Subject: ResultMapTargetMap: support looking up an action by identifier --- src/buildtool/build_engine/target_map/result_map.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp index 173f59d9..ca55ee74 100644 --- a/src/buildtool/build_engine/target_map/result_map.hpp +++ b/src/buildtool/build_engine/target_map/result_map.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,20 @@ class ResultTargetMap { }); } + [[nodiscard]] auto GetAction(const ActionIdentifier& identifier) + -> std::optional { + for (const auto& target : targets_) { + for (const auto& el : target) { + for (const auto& action : el.second->Actions()) { + if (action->Id() == identifier) { + return action; + } + } + } + } + return std::nullopt; + } + template [[nodiscard]] auto ToResult() const -> ResultType { ResultType result{}; -- cgit v1.2.3