9#include <boost/python/class.hpp>
10#include <boost/python/default_call_policies.hpp>
11#include <boost/python/make_constructor.hpp>
12#include <boost/python/overloads.hpp>
13#include <boost/python/return_value_policy.hpp>
30 const bool exclusive =
false) {
31 auto validator = std::make_unique<ArrayBoundedValidator<T>>();
32 if (
lower.ptr() != Py_None) {
34 validator->setLowerExclusive(exclusive);
36 if (
upper.ptr() != Py_None) {
37 validator->setUpper(extract<T>(
upper));
38 validator->setUpperExclusive(exclusive);
40 return validator.release();
43#define EXPORT_ARRAYBOUNDEDVALIDATOR(type, prefix) \
44 class_<ArrayBoundedValidator<type>, bases<IValidator>, boost::noncopyable>(#prefix "ArrayBoundedValidator") \
45 .def(init<type, type>((arg("self"), arg("lowerBound"), arg("upperBound")), \
46 "Construct a validator to ensure each value is in the given range")) \
47 .def("__init__", make_constructor(&createExclusiveArrayBoundedValidator<type>, default_call_policies(), \
48 (arg("lower") = object(), arg("upper") = object(), arg("exclusive") = false))) \
49 .def("hasLower", &ArrayBoundedValidator<type>::hasLower, arg("self"), \
50 "Return true if a lower bound has been set") \
51 .def("hasUpper", &ArrayBoundedValidator<type>::hasUpper, arg("self"), \
52 "Return true if an upper bound has been set") \
53 .def("lower", &ArrayBoundedValidator<type>::lower, arg("self"), "Return the lower bound") \
54 .def("upper", &ArrayBoundedValidator<type>::upper, arg("self"), "Return the upper bound") \
55 .def("setLowerExclusive", &ArrayBoundedValidator<type>::setLowerExclusive, (arg("self"), arg("exclusive")), \
56 "Set if the lower bound is exclusive") \
57 .def("setUpperExclusive", &ArrayBoundedValidator<type>::setUpperExclusive, (arg("self"), arg("exclusive")), \
58 "Set if the upper bound is exclusive") \
59 .def("setExclusive", &ArrayBoundedValidator<type>::setExclusive, (arg("self"), arg("exclusive")), \
60 "Set if the bounds are exclusive") \
61 .def("isLowerExclusive", &ArrayBoundedValidator<type>::isLowerExclusive, arg("self"), \
62 "Return True if the lower bound is exclusive") \
63 .def("isUpperExclusive", &ArrayBoundedValidator<type>::isUpperExclusive, arg("self"), \
64 "Return True if the upper bound is exclusive") \
65 .def("setLower", &ArrayBoundedValidator<type>::setLower, (arg("self"), arg("lower")), "Set the lower bound") \
66 .def("setUpper", &ArrayBoundedValidator<type>::setUpper, (arg("self"), arg("upper")), "Set the upper bound") \
67 .def("clearLower", &ArrayBoundedValidator<type>::clearLower, arg("self"), "Clear any set lower bound") \
68 .def("clearUpper", &ArrayBoundedValidator<type>::clearUpper, arg("self"), "Clear any set upper bound");
void export_ArrayBoundedValidator()
#define EXPORT_ARRAYBOUNDEDVALIDATOR(type, prefix)
double lower
lower and upper bounds on the multiplier, if known
Kernel/ArrayBoundedValidator.h.
void setLower(const TYPE &value) noexcept
Set lower bound value.
IValidator is the basic interface for all validators for properties.