PythonMonkey   v1.0.1 (dev)
Loading...
Searching...
No Matches
JSObjectItemsProxy.hh
Go to the documentation of this file.
1
11#ifndef PythonMonkey_JSObjectItemsProxy_
12#define PythonMonkey_JSObjectItemsProxy_
13
14#include <jsapi.h>
15
16#include <Python.h>
17#include "include/pyshim.hh"
18
19
24typedef struct {
25 _PyDictViewObject dv;
27
33public:
40
49 static int JSObjectItemsProxy_traverse(JSObjectItemsProxy *self, visitproc visit, void *arg);
50
58
65 static Py_ssize_t JSObjectItemsProxy_length(JSObjectItemsProxy *self);
66
73 static PyObject *JSObjectItemsProxy_iter(JSObjectItemsProxy *self);
74
81 static PyObject *JSObjectItemsProxy_repr(JSObjectItemsProxy *self);
82
90
98 static PyObject *JSObjectItemsProxy_mapping(PyObject *self, void *Py_UNUSED(ignored));
99};
100
105static PySequenceMethods JSObjectItemsProxy_sequence_methods = {
107 // .sq_contains = TODO tuple support
108};
109
110PyDoc_STRVAR(items_reversed_keys_doc,
111 "Return a reverse iterator over the dict keys.");
112
117static PyMethodDef JSObjectItemsProxy_methods[] = {
118 // {"isdisjoint"}, // TODO tuple support
119 {"__reversed__", (PyCFunction)JSObjectItemsProxyMethodDefinitions::JSObjectItemsProxy_iter_reverse, METH_NOARGS, items_reversed_keys_doc},
120 {NULL, NULL} /* sentinel */
121};
122
123static PyGetSetDef JSObjectItemsProxy_getset[] = {
124 {"mapping", JSObjectItemsProxyMethodDefinitions::JSObjectItemsProxy_mapping, (setter)NULL, "dictionary that this view refers to", NULL},
125 {0}
126};
127
131extern PyTypeObject JSObjectItemsProxyType;
132
133#endif
PyDoc_STRVAR(items_reversed_keys_doc, "Return a reverse iterator over the dict keys.")
PyTypeObject JSObjectItemsProxyType
Struct for the JSObjectItemsProxyType, used by all JSObjectItemsProxy objects.
Definition pythonmonkey.cc:284
Python's C APIs are constantly changing in different versions of CPython. PythonMonkey has a wide var...
This struct is a bundle of methods used by the JSObjectItemsProxy type.
Definition JSObjectItemsProxy.hh:32
static PyObject * JSObjectItemsProxy_iter(JSObjectItemsProxy *self)
Return an iterator object to make JSObjectItemsProxy iterable, emitting (key, value) tuples.
Definition JSObjectItemsProxy.cc:53
static PyObject * JSObjectItemsProxy_repr(JSObjectItemsProxy *self)
Compute a string representation of the JSObjectItemsProxy.
Definition JSObjectItemsProxy.cc:91
static Py_ssize_t JSObjectItemsProxy_length(JSObjectItemsProxy *self)
Length method (.sq_length), returns the number of key-value pairs in the JSObject,...
Definition JSObjectItemsProxy.cc:35
static int JSObjectItemsProxy_traverse(JSObjectItemsProxy *self, visitproc visit, void *arg)
.tp_traverse method
Definition JSObjectItemsProxy.cc:43
static void JSObjectItemsProxy_dealloc(JSObjectItemsProxy *self)
Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing th...
Definition JSObjectItemsProxy.cc:28
static PyObject * JSObjectItemsProxy_mapping(PyObject *self, void *Py_UNUSED(ignored))
mapping method
Definition JSObjectItemsProxy.cc:113
static int JSObjectItemsProxy_clear(JSObjectItemsProxy *self)
.tp_clear method
Definition JSObjectItemsProxy.cc:48
static PyObject * JSObjectItemsProxy_iter_reverse(JSObjectItemsProxy *self)
reverse iterator method
Definition JSObjectItemsProxy.cc:72
The typedef for the backing store that will be used by JSObjectItemsProxy objects.
Definition JSObjectItemsProxy.hh:24
_PyDictViewObject dv
Definition JSObjectItemsProxy.hh:25