26#include <com/sun/star/uno/Any.hxx>
43#if defined LO_DLLIMPLEMENTATION_PYUNO
44#define LO_DLLPUBLIC_PYUNO SAL_DLLPUBLIC_EXPORT
46#define LO_DLLPUBLIC_PYUNO SAL_DLLPUBLIC_IMPORT
84 PyRef( PyObject * p ) :
m(
p ) { Py_XINCREF(
m ); }
86 PyRef( PyObject * p, __sal_NoAcquire ) :
m(
p ) {}
91 throw std::bad_alloc();
99 PyObject *
get() const noexcept {
return m; }
171 bool pyIterUnpack( PyObject *
const, css::uno::Any & )
const;
203 static void initialize(
204 const css::uno::Reference< css::uno::XComponentContext > & ctx );
210 static bool isInitialized();
222 PyRef any2PyObject (
const css::uno::Any &source )
const;
232 css::uno::Any pyObject2Any (
237 css::uno::Any extractUnoException(
238 const PyRef & excType,
const PyRef & excValue,
const PyRef & excTraceback)
const;
Helper class for keeping references to python objects.
PyRef(PyRef &&r) noexcept
void scratch() noexcept
clears the reference without decreasing the reference count only seldom needed !
bool is() const
returns 1 when the reference points to a python object python object, otherwise 0.
PyRef(PyObject *p, __sal_NoAcquire, NotNull)
PyRef & operator=(PyRef &&r)
PyRef(PyObject *p, __sal_NoAcquire)
PyObject * get() const noexcept
PyRef & operator=(const PyRef &r)
bool operator==(const PyRef &r) const
PyObject * getAcquired() const
helper class for attaching the current thread to the python runtime.
PyThreadAttach(const PyThreadAttach &)=delete
helper class for detaching the current thread from the python runtime to do some blocking,...
~PyThreadDetach()
Acquires the global interpreter lock again.
PyThreadDetach()
Releases the global interpreter lock.
PyThreadDetach(const PyThreadDetach &)=delete
PyThreadDetach & operator=(const PyThreadDetach &)=delete
The pyuno::Runtime class keeps the internal state of the python UNO bridge for the currently in use p...
RuntimeImpl * getImpl() const
Returns the internal handle.
@ NOT_NULL
definition of a no acquire enum for ctors
#define LO_DLLPUBLIC_PYUNO
External interface of the Python UNO bridge.
LO_DLLPUBLIC_PYUNO PyObject * PyInit_pyuno()
function called by the python runtime to initialize the pyuno module.
sal_IntPtr operator()(const PyRef &r) const