LibreOffice Module pyuno (master) 1
Classes | Public Member Functions | Private Attributes | List of all members
pyuno::PyRef Class Reference

Helper class for keeping references to python objects. More...

#include <pyuno.hxx>

Classes

struct  Hash
 

Public Member Functions

 PyRef ()
 
 PyRef (PyObject *p)
 
 PyRef (PyObject *p, __sal_NoAcquire)
 
 PyRef (PyObject *p, __sal_NoAcquire, NotNull)
 
 PyRef (const PyRef &r)
 
 PyRef (PyRef &&r) noexcept
 
 ~PyRef ()
 
PyObject * get () const noexcept
 
PyObject * getAcquired () const
 
PyRefoperator= (const PyRef &r)
 
PyRefoperator= (PyRef &&r)
 
bool operator== (const PyRef &r) const
 
void scratch () noexcept
 clears the reference without decreasing the reference count only seldom needed ! More...
 
bool is () const
 returns 1 when the reference points to a python object python object, otherwise 0. More...
 

Private Attributes

PyObject * m
 

Detailed Description

Helper class for keeping references to python objects.

BEWARE: Look up every python function you use to check whether you get an acquired or not acquired object pointer (python terminus for a not acquired object pointer is 'borrowed reference'). Use in the acquired pointer cases the PyRef( pointer, SAL_NO_ACQUIRE) ctor.

precondition: python has been initialized before and the global interpreter lock is held

Definition at line 79 of file pyuno.hxx.

Constructor & Destructor Documentation

◆ PyRef() [1/6]

pyuno::PyRef::PyRef ( )
inline

Definition at line 83 of file pyuno.hxx.

◆ PyRef() [2/6]

pyuno::PyRef::PyRef ( PyObject *  p)
inline

Definition at line 84 of file pyuno.hxx.

References m, and p.

◆ PyRef() [3/6]

pyuno::PyRef::PyRef ( PyObject *  p,
__sal_NoAcquire   
)
inline

Definition at line 86 of file pyuno.hxx.

References p.

◆ PyRef() [4/6]

pyuno::PyRef::PyRef ( PyObject *  p,
__sal_NoAcquire  ,
NotNull   
)
inline

Definition at line 88 of file pyuno.hxx.

References m, and p.

◆ PyRef() [5/6]

pyuno::PyRef::PyRef ( const PyRef r)
inline

Definition at line 94 of file pyuno.hxx.

References m.

◆ PyRef() [6/6]

pyuno::PyRef::PyRef ( PyRef &&  r)
inlinenoexcept

Definition at line 95 of file pyuno.hxx.

◆ ~PyRef()

pyuno::PyRef::~PyRef ( )
inline

Definition at line 97 of file pyuno.hxx.

References m.

Member Function Documentation

◆ get()

PyObject * pyuno::PyRef::get ( ) const
inlinenoexcept

◆ getAcquired()

PyObject * pyuno::PyRef::getAcquired ( ) const
inline

◆ is()

bool pyuno::PyRef::is ( ) const
inline

◆ operator=() [1/2]

PyRef & pyuno::PyRef::operator= ( const PyRef r)
inline

Definition at line 107 of file pyuno.hxx.

References getAcquired(), and m.

◆ operator=() [2/2]

PyRef & pyuno::PyRef::operator= ( PyRef &&  r)
inline

Definition at line 115 of file pyuno.hxx.

References m.

◆ operator==()

bool pyuno::PyRef::operator== ( const PyRef r) const
inline

Definition at line 124 of file pyuno.hxx.

References get(), and m.

◆ scratch()

void pyuno::PyRef::scratch ( )
inlinenoexcept

clears the reference without decreasing the reference count only seldom needed !

Definition at line 131 of file pyuno.hxx.

References m.

Referenced by pyuno::Adapter::~Adapter().

Member Data Documentation

◆ m

PyObject* pyuno::PyRef::m
private

Definition at line 81 of file pyuno.hxx.

Referenced by get(), getAcquired(), is(), operator=(), operator==(), PyRef(), scratch(), and ~PyRef().


The documentation for this class was generated from the following file: