Namespace sh::scripting::pythoninterop

namespace sh::scripting::pythoninterop

Interoperation layer between the Shallot core (C++) and Python plugins.

Typedefs

using StringMap = QMap<QString, V>

Functions

PyObject *getPyNone()
bool isPyNone(PyObject *o)
void *getPointerFromShallotPyObject(PyObject *o)
std::shared_ptr<void> getSharedPointerFromShallotPyObject(PyObject *o)
PyObject *getShallotPyObjectFromPointer(void *o, sh::scripting::ApiClass *apiclass)
PyObject *getShallotPyObjectFromSharedPointer(std::shared_ptr<void> o, sh::scripting::ApiClass *apiclass)
sh::scripting::ApiClass *getApiClass(QString typeIdName)
PyObject *PyTupleGetItem(PyObject *o, int itm)
PyObject *PyListGetItem(PyObject *o, int itm)
int PyTupleCount(PyObject *o)
int PyListCount(PyObject *o)
bool PyIsTuple(PyObject *o)
bool PyIsList(PyObject *o)
bool PyIsUnicode(PyObject *o)
bool PyIsBytes(PyObject *o)
bool PyIsDict(PyObject *o)
bool PyIsBool(PyObject *o)
bool PyIsFloat(PyObject *o)
bool PyIsLong(PyObject *o)
void PyIncRef(PyObject *o)
void PyDecRef(PyObject *o)
void PyTupleSetItem(PyObject *o, int itm, PyObject *val)
PyObject *PyObjectCall(PyObject *fct, PyObject *args)
PyObject *PyTupleNew(int cnt)
PyObject *PyDictNew()
PyObject *PyDictKeys(PyObject *o)
PyObject *PyDictGetItem(PyObject *dict, PyObject *key)
void PyDictSetItem(PyObject *dict, PyObject *key, PyObject *val)
bool PythonToC_ExecuteGuarded(std::function<void()> fct)
void invokePython(std::function<void()> fct)
template<typename R, typename T, typename ...ArgsF, typename ...ArgsT>
R CallNativeFunctionWithTuple(T *pObj, R (T::* f)(ArgsF...), std::tuple<ArgsT...> const &t, )
template<typename R, typename T, typename ...ArgsF, typename ...ArgsT>
R CallNativeHelperFunctionWithTuple(T *pObj, R (*f)(T*, ArgsF...), std::tuple<ArgsT...> const &t, )
template<int pos, class ...Args>
class _PyObjectFunctionToNativeFunction_SetTupleValue
#include <pythonscriptinterpreter.h>
template<int pos>
class _PyObjectFunctionToNativeFunction_SetTupleValue<pos>
#include <pythonscriptinterpreter.h>

Public Static Functions

void setTupleValue(PyObject*)
template<int pos, class Arg, class ...Args>
class _PyObjectFunctionToNativeFunction_SetTupleValue<pos, Arg, Args...>
#include <pythonscriptinterpreter.h>

Public Static Functions

void setTupleValue(PyObject *tup, Arg arg, Args... args)
template<int pos, class ...Args>
class _PyObjectFunctionToNativeFunction_TupleValueSetter
#include <pythonscriptinterpreter.h>

This class is a workaround for gcc<4.9 bug 55914. It was not able to call …::setTupleValue directly from within the invokePython lambda

Public Functions

_PyObjectFunctionToNativeFunction_TupleValueSetter(Args... args)
void set(PyObject *tuple)

Private Members

std::function<void(PyObject*)> _set

Private Static Functions

void __set(Args... args, PyObject *tuple)
template<typename T, T>
struct CallNativeHelperMethodWithPyObjectArguments
#include <pythonscriptinterpreter.h>
template<typename T, typename R, typename ... Args, R(*)(T *, Args...) MF> CallNativeHelperMethodWithPyObjectArguments< R(*)(T *, Args...), MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *call(PyObject *a, PyObject *b)
template<typename T, typename ... Args, void(*)(T *, Args...) MF> CallNativeHelperMethodWithPyObjectArguments< void(*)(T *, Args...), MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *call(PyObject *a, PyObject *b)
template<typename T, T>
struct CallNativeMethodWithPyObjectArguments
#include <pythonscriptinterpreter.h>
template<typename T, typename R, typename ... Args, R(T::*)(Args...) const MF> *)(Args...) const, MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *call(PyObject *a, PyObject *b)
template<typename T, typename R, typename ... Args, R(T::*)(Args...) MF> *)(Args...), MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *call(PyObject *a, PyObject *b)
template<typename T, typename ... Args, void(T::*)(Args...) const MF> *)(Args...) const, MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *call(PyObject *a, PyObject *b)
template<typename T, typename ... Args, void(T::*)(Args...) MF> *)(Args...), MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *call(PyObject *a, PyObject *b)
class Converters
#include <pythonscriptinterpreter.h>

Public Static Functions

QString getStringFromPyObject(PyObject *o)
QVariant getVariantFromPyObject(PyObject *o)
int getIntFromPyObject(PyObject *o)
double getDoubleFromPyObject(PyObject *o)
qint64 getInt64FromPyObject(PyObject *o)
quint64 getUint64FromPyObject(PyObject *o)
bool getBoolFromPyObject(PyObject *o)
QByteArray getByteArrayFromPyObject(PyObject *o)
void *getPointerFromPyObject(PyObject *o)
std::shared_ptr<void> getSharedPointerFromPyObject(PyObject *o)
PyObject *getPyObjectFromString(QString v)
PyObject *getPyObjectFromVariant(QVariant v)
PyObject *getPyObjectFromInt(int v)
PyObject *getPyObjectFromDouble(double v)
PyObject *getPyObjectFromInt64(qint64 v)
PyObject *getPyObjectFromUint64(quint64 v)
PyObject *getPyObjectFromBool(bool v)
PyObject *getPyObjectFromByteArray(QByteArray v)
template<int mode, uint N>
struct FunctionBindTuple
#include <pythonscriptinterpreter.h>
template<>
struct FunctionBindTuple<0, 0>
#include <pythonscriptinterpreter.h>

Public Static Functions

template<typename R, typename T, typename ...ArgsF, typename ...ArgsT, typename ...Args>
R applyTuple(T *pObj, R (T::* f)(ArgsF...), const std::tuple<ArgsT...>&, Args... args, )
template<uint N>
struct FunctionBindTuple<0, N>
#include <pythonscriptinterpreter.h>

Public Static Functions

template<typename R, typename T, typename ...ArgsF, typename ...ArgsT, typename ...Args>
R applyTuple(T *pObj, R (T::* f)(ArgsF...), const std::tuple<ArgsT...> &t, Args... args, )
template<>
struct FunctionBindTuple<1, 0>
#include <pythonscriptinterpreter.h>

Public Static Functions

template<typename R, typename T, typename ...ArgsF, typename ...ArgsT, typename ...Args>
R applyTuple(T *pObj, R (*f)(T*, ArgsF...), const std::tuple<ArgsT...>&, Args... args, )
template<uint N>
struct FunctionBindTuple<1, N>
#include <pythonscriptinterpreter.h>

Public Static Functions

template<typename R, typename T, typename ...ArgsF, typename ...ArgsT, typename ...Args>
R applyTuple(T *pObj, R (*f)(T*, ArgsF...), const std::tuple<ArgsT...> &t, Args... args, )
template<class V>
class NativeToPyObject
#include <pythonscriptinterpreter.h>

Helps to return a Python object from a native c++ value (with reference ownership)

template<>
class NativeToPyObject<bool>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(bool v)
template<>
class NativeToPyObject<double>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(double v)
template<>
class NativeToPyObject<int>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(int v)
template<>
class NativeToPyObject<QByteArray>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(QByteArray v)
template<>
class NativeToPyObject<qint64>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(qint64 v)
template<typename V>
class NativeToPyObject<QList<V>>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(QList<V> v)
template<typename V>
class NativeToPyObject<QMap<QString, V>>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(QMap<QString, V> v)
template<>
class NativeToPyObject<QString>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(QString v)
template<>
class NativeToPyObject<quint64>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(quint64 v)
template<>
class NativeToPyObject<QVariant>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(QVariant v)
template<class V> shared_ptr< const V > >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(std::shared_ptr<const V> v)
template<class V> shared_ptr< V > >
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(std::shared_ptr<V> v)
template<class V>
class NativeToPyObject<V*>
#include <pythonscriptinterpreter.h>

Public Static Functions

PyObject *toPyObject(V *v)
template<class R, class ...Args>
class PyObjectFunctionToNativeFunction
#include <pythonscriptinterpreter.h>

Public Static Functions

std::function<R(Args...)> toNativeFunction(PyObject *self, PyObject *fct)
template<class ...Args>
class PyObjectFunctionToNativeFunction<void, Args...>
#include <pythonscriptinterpreter.h>

Public Static Functions

std::function<void(Args...)> toNativeFunction(PyObject *self, PyObject *fct)
template<class V>
class PyObjectToNative
#include <pythonscriptinterpreter.h>

Helps to return a c++ value from a Python object (borrows the reference)

template<>
class PyObjectToNative<bool>
#include <pythonscriptinterpreter.h>

Public Static Functions

bool toNative(PyObject*, PyObject *o)
template<>
class PyObjectToNative<double>
#include <pythonscriptinterpreter.h>

Public Static Functions

double toNative(PyObject*, PyObject *o)
template<>
class PyObjectToNative<int>
#include <pythonscriptinterpreter.h>

Public Static Functions

int toNative(PyObject*, PyObject *o)
template<>
class PyObjectToNative<QByteArray>
#include <pythonscriptinterpreter.h>

Public Static Functions

QByteArray toNative(PyObject*, PyObject *o)
template<>
class PyObjectToNative<qint64>
#include <pythonscriptinterpreter.h>

Public Static Functions

qint64 toNative(PyObject*, PyObject *o)
template<class V>
class PyObjectToNative<QList<V>>
#include <pythonscriptinterpreter.h>

Public Static Functions

QList<V> toNative(PyObject *a, PyObject *o)
template<>
class PyObjectToNative<QString>
#include <pythonscriptinterpreter.h>

Public Static Functions

QString toNative(PyObject*, PyObject *o)
template<>
class PyObjectToNative<quint64>
#include <pythonscriptinterpreter.h>

Public Static Functions

qint64 toNative(PyObject*, PyObject *o)
template<>
class PyObjectToNative<QVariant>
#include <pythonscriptinterpreter.h>

Public Static Functions

QVariant toNative(PyObject*, PyObject *o)
template<class V, class ... Args> function< V(Args...)> >
#include <pythonscriptinterpreter.h>

Public Static Functions

std::function<V(Args...)> toNative(PyObject *self, PyObject *io)
template<class V> shared_ptr< V > >
#include <pythonscriptinterpreter.h>

Public Static Functions

std::shared_ptr<V> toNative(PyObject*, PyObject *o)
template<class V>
class PyObjectToNative<StringMap<V>>
#include <pythonscriptinterpreter.h>

Public Static Functions

StringMap<V> toNative(PyObject *a, PyObject *o)
template<class V>
class PyObjectToNative<V*>
#include <pythonscriptinterpreter.h>

Public Static Functions

V *toNative(PyObject*, PyObject *o)
template<int pos, typename ...Args>
struct PyObjectTupleToNativeTuple
#include <pythonscriptinterpreter.h>
template<int pos>
struct PyObjectTupleToNativeTuple<pos>
#include <pythonscriptinterpreter.h>

Public Static Functions

std::tuple toNativeTuple(PyObject*, PyObject*)
template<int pos, class T, class ...Args>
struct PyObjectTupleToNativeTuple<pos, T, Args...>
#include <pythonscriptinterpreter.h>

Public Static Functions

std::tuple<T, Args...> toNativeTuple(PyObject *a, PyObject *b)
template<typename D, typename T, T>
struct ScriptedMethodProxy
#include <pythonscriptinterpreter.h>
template<typename T, typename R, typename ... Args, std::function< R(Args...)> T::* MF> *, MF >
#include <pythonscriptinterpreter.h>

Public Static Functions

void setImplementation(T *inst, std::function<R(Args...)> vfct)
PyObject *pyObjectFunctionSetImplementation(PyObject *a, PyObject *b)