#pragma once #include #include #include #include namespace jvalidate::constraint { class MinLengthConstraint : public SimpleConstraint { private: int64_t value_; public: MinLengthConstraint(int64_t value) : value_(value) {} bool operator()(std::string_view arg) const { return detail::length(arg) >= value_; } }; class MaxLengthConstraint : public SimpleConstraint { private: int64_t value_; public: MaxLengthConstraint(int64_t value) : value_(value) {} bool operator()(std::string_view arg) const { return detail::length(arg) <= value_; } }; class PatternConstraint : public SimpleConstraint { public: std::string regex; public: PatternConstraint(std::string const & regex) : regex(regex) {} }; }