87 virtual bool accepts(PyObject *pyob)
const {
88 return pyob !=
nullptr && PySequence_Check(pyob) != 0;
187 if (PySequence_SetItem(
mPtr, i, value.mPtr) == -1) {
201 return PySequence_Length(
mPtr);
243 return mSequence == other.mSequence && mCount == other.mCount;
253 return mSequence != other.mSequence || mCount != other.mCount;
286 return iterator(
this, 0);
295 return iterator(
this,
length());
Root of the PyCXX exception hierarchy.
Definition exception.h:19
Temporary owner of a new reference returned by the CPython API.
Definition fromapi.h:25
Object(PyObject *pyob=Py_None)
Take a borrowed reference and add a count of its own.
Definition object.h:52
void validate()
Enforce this type's accepts() test on the stored reference.
Definition object.h:237
PyObject * mPtr
Wrapped reference, null only between release() and the next assignment.
Definition object.h:191
seqref< T > operator*()
Address the element at this position.
Definition seqbase.h:261
bool operator==(const iterator &other) const
Report whether two iterators address the same position of the same sequence.
Definition seqbase.h:242
iterator & operator++()
Step to the next position.
Definition seqbase.h:270
bool operator!=(const iterator &other) const
Report whether two iterators address different positions.
Definition seqbase.h:252
iterator(SeqBase< T > *pSequence, int nWhere)
Address one position.
Definition seqbase.h:233
Handle on any Python sequence, and the base of Py::List, Py::Tuple, and Py::String.
Definition seqbase.h:38
virtual T getItem(int i) const
Read one element.
Definition seqbase.h:172
iterator begin()
Address the first element.
Definition seqbase.h:285
virtual void setItem(int i, const T &value)
Write one element.
Definition seqbase.h:186
int length() const
Number of elements, read without the table.
Definition seqbase.h:200
SeqBase(PyObject *pyob)
Take a borrowed reference on behalf of a derived class.
Definition seqbase.h:58
virtual int size() const
Number of elements.
seqref< T > operator[](int i)
Address one element.
Definition seqbase.h:212
virtual int max_size() const
Longest sequence this handle could address.
virtual bool accepts(PyObject *pyob) const
Accept any reference the sequence protocol supports.
Definition seqbase.h:87
virtual void swap(SeqBase< T > &other)
Exchange references with another handle of the same kind.
iterator end()
Address one past the last element.
Definition seqbase.h:294
SeqBase(const Object &ob)
Take a new reference to an existing object as a sequence.
Definition seqbase.h:73
SeqBase()
Produce a handle on None for a derived class that fills it in afterwards.
Definition seqbase.h:47
virtual int capacity() const
Elements this handle could address without reallocating, which is its length.
Definition seqbase.h:123
Proxy for one element of a sequence, which SeqBase::operator[]() returns.
Definition seqref.h:19
Configuration header of the PyCXX binding layer.
C++ wrappers for the embedded Python interpreter's objects, types, and extension modules.
Definition attributeerror.h:7
SeqBase< Object > Sequence
The sequence handle over plain objects, as released PyCXX spells it.
Definition seqbase.h:300