Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/matcher/matcher.h" 4 : 5 : #include "source/common/common/matchers.h" 6 : 7 : namespace Envoy { 8 : namespace Matcher { 9 : 10 : template <class StringMatcherType> 11 : class StringInputMatcher : public InputMatcher, Logger::Loggable<Logger::Id::matcher> { 12 : public: 13 0 : explicit StringInputMatcher(const StringMatcherType& matcher) : matcher_(matcher) {} 14 : 15 0 : bool match(const MatchingDataType& input) override { 16 0 : if (absl::holds_alternative<std::string>(input)) { 17 0 : return matcher_.match(absl::get<std::string>(input)); 18 0 : } 19 : // Return false when input is empty.(i.e., input is absl::monostate). 20 0 : return false; 21 0 : } 22 : 23 : private: 24 : const Matchers::StringMatcherImpl<StringMatcherType> matcher_; 25 : }; 26 : 27 : } // namespace Matcher 28 : } // namespace Envoy