![]() |
Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
|
#include <ParamConstraint.h>
Public Member Functions | |
ParamConstraint ()=default | |
Empty constructor. More... | |
ParamConstraint (bool constrainType, DATA_TYPE requiredType, const std::initializer_list< std::string > &defaultValue, bool required, const std::initializer_list< std::string > &incompatibleParameters) | |
Whole constructor. More... | |
Static Public Member Functions | |
static ParamConstraint | Require (const std::initializer_list< std::string > &defaultValue={}, bool required=true) |
Constructs a require constraint. More... | |
static ParamConstraint | TypeSafety (DATA_TYPE requiredType, bool constrainType=true) |
Constructs a type-safety constraint. More... | |
static ParamConstraint | Incompatibility (const std::initializer_list< std::string > &incompatibleParameters) |
Constructs an incompatibility constraint. More... | |
static ParamConstraint | Incompatibility (const std::string &incompatibleParameters) |
Constructs an incompatibility constraint. More... | |
Public Attributes | |
bool | constrainType = false |
Should this parameter be forced to be of a certain type? Remember to set constrainTo to the wanted type. More... | |
DATA_TYPE | requiredType = DATA_TYPE::VOID |
Constrain the parameter to this value. Requires constrainType to be set to true. More... | |
std::vector< std::string > | defaultValue |
The default value for this parameter. More... | |
bool | required = false |
If set to true, and no default value set, an error will be produced if this parameter is not supplied by the user. More... | |
std::vector< std::string > | incompatibleParameters |
Parameters that are incompatible with this parameter. More... | |
Friends | |
class | CmdArgsInterface |
Definition at line 8 of file ParamConstraint.h.
|
default |
Empty constructor.
|
inline |
|
inlinestatic |
Constructs an incompatibility constraint.
This means, that the following parameters are NOT compatible with this one and will throw an error if passed together
Definition at line 37 of file ParamConstraint.h.
|
inlinestatic |
Constructs an incompatibility constraint.
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
Definition at line 48 of file ParamConstraint.h.
|
inlinestatic |
Constructs a require constraint.
Think of the default value like of a list ofparameters. Like {"--width", "800"}
Definition at line 16 of file ParamConstraint.h.
|
inlinestatic |
|
friend |
Definition at line 92 of file ParamConstraint.h.
bool Hazelnp::ParamConstraint::constrainType = false |
Should this parameter be forced to be of a certain type?
Remember to set constrainTo
to the wanted type.
Definition at line 70 of file ParamConstraint.h.
std::vector<std::string> Hazelnp::ParamConstraint::defaultValue |
The default value for this parameter.
Gets applied if this parameter was not given.
Think of this like a list of parameters. Like {"--width", "800"}
Definition at line 78 of file ParamConstraint.h.
std::vector<std::string> Hazelnp::ParamConstraint::incompatibleParameters |
Parameters that are incompatible with this parameter.
Definition at line 85 of file ParamConstraint.h.
bool Hazelnp::ParamConstraint::required = false |
If set to true, and no default value set, an error will be produced if this parameter is not supplied by the user.
Definition at line 82 of file ParamConstraint.h.
DATA_TYPE Hazelnp::ParamConstraint::requiredType = DATA_TYPE::VOID |
Constrain the parameter to this value. Requires constrainType
to be set to true.
Definition at line 73 of file ParamConstraint.h.