PythonMonkey   v0.8.2 (dev)
Loading...
Searching...
No Matches
JSObjectIterProxy.hh
Go to the documentation of this file.
1
11#ifndef PythonMonkey_JSObjectIterProxy_
12#define PythonMonkey_JSObjectIterProxy_
13
14
15#include <jsapi.h>
16
17#include <Python.h>
18
19#define KIND_KEYS 0
20#define KIND_VALUES 1
21#define KIND_ITEMS 2
22
23
29typedef struct {
30 PyObject_HEAD
31 JS::PersistentRootedIdVector *props;
34 int kind;
35 PyDictObject *di_dict; /* Set to NULL when iterator is exhausted */
37
38
39typedef struct {
42
48public:
55
64 static int JSObjectIterProxy_traverse(JSObjectIterProxy *self, visitproc visit, void *arg);
65
73
80 static PyObject *JSObjectIterProxy_iter(JSObjectIterProxy *self);
81
88 static PyObject *JSObjectIterProxy_nextkey(JSObjectIterProxy *self);
89
96 static PyObject *JSObjectIterProxy_len(JSObjectIterProxy *self);
97};
98
99
100PyDoc_STRVAR(dict_length_hint_doc, "Private method returning an estimate of len(list(it)).");
101
106static PyMethodDef JSObjectIterProxy_methods[] = {
107 {"__length_hint__", (PyCFunction)JSObjectIterProxyMethodDefinitions::JSObjectIterProxy_len, METH_NOARGS, dict_length_hint_doc},
108 {NULL, NULL} /* sentinel */
109};
110
114extern PyTypeObject JSObjectIterProxyType;
115
116#endif
PyDoc_STRVAR(dict_length_hint_doc, "Private method returning an estimate of len(list(it)).")
PyTypeObject JSObjectIterProxyType
Struct for the JSArrayProxyType, used by all JSArrayProxy objects.
Definition pythonmonkey.cc:226
This struct is a bundle of methods used by the JSArrayProxy type.
Definition JSObjectIterProxy.hh:47
static PyObject * JSObjectIterProxy_len(JSObjectIterProxy *self)
length method
Definition JSObjectIterProxy.cc:125
static int JSObjectIterProxy_clear(JSObjectIterProxy *self)
.tp_clear method
Definition JSObjectIterProxy.cc:42
static PyObject * JSObjectIterProxy_nextkey(JSObjectIterProxy *self)
.tp_next method
Definition JSObjectIterProxy.cc:52
static void JSObjectIterProxy_dealloc(JSObjectIterProxy *self)
Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing th...
Definition JSObjectIterProxy.cc:29
static PyObject * JSObjectIterProxy_iter(JSObjectIterProxy *self)
.tp_iter method
Definition JSObjectIterProxy.cc:47
static int JSObjectIterProxy_traverse(JSObjectIterProxy *self, visitproc visit, void *arg)
.tp_traverse method
Definition JSObjectIterProxy.cc:37
Definition JSObjectIterProxy.hh:39
dictiterobject it
Definition JSObjectIterProxy.hh:40
The typedef for the backing store that will be used by JSObjectIterProxy objects.
Definition JSObjectIterProxy.hh:29
PyObject_HEAD JS::PersistentRootedIdVector * props
Definition JSObjectIterProxy.hh:31
int kind
Definition JSObjectIterProxy.hh:34
int it_index
Definition JSObjectIterProxy.hh:32
bool reversed
Definition JSObjectIterProxy.hh:33
PyDictObject * di_dict
Definition JSObjectIterProxy.hh:35