PythonMonkey   v1.0.1 (dev)
Loading...
Searching...
No Matches
JSObjectKeysProxy.hh
Go to the documentation of this file.
1
11#ifndef PythonMonkey_JSObjectKeysProxy_
12#define PythonMonkey_JSObjectKeysProxy_
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 JSObjectKeysProxy_traverse(JSObjectKeysProxy *self, visitproc visit, void *arg);
50
58
65 static Py_ssize_t JSObjectKeysProxy_length(JSObjectKeysProxy *self);
66
74 static int JSObjectKeysProxy_contains(JSObjectKeysProxy *self, PyObject *key);
75
84 static PyObject *JSObjectKeysProxy_richcompare(JSObjectKeysProxy *self, PyObject *other, int op);
85
92 static PyObject *JSObjectKeysProxy_iter(JSObjectKeysProxy *self);
93
100 static PyObject *JSObjectKeysProxy_repr(JSObjectKeysProxy *self);
101
109 static PyObject *JSObjectKeysProxy_intersect(JSObjectKeysProxy *self, PyObject *other);
110
118 static PyObject *JSObjectKeysProxy_isDisjoint(JSObjectKeysProxy *self, PyObject *other);
119
127
135 static PyObject *JSObjectKeysProxy_mapping(PyObject *self, void *Py_UNUSED(ignored));
136};
137
142static PySequenceMethods JSObjectKeysProxy_sequence_methods = {
145};
146
147static PyNumberMethods JSObjectKeysProxy_number_methods = {
148 // .nb_subtract = default is fine
150 // .nb_xor = default is fine
151 // .nb_or = default is fine
152};
153
154PyDoc_STRVAR(isdisjoint_doc,
155 "Return True if the view and the given iterable have a null intersection.");
156
157PyDoc_STRVAR(reversed_keys_doc,
158 "Return a reverse iterator over the dict keys.");
159
164static PyMethodDef JSObjectKeysProxy_methods[] = {
165 {"isdisjoint", (PyCFunction)JSObjectKeysProxyMethodDefinitions::JSObjectKeysProxy_isDisjoint, METH_O, isdisjoint_doc},
166 {"__reversed__", (PyCFunction)JSObjectKeysProxyMethodDefinitions::JSObjectKeysProxy_iter_reverse, METH_NOARGS, reversed_keys_doc},
167 {NULL, NULL} /* sentinel */
168};
169
170static PyGetSetDef JSObjectKeysProxy_getset[] = {
171 {"mapping", JSObjectKeysProxyMethodDefinitions::JSObjectKeysProxy_mapping, (setter)NULL, "dictionary that this view refers to", NULL},
172 {0}
173};
174
178extern PyTypeObject JSObjectKeysProxyType;
179
180#endif
PyDoc_STRVAR(isdisjoint_doc, "Return True if the view and the given iterable have a null intersection.")
PyTypeObject JSObjectKeysProxyType
Struct for the JSObjectKeysProxyType, used by all JSObjectKeysProxy objects.
Definition pythonmonkey.cc:244
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 JSObjectKeysProxy type.
Definition JSObjectKeysProxy.hh:32
static PyObject * JSObjectKeysProxy_repr(JSObjectKeysProxy *self)
Compute a string representation of the JSObjectKeysProxy.
Definition JSObjectKeysProxy.cc:201
static void JSObjectKeysProxy_dealloc(JSObjectKeysProxy *self)
Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing th...
Definition JSObjectKeysProxy.cc:27
static int JSObjectKeysProxy_traverse(JSObjectKeysProxy *self, visitproc visit, void *arg)
.tp_traverse method
Definition JSObjectKeysProxy.cc:50
static Py_ssize_t JSObjectKeysProxy_length(JSObjectKeysProxy *self)
Length method (.sq_length), returns the number of key-value pairs in the JSObject,...
Definition JSObjectKeysProxy.cc:34
static PyObject * JSObjectKeysProxy_mapping(PyObject *self, void *Py_UNUSED(ignored))
mapping method
Definition JSObjectKeysProxy.cc:382
static int JSObjectKeysProxy_clear(JSObjectKeysProxy *self)
.tp_clear method
Definition JSObjectKeysProxy.cc:55
static PyObject * JSObjectKeysProxy_iter_reverse(JSObjectKeysProxy *self)
reverse iterator method
Definition JSObjectKeysProxy.cc:182
static PyObject * JSObjectKeysProxy_intersect(JSObjectKeysProxy *self, PyObject *other)
Set intersect operation.
Definition JSObjectKeysProxy.cc:232
static PyObject * JSObjectKeysProxy_iter(JSObjectKeysProxy *self)
Return an iterator object to make JSObjectKeysProxy iterable, emitting (key, value) tuples.
Definition JSObjectKeysProxy.cc:163
static PyObject * JSObjectKeysProxy_richcompare(JSObjectKeysProxy *self, PyObject *other, int op)
Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and othe...
Definition JSObjectKeysProxy.cc:91
static PyObject * JSObjectKeysProxy_isDisjoint(JSObjectKeysProxy *self, PyObject *other)
Set disjoint method.
Definition JSObjectKeysProxy.cc:318
static int JSObjectKeysProxy_contains(JSObjectKeysProxy *self, PyObject *key)
Test method (.sq_contains), returns whether a key exists, used by the in operator.
Definition JSObjectKeysProxy.cc:42
The typedef for the backing store that will be used by JSObjectKeysProxy objects.
Definition JSObjectKeysProxy.hh:24
_PyDictViewObject dv
Definition JSObjectKeysProxy.hh:25