12#include <boost/python/class.hpp>
13#include <boost/python/list.hpp>
14#include <boost/python/make_constructor.hpp>
15#include <boost/python/str.hpp>
26using HeldType = std::vector<std::vector<std::string>>;
36 const HeldType &propValue = self();
39 boost::python::list fileList;
40 for (
const auto &filenames : propValue) {
41 if (filenames.size() == 1) {
42 fileList.append(filenames.front());
44 boost::python::list groupList;
45 for (
const auto &filename : filenames) {
46 groupList.append(filename);
48 fileList.append(groupList);
55MultipleFileProperty *createMultipleFilePropertyWithAction(
const std::string &name,
unsigned int action,
56 const object &extensions =
object(),
57 const bool allowEmptyTokens =
false) {
58 std::vector<std::string> extsAsVector;
60 extract<std::string> extractor(extensions);
61 if (extractor.check()) {
62 extsAsVector = std::vector<std::string>(1, extractor());
70MultipleFileProperty *createMultipleFileProperty(
const std::string &name,
const object &extensions =
object()) {
79 class_<MultipleFileProperty, bases<BaseClass>, boost::noncopyable>(
"MultipleFileProperty", no_init)
80 .def(
"__init__", make_constructor(&createMultipleFileProperty, default_call_policies(),
81 (arg(
"name"), arg(
"extensions") =
object())))
83 make_constructor(&createMultipleFilePropertyWithAction, default_call_policies(),
84 (arg(
"name"), arg(
"action"), arg(
"extensions") =
object(), arg(
"allow_empty") =
false)))
86 .add_property(
"value", &valueAsPyObject);
void export_MultipleFileProperty()
A specialized class for dealing with file properties.
@ Load
allowed here which will be passed to the algorithm
A property to allow a user to specify multiple files to load.
The concrete, templated class for properties.
bool isNone(PyObject *ptr)
Converts a Python sequence type to a C++ std::vector, where the element type is defined by the templa...
A helper struct to export PropertyWithValue<> types to Python.
static void define(const char *pythonClassName)