|
|
@@ -3,6 +3,7 @@
|
|
|
#include <string>
|
|
|
|
|
|
#include <jvalidate/constraint/constraint.h>
|
|
|
+#include <jvalidate/detail/string.h>
|
|
|
#include <jvalidate/forward.h>
|
|
|
|
|
|
namespace jvalidate::constraint {
|
|
|
@@ -13,7 +14,7 @@ private:
|
|
|
public:
|
|
|
MinLengthConstraint(int64_t value) : value_(value) {}
|
|
|
|
|
|
- bool operator()(std::string_view arg) const { return arg.size() >= value_; }
|
|
|
+ bool operator()(std::string_view arg) const { return detail::length(arg) >= value_; }
|
|
|
};
|
|
|
|
|
|
class MaxLengthConstraint : public SimpleConstraint<MaxLengthConstraint> {
|
|
|
@@ -23,7 +24,7 @@ private:
|
|
|
public:
|
|
|
MaxLengthConstraint(int64_t value) : value_(value) {}
|
|
|
|
|
|
- bool operator()(std::string_view arg) const { return arg.size() <= value_; }
|
|
|
+ bool operator()(std::string_view arg) const { return detail::length(arg) <= value_; }
|
|
|
};
|
|
|
|
|
|
class PatternConstraint : public SimpleConstraint<PatternConstraint> {
|