PythonMonkey   v1.0.1 (dev)
Loading...
Searching...
No Matches
PyBaseProxyHandler.hh
Go to the documentation of this file.
1
11#ifndef PythonMonkey_PyBaseProxy_
12#define PythonMonkey_PyBaseProxy_
13
14#include <jsapi.h>
15#include <jsfriendapi.h>
16#include <js/Conversions.h>
17#include <js/Proxy.h>
18
19#include <Python.h>
20
24struct PyBaseProxyHandler : public js::BaseProxyHandler {
25public:
26 PyBaseProxyHandler(const void *family) : js::BaseProxyHandler(family) {};
27
28 bool getPrototypeIfOrdinary(JSContext *cx, JS::HandleObject proxy, bool *isOrdinary, JS::MutableHandleObject protop) const override final;
29 bool preventExtensions(JSContext *cx, JS::HandleObject proxy, JS::ObjectOpResult &result) const override final;
30 bool isExtensible(JSContext *cx, JS::HandleObject proxy, bool *extensible) const override final;
31};
32
34
35typedef struct {
36 const char *name; /* The name of the method */
37 JSNative call; /* The C function that implements it */
38 uint16_t nargs; /* The argument count for the method */
40
44PyObject *idToKey(JSContext *cx, JS::HandleId id);
45
49bool keyToId(PyObject *key, JS::MutableHandleId idp);
50
51bool idToIndex(JSContext *cx, JS::HandleId id, Py_ssize_t *index);
52
53#endif
ProxySlots
Definition PyBaseProxyHandler.hh:33
@ OtherSlot
Definition PyBaseProxyHandler.hh:33
@ PyObjectSlot
Definition PyBaseProxyHandler.hh:33
PyObject * idToKey(JSContext *cx, JS::HandleId id)
Convert jsid to a PyObject to be used as dict keys.
Definition PyBaseProxyHandler.cc:19
bool keyToId(PyObject *key, JS::MutableHandleId idp)
Convert Python dict key to jsid.
Definition JSObjectProxy.cc:36
bool idToIndex(JSContext *cx, JS::HandleId id, Py_ssize_t *index)
Definition PyBaseProxyHandler.cc:35
Definition PyBaseProxyHandler.hh:35
const char * name
Definition PyBaseProxyHandler.hh:36
JSNative call
Definition PyBaseProxyHandler.hh:37
uint16_t nargs
Definition PyBaseProxyHandler.hh:38
base class for PyDictProxyHandler and PyListProxyHandler
Definition PyBaseProxyHandler.hh:24
PyBaseProxyHandler(const void *family)
Definition PyBaseProxyHandler.hh:26
bool preventExtensions(JSContext *cx, JS::HandleObject proxy, JS::ObjectOpResult &result) const override final
Definition PyBaseProxyHandler.cc:53
bool isExtensible(JSContext *cx, JS::HandleObject proxy, bool *extensible) const override final
Definition PyBaseProxyHandler.cc:59
bool getPrototypeIfOrdinary(JSContext *cx, JS::HandleObject proxy, bool *isOrdinary, JS::MutableHandleObject protop) const override final
Definition PyBaseProxyHandler.cc:44