PythonMonkey   v0.8.2 (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
18
23typedef struct {
24 _PyDictViewObject dv;
26
32public:
39
48 static int JSObjectItemsProxy_traverse(JSObjectItemsProxy *self, visitproc visit, void *arg);
49
57
64 static Py_ssize_t JSObjectItemsProxy_length(JSObjectItemsProxy *self);
65
72 static PyObject *JSObjectItemsProxy_iter(JSObjectItemsProxy *self);
73
80 static PyObject *JSObjectItemsProxy_repr(JSObjectItemsProxy *self);
81
89
97 static PyObject *JSObjectItemsProxy_mapping(PyObject *self, void *Py_UNUSED(ignored));
98};
99
104static PySequenceMethods JSObjectItemsProxy_sequence_methods = {
106 // .sq_contains = TODO tuple support
107};
108
109PyDoc_STRVAR(items_reversed_keys_doc,
110 "Return a reverse iterator over the dict keys.");
111
116static PyMethodDef JSObjectItemsProxy_methods[] = {
117 // {"isdisjoint"}, // TODO tuple support
118 {"__reversed__", (PyCFunction)JSObjectItemsProxyMethodDefinitions::JSObjectItemsProxy_iter_reverse, METH_NOARGS, items_reversed_keys_doc},
119 {NULL, NULL} /* sentinel */
120};
121
122static PyGetSetDef JSObjectItemsProxy_getset[] = {
123 {"mapping", JSObjectItemsProxyMethodDefinitions::JSObjectItemsProxy_mapping, (setter)NULL, "dictionary that this view refers to", NULL},
124 {0}
125};
126
130extern PyTypeObject JSObjectItemsProxyType;
131
132#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:283
This struct is a bundle of methods used by the JSObjectItemsProxy type.
Definition JSObjectItemsProxy.hh:31
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:23
_PyDictViewObject dv
Definition JSObjectItemsProxy.hh:24