k1a  1.1
Accelerated functionalities for k1lib
k1a::StrIterInter Class Reference

Intermediate string iterator. More...

#include <StrIterInter.h>

Inheritance diagram for k1a::StrIterInter:
[legend]
Collaboration diagram for k1a::StrIterInter:
[legend]

Public Member Functions

 StrIterInter (PyObject *pyObj, StrIter *og, transformF f)
 
std::string next ()
 
 ~StrIterInter ()
 
- Public Member Functions inherited from k1a::StrIter
 StrIter ()
 
 StrIter (PyObject *pyObj)
 
StrItertransform (std::vector< transformF > fs, bool decref=false)
 Transforms StrIter into other iterators. More...
 
long length ()
 
 ~StrIter ()
 

Static Public Member Functions

static void Py_dealloc (PyObject *self)
 
- Static Public Member Functions inherited from k1a::StrIter
template<class T >
static PyObject * Py_next (PyObject *self)
 Default __next__ function. More...
 
template<class T >
static PyObject * Py_repr (PyObject *self)
 Default __repr__ function. More...
 
template<class T >
static Py_ssize_t Py_length (PyObject *self)
 
template<class T >
static void Py_dealloc (PyObject *self)
 Default dealloc function. More...
 
template<class T >
static PySequenceMethods * Py_as_sequence ()
 Default tp_as_sequence method generator. More...
 

Private Attributes

transformF f
 
StrIterog
 

Additional Inherited Members

- Public Attributes inherited from k1a::StrIter
PyObject * pyObj
 Associated python object. More...
 
bool done
 Whether the iterator has any elements left. More...
 

Detailed Description

Intermediate string iterator.

Basically, this is a string iterator you get from transforming another StrIter object. This should not be used directly, use StrIter::transform instead.

Definition at line 18 of file StrIterInter.h.

Constructor & Destructor Documentation

◆ StrIterInter()

k1a::StrIterInter::StrIterInter ( PyObject *  pyObj,
StrIter og,
transformF  f 
)

Definition at line 12 of file StrIterInter.cpp.

12  : StrIter(pyObj) {
13  this->f = f;
14  this->og = og;
15  Py_XINCREF(og->pyObj);
16 }
PyObject * pyObj
Associated python object.
Definition: StrIter.h:81

◆ ~StrIterInter()

k1a::StrIterInter::~StrIterInter ( )

Definition at line 35 of file StrIterInter.cpp.

35  {
36  Py_XDECREF(og->pyObj);
37 }

Member Function Documentation

◆ next()

std::string k1a::StrIterInter::next ( )
virtual

Reimplemented from k1a::StrIter.

Definition at line 26 of file StrIterInter.cpp.

26  {
27  std::string res = og->next();
28  if (og->done) {
29  done = true;
30  return "";
31  } else
32  return f(res);
33 }
bool done
Whether the iterator has any elements left.
Definition: StrIter.h:82
virtual std::string next()
Definition: StrIter.cpp:51
Here is the call graph for this function:

◆ Py_dealloc()

static void k1a::StrIterInter::Py_dealloc ( PyObject *  self)
static

Member Data Documentation

◆ f

transformF k1a::StrIterInter::f
private

Definition at line 20 of file StrIterInter.h.

◆ og

StrIter* k1a::StrIterInter::og
private

Definition at line 21 of file StrIterInter.h.


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