mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 08:46:19 +08:00
Renamed to Minimum, Maximum, etc
This commit is contained in:
@@ -19,7 +19,7 @@ struct EqualTo {
|
||||
};
|
||||
|
||||
template <double _threshold>
|
||||
struct GreaterEqual {
|
||||
struct Minimum {
|
||||
template <class T>
|
||||
static Result<T> validate(T _value) noexcept {
|
||||
constexpr auto threshold = static_cast<T>(_threshold);
|
||||
@@ -33,7 +33,7 @@ struct GreaterEqual {
|
||||
};
|
||||
|
||||
template <double _threshold>
|
||||
struct GreaterThan {
|
||||
struct ExclusiveMinimum {
|
||||
template <class T>
|
||||
static Result<T> validate(T _value) noexcept {
|
||||
constexpr auto threshold = static_cast<T>(_threshold);
|
||||
@@ -47,7 +47,7 @@ struct GreaterThan {
|
||||
};
|
||||
|
||||
template <double _threshold>
|
||||
struct LessEqual {
|
||||
struct Maximum {
|
||||
template <class T>
|
||||
static Result<T> validate(T _value) noexcept {
|
||||
constexpr auto threshold = static_cast<T>(_threshold);
|
||||
@@ -61,7 +61,7 @@ struct LessEqual {
|
||||
};
|
||||
|
||||
template <double _threshold>
|
||||
struct LessThan {
|
||||
struct ExclusiveMaximum {
|
||||
template <class T>
|
||||
static Result<T> validate(T _value) noexcept {
|
||||
constexpr auto threshold = static_cast<T>(_threshold);
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
void test_all_of() {
|
||||
std::cout << "test_all_of" << std::endl;
|
||||
|
||||
using Age =
|
||||
rfl::Validator<unsigned int,
|
||||
rfl::AllOf<rfl::GreaterThan<0.>, rfl::LessThan<130.>>>;
|
||||
using Age = rfl::Validator<unsigned int,
|
||||
rfl::AllOf<rfl::Minimum<0.>, rfl::Maximum<130.>>>;
|
||||
|
||||
struct Person {
|
||||
rfl::Field<"firstName", std::string> first_name;
|
||||
|
||||
@@ -11,8 +11,8 @@ void test_any_of() {
|
||||
|
||||
using Age = rfl::Validator<
|
||||
unsigned int,
|
||||
rfl::AnyOf<rfl::AllOf<rfl::GreaterThan<0.>, rfl::LessThan<10.>>,
|
||||
rfl::AllOf<rfl::GreaterThan<40.>, rfl::LessThan<130.>>>>;
|
||||
rfl::AnyOf<rfl::AllOf<rfl::Minimum<0.>, rfl::Maximum<10.>>,
|
||||
rfl::AllOf<rfl::Minimum<40.>, rfl::Maximum<130.>>>>;
|
||||
|
||||
struct Person {
|
||||
rfl::Field<"firstName", std::string> first_name;
|
||||
|
||||
Reference in New Issue
Block a user