Library of Assembled Shared Sources
|
Python iterator object. More...
#include <pyiteratorrange.h>
Public Member Functions | |
PyIteratorRange (TPimpl pimpl) | |
Construct PyIteratorRange with custom implementation. | |
template<typename Iterator> | |
PyIteratorRange (Iterator first, Iterator last) | |
Construct PyIteratorRange with default implemenation iterating between two iterators. | |
const TPyObjPtr & | owner () const |
Owner object of the iterators. | |
void | setOwner (const TPyObjPtr &owner) |
Owner object of the iterators. | |
Static Public Member Functions | |
static void | _lassPyClassRegisterHook () |
This function can be used to execute some code at injection time. | |
Python iterator object.
This is the class that implements the Python iterator interface and that is exposed to Python. It can be created directly with two iterators, or with a custom implementation deriving from PyIteratorRangeImplBase
.
Definition at line 180 of file pyiteratorrange.h.
const TPyObjPtr & lass::python::PyIteratorRange::owner | ( | ) | const |
Owner object of the iterators.
This is the object that owns the iterators that PyIteratorRange is iterating over and that must stay alive while the PyIteratorRange is in use. If the owning object is destroyed while the PyIteratorRange is still in use, the iterators will become invalid and any further attempts to use the PyIteratorRange will result in undefined behavior.
Setting the owner on the PyIteratorRange will prevent that it is destroyed while the PyIteratorRange is still in use.
If a method or free method returns a PyIteratorRange, the owner will automatically be set to self
, the instance the method was called on, if the owner was not yet set. If that doesn't work for your use case, you must set the owner manually.
Definition at line 84 of file pyiteratorrange.cpp.
Referenced by lass::python::impl::ClassDefinition::establishMagicalBackLinks, and setOwner().
void lass::python::PyIteratorRange::setOwner | ( | const TPyObjPtr & | owner | ) |
Owner object of the iterators.
This is the object that owns the iterators that PyIteratorRange is iterating over and that must stay alive while the PyIteratorRange is in use. If the owning object is destroyed while the PyIteratorRange is still in use, the iterators will become invalid and any further attempts to use the PyIteratorRange will result in undefined behavior.
Setting the owner on the PyIteratorRange will prevent that it is destroyed while the PyIteratorRange is still in use.
If a method or free method returns a PyIteratorRange, the owner will automatically be set to self
, the instance the method was called on, if the owner was not yet set. If that doesn't work for your use case, you must set the owner manually.
Definition at line 89 of file pyiteratorrange.cpp.
References owner().
Referenced by lass::python::impl::ClassDefinition::establishMagicalBackLinks.
|
staticinherited |
This function can be used to execute some code at injection time.
By default it doens't do anything, but you can override it for any type. Be aware that the top level implementation is the only one that counts. Consider it as a 'virtual' function at static level
Definition at line 65 of file pyobject_plus.cpp.