14#include <boost/python/class.hpp>
15#include <boost/python/enum.hpp>
16#include <boost/python/make_constructor.hpp>
23 boost::python::enum_<OptionalBool::Value>(
"OptionalBoolValue")
44 const extract<OptionalBool> asDirect(
value);
45 const extract<OptionalBool::Value> asEnum(
value);
46 const extract<bool> asBool(
value);
48 if (asDirect.check()) {
50 }
else if (asEnum.check()) {
52 }
else if (asBool.check()) {
55 throw std::invalid_argument(
"Unknown conversion to OptionalBool");
67 const boost::python::object &
value)
const override {
75 std::unique_ptr<Mantid::Kernel::Property>
create(
const std::string &name,
const boost::python::object &
value,
76 const boost::python::object &validator,
77 const unsigned int direction)
const override {
78 using boost::python::extract;
80 auto optBool = fromPyObj(
value);
82 return std::make_unique<PropertyWithValue<OptionalBool>>(name, optBool, direction);
84 const IValidator *propValidator = extract<IValidator *>(validator);
85 return std::make_unique<PropertyWithValue<OptionalBool>>(name, optBool, propValidator->
clone(), direction);
93 class_<OptionalBool>(
"OptionalBool")
94 .def(
"__init__", make_constructor(&createOptionalBool, default_call_policies(), (arg(
"value"))))
103 Registry::TypeRegistry::subscribe<OptionalBoolPropertyValueHandler>();
double value
The value of the point.
void export_PropertyWithValueOptionalBool()
void export_OptionalBoolValue()
void export_OptionalBool()
Interface to PropertyManager.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
IValidator is the basic interface for all validators for properties.
virtual IValidator_sptr clone() const =0
Make a copy of the present type of validator.
OptionalBool : Tri-state bool.
static const std::string StrUnset
static const std::string StrFalse
static const std::string StrTrue
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
bool isNone(PyObject *ptr)
A helper struct to export PropertyWithValue<> types to Python.
static void define(const char *pythonClassName)
This class provides a base-class objects that are able to take a python object and set it on an algor...