Update after removal of boost in uibase.

This commit is contained in:
Mikaël Capelle
2021-05-26 19:47:15 +02:00
4 changed files with 18 additions and 12 deletions
+5 -6
View File
@@ -1,7 +1,6 @@
#include "gamefeatureswrappers.h"
#include <boost/any.hpp>
#include <any>
#include <typeindex>
#include <ipluginlist.h>
@@ -213,7 +212,7 @@ QStringList UnmanagedModsWrapper::secondaryFiles(const QString & modName) const
game_features_map_from_python::game_features_map_from_python()
{
boost::python::converter::registry::push_back(&convertible, &construct, boost::python::type_id<std::map<std::type_index, boost::any>>());
boost::python::converter::registry::push_back(&convertible, &construct, boost::python::type_id<std::map<std::type_index, std::any>>());
}
void * game_features_map_from_python::convertible(PyObject * objPtr)
@@ -222,15 +221,15 @@ void * game_features_map_from_python::convertible(PyObject * objPtr)
}
template<typename T>
void insertGameFeature(std::map<std::type_index, boost::any>& map, const boost::python::object& pyObject)
void insertGameFeature(std::map<std::type_index, std::any>& map, const boost::python::object& pyObject)
{
map[std::type_index(typeid(T))] = boost::python::extract<T*>(pyObject)();
}
void game_features_map_from_python::construct(PyObject * objPtr, boost::python::converter::rvalue_from_python_stage1_data * data)
{
void *storage = ((boost::python::converter::rvalue_from_python_storage<std::map<std::type_index, boost::any>>*)data)->storage.bytes;
std::map<std::type_index, boost::any> *result = new (storage) std::map<std::type_index, boost::any>();
void *storage = ((boost::python::converter::rvalue_from_python_storage<std::map<std::type_index, std::any>>*)data)->storage.bytes;
std::map<std::type_index, std::any> *result = new (storage) std::map<std::type_index, std::any>();
boost::python::dict source(boost::python::handle<>(boost::python::borrowed(objPtr)));
boost::python::list keys = source.keys();
int len = boost::python::len(keys);
+2 -2
View File
@@ -303,9 +303,9 @@ QString IPluginGameWrapper::getLauncherName() const
COMMON_I_PLUGIN_WRAPPER_DEFINITIONS_IMPL(IPluginGameWrapper, 0)
std::map<std::type_index, boost::any> IPluginGameWrapper::featureList() const
std::map<std::type_index, std::any> IPluginGameWrapper::featureList() const
{
return basicWrapperFunctionImplementation<std::map<std::type_index, boost::any>>(this, "_featureList");
return basicWrapperFunctionImplementation<std::map<std::type_index, std::any>>(this, "_featureList");
}
/// end IPluginGame Wrapper
/////////////////////////////////////
+2 -1
View File
@@ -14,6 +14,7 @@
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#endif
// The wrapper for IPluginGame cannot override requirements or enabledByDefault since they're final,
@@ -138,7 +139,7 @@ public:
protected:
// Apparently, Python developers interpret an underscore in a function name as it being protected
virtual std::map<std::type_index, boost::any> featureList() const override;
virtual std::map<std::type_index, std::any> featureList() const override;
// Thankfully, the default implementation of the templated 'T *feature()' function should allow us to get away without overriding it.
};
+9 -3
View File
@@ -327,9 +327,15 @@ BOOST_PYTHON_MODULE(mobase)
.staticmethod("basic");
bpy::class_<IOrganizer::FileInfo>("FileInfo", bpy::init<>())
.def_readwrite("filePath", &IOrganizer::FileInfo::filePath)
.def_readwrite("archive", &IOrganizer::FileInfo::archive)
.def_readwrite("origins", &IOrganizer::FileInfo::origins)
.add_property("filePath",
+[](const IOrganizer::FileInfo& info) { return info.filePath; },
+[](IOrganizer::FileInfo& info, QString value) { info.filePath = value; })
.add_property("archive",
+[](const IOrganizer::FileInfo& info) { return info.archive; },
+[](IOrganizer::FileInfo& info, QString value) { info.archive = value; })
.add_property("origins",
+[](const IOrganizer::FileInfo& info) { return info.origins; },
+[](IOrganizer::FileInfo& info, QStringList value) { info.origins = value; })
;
bpy::class_<IOrganizer, boost::noncopyable>("IOrganizer", bpy::no_init)