PythonMonkey   v0.3.1 (dev)
Loading...
Searching...
No Matches
JSArrayIterProxy.hh
Go to the documentation of this file.
1
12#ifndef PythonMonkey_JSArrayIterProxy_
13#define PythonMonkey_JSArrayIterProxy_
14
15
16#include <jsapi.h>
17
18#include <Python.h>
19
20
21// redeclare hidden type
22typedef struct {
23 PyObject_HEAD
26 PyListObject *it_seq; /* Set to NULL when iterator is exhausted */
28
33typedef struct {
36
42public:
49
58 static int JSArrayIterProxy_traverse(JSArrayIterProxy *self, visitproc visit, void *arg);
59
66 static PyObject *JSArrayIterProxy_iter(JSArrayIterProxy *self);
67
74 static PyObject *JSArrayIterProxy_next(JSArrayIterProxy *self);
75
82 static PyObject *JSArrayIterProxy_len(JSArrayIterProxy *self);
83};
84
85
86PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
87
92static PyMethodDef JSArrayIterProxy_methods[] = {
93 {"__length_hint__", (PyCFunction)JSArrayIterProxyMethodDefinitions::JSArrayIterProxy_len, METH_NOARGS, length_hint_doc},
94 {NULL, NULL} /* sentinel */
95};
96
100extern PyTypeObject JSArrayIterProxyType;
101
102#endif
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).")
PyTypeObject JSArrayIterProxyType
Struct for the JSArrayProxyType, used by all JSArrayProxy objects.
Definition pythonmonkey.cc:122
This struct is a bundle of methods used by the JSArrayProxy type.
Definition JSArrayIterProxy.hh:41
static PyObject * JSArrayIterProxy_len(JSArrayIterProxy *self)
length method
Definition JSArrayIterProxy.cc:68
static PyObject * JSArrayIterProxy_next(JSArrayIterProxy *self)
.tp_next method
Definition JSArrayIterProxy.cc:42
static void JSArrayIterProxy_dealloc(JSArrayIterProxy *self)
Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing th...
Definition JSArrayIterProxy.cc:25
static PyObject * JSArrayIterProxy_iter(JSArrayIterProxy *self)
.tp_iter method
Definition JSArrayIterProxy.cc:37
static int JSArrayIterProxy_traverse(JSArrayIterProxy *self, visitproc visit, void *arg)
.tp_traverse method
Definition JSArrayIterProxy.cc:32
The typedef for the backing store that will be used by JSArrayIterProxy objects.
Definition JSArrayIterProxy.hh:33
PyListIterObject it
Definition JSArrayIterProxy.hh:34
Definition JSArrayIterProxy.hh:22
PyListObject * it_seq
Definition JSArrayIterProxy.hh:26
PyObject_HEAD int it_index
Definition JSArrayIterProxy.hh:24
bool reversed
Definition JSArrayIterProxy.hh:25