Renamed constraint modifier method to be more descriptive

This commit is contained in:
Leonetienne 2021-09-05 12:59:56 +02:00
parent e3fe859b9e
commit c58237b028
4 changed files with 16 additions and 6 deletions

View File

@ -78,7 +78,7 @@ namespace Hazelnp
//! Daisychain-method. Will add a the "incompatiblity" aspect.
//! This means, that the following parameters are NOT compatible with this one and will throw an error if passed together.
//! Syntactical-sugar proxy method that will convert the lonely string to an initializer list for you :3
ParamConstraint AddIncompatibility(const std::string& incompatibleParameters)
ParamConstraint AddIncompatibilities(const std::string& incompatibleParameters)
{
ParamConstraint pc = *this;
pc.incompatibleParameters = { incompatibleParameters };
@ -86,6 +86,16 @@ namespace Hazelnp
return pc;
}
//! Daisychain-method. Will add a the "incompatiblity" aspect.
//! This means, that the following parameters are NOT compatible with this one and will throw an error if passed together.
ParamConstraint AddIncompatibilities(const std::initializer_list<std::string>& incompatibleParameters)
{
ParamConstraint pc = *this;
pc.incompatibleParameters = incompatibleParameters;
return pc;
}
//! Whole constructor
ParamConstraint(bool constrainType, DATA_TYPE requiredType, const std::initializer_list<std::string>& defaultValue, bool required, const std::initializer_list<std::string>& incompatibleParameters)
:

View File

@ -1,2 +1,2 @@
#pragma once
#define HAZELNUPP_VERSION (1.12)
#define HAZELNUPP_VERSION (1.121)

View File

@ -695,7 +695,7 @@ namespace TestHazelnupp
"--width",
ParamConstraint::Require()
.AddTypeSafety(DATA_TYPE::FLOAT)
.AddIncompatibility({ "--antiwidth" })
.AddIncompatibilities({ "--antiwidth" })
);
cmdArgsI.Parse(C_Ify(args));
@ -725,7 +725,7 @@ namespace TestHazelnupp
"--width",
ParamConstraint::TypeSafety(DATA_TYPE::FLOAT)
.AddRequire()
.AddIncompatibility({ "--antiwidth" })
.AddIncompatibilities({ "--antiwidth" })
);
cmdArgsI.Parse(C_Ify(args));
@ -784,7 +784,7 @@ namespace TestHazelnupp
"--width",
ParamConstraint::Require()
.AddTypeSafety(DATA_TYPE::FLOAT)
.AddIncompatibility({ "--antiwidth" })
.AddIncompatibilities({ "--antiwidth" })
);
cmdArgsI.Parse(C_Ify(args));

View File

@ -283,7 +283,7 @@ args.RegisterConstraint(
"--width",
ParamConstraint::Require() // Make this parameter mandatory
.AddTypeSafety(DATA_TYPE::FLOAT) // Force this param to be a float
.AddIncompatibility({ "--antiwidth" }) // Make this param incompatible with '--antiwidth'
.AddIncompatibilities({ "--antiwidth" }) // Make this param incompatible with '--antiwidth'
);
```