Mantid
Loading...
Searching...
No Matches
TypedValidatorExporter.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10#include <boost/python/class.hpp>
11
12namespace Mantid {
13namespace PythonInterface {
18template <typename Type> struct TypedValidatorExporter {
19 static void define(const char *pythonClassName) {
20 using namespace boost::python;
22 using Mantid::Kernel::TypedValidator;
23
24 class_<TypedValidator<Type>, bases<IValidator>, boost::noncopyable>(pythonClassName, no_init)
25 .def("isValid", &IValidator::isValid<Type>, (arg("self"), arg("value")),
26 "Returns an empty string if the value is considered valid, "
27 "otherwise a string defining the error is returned.");
28 }
29};
30
31#define EXPORT_TYPEDVALIDATOR(Type)
32} // namespace PythonInterface
33} // namespace Mantid
IValidator is the basic interface for all validators for properties.
Definition: IValidator.h:43
Helper class which provides the Collimation Length for SANS instruments.
Declares a simple static struct to export a TypedValidator to Python.
static void define(const char *pythonClassName)