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>
28 validator->setLower(extract<T>(
lower));
31 validator->setUpper(extract<T>(
upper));
45 const bool exclusive =
false) {
47 if (
lower.ptr() != Py_None) {
48 validator->setLower(extract<T>(
lower));
49 validator->setLowerExclusive(exclusive);
51 if (
upper.ptr() != Py_None) {
52 validator->setUpper(extract<T>(
upper));
53 validator->setUpperExclusive(exclusive);
59#define EXPORT_BOUNDEDVALIDATOR(ElementType, prefix) \
60 class_<BoundedValidator<ElementType>, bases<IValidator>, boost::noncopyable>(#prefix "BoundedValidator") \
61 .def("__init__", make_constructor(&createBoundedValidator<ElementType>, default_call_policies(), \
62 (arg("lower") = object(), arg("upper") = object()))) \
63 .def("__init__", make_constructor(&createExclusiveBoundedValidator<ElementType>, default_call_policies(), \
64 (arg("lower") = object(), arg("upper") = object(), arg("exclusive") = false))) \
65 .def("setLower", &BoundedValidator<ElementType>::setLower, (arg("self"), arg("lower")), "Set the lower bound") \
66 .def("setUpper", &BoundedValidator<ElementType>::setUpper, (arg("self"), arg("upper")), "Set the upper bound") \
67 .def("setLowerExclusive", &BoundedValidator<ElementType>::setLowerExclusive, (arg("self"), arg("exclusive")), \
68 "Sets if the lower bound is exclusive") \
69 .def("setUpperExclusive", &BoundedValidator<ElementType>::setUpperExclusive, (arg("self"), arg("exclusive")), \
70 "Sets if the upper bound is exclsuive") \
71 .def("setExclusive", &BoundedValidator<ElementType>::setExclusive, (arg("self"), arg("exclusive")), \
72 "Sets both bounds to be inclusive/exclusive") \
73 .def("lower", &BoundedValidator<ElementType>::lower, arg("self"), "Returns the lower bound") \
74 .def("upper", &BoundedValidator<ElementType>::upper, arg("self"), "Returns the upper bound") \
75 .def("setBounds", &BoundedValidator<ElementType>::setBounds, (arg("self"), arg("lower"), arg("upper")), \
77 .def("hasLower", &BoundedValidator<ElementType>::hasLower, arg("self"), \
78 "Returns True if a lower bound has been set") \
79 .def("hasUpper", &BoundedValidator<ElementType>::hasUpper, arg("self"), \
80 "Returns True if an upper bound has been set") \
81 .def("isLowerExclusive", &BoundedValidator<ElementType>::isLowerExclusive, arg("self"), \
82 "Returns True if the lower bound is exclusive") \
83 .def("isUpperExclusive", &BoundedValidator<ElementType>::isUpperExclusive, arg("self"), \
84 "Returns True if the upper bound is exclusive");
void export_BoundedValidator()
#define EXPORT_BOUNDEDVALIDATOR(ElementType, prefix)
A macro for generating exports for each type.
double lower
lower and upper bounds on the multiplier, if known
BoundedValidator is a validator that requires the values to be between upper or lower bounds,...
IValidator is the basic interface for all validators for properties.
bool isNone(PyObject *ptr)