From 38551f29deb1521f8b80411f5d0db39aa8564bc1 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 4 Nov 2021 20:31:20 +0100 Subject: [PATCH] Add vector parameter functions to and/or matchers --- src/Parser/Parsing/Matcher/AbstractMatcherFactory.h | 10 ++++++++++ src/Parser/Parsing/Matcher/MatcherAnd.h | 5 +++++ src/Parser/Parsing/Matcher/MatcherOr.h | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h b/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h index bed9699a..e6f5c03f 100644 --- a/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h +++ b/src/Parser/Parsing/Matcher/AbstractMatcherFactory.h @@ -90,11 +90,21 @@ public: return MatcherFactoryWrapper(std::make_unique>(matchers)); } + _NODISCARD MatcherFactoryWrapper And(std::vector>> matchers) const + { + return MatcherFactoryWrapper(std::make_unique>(std::move(matchers))); + } + _NODISCARD MatcherFactoryWrapper Or(std::initializer_list>>> matchers) const { return MatcherFactoryWrapper(std::make_unique>(matchers)); } + _NODISCARD MatcherFactoryWrapper Or(std::vector>> matchers) const + { + return MatcherFactoryWrapper(std::make_unique>(std::move(matchers))); + } + _NODISCARD MatcherFactoryWrapper Loop(std::unique_ptr> matcher) const { return MatcherFactoryWrapper(std::make_unique>(std::move(matcher))); diff --git a/src/Parser/Parsing/Matcher/MatcherAnd.h b/src/Parser/Parsing/Matcher/MatcherAnd.h index 712ee0b2..740c36b1 100644 --- a/src/Parser/Parsing/Matcher/MatcherAnd.h +++ b/src/Parser/Parsing/Matcher/MatcherAnd.h @@ -37,4 +37,9 @@ public: : m_matchers(std::make_move_iterator(matchers.begin()), std::make_move_iterator(matchers.end())) { } + + explicit MatcherAnd(std::vector>> matchers) + : m_matchers(std::move(matchers)) + { + } }; diff --git a/src/Parser/Parsing/Matcher/MatcherOr.h b/src/Parser/Parsing/Matcher/MatcherOr.h index ee773d54..993073ac 100644 --- a/src/Parser/Parsing/Matcher/MatcherOr.h +++ b/src/Parser/Parsing/Matcher/MatcherOr.h @@ -35,4 +35,9 @@ public: : m_matchers(std::make_move_iterator(matchers.begin()), std::make_move_iterator(matchers.end())) { } + + explicit MatcherOr(std::vector>> matchers) + : m_matchers(std::move(matchers)) + { + } };