Merge pull request #96 from Holt59/remove-boost-uibase

Update after removal of boost in uibase.
This commit is contained in:
Mikaël Capelle
2021-05-27 15:43:22 +02:00
committed by GitHub
3 changed files with 9 additions and 9 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.
};