PythonMonkey   v1.0.0 (dev)
Loading...
Searching...
No Matches
PyDictProxyHandler Struct Reference

This struct is the ProxyHandler for JS Proxy Objects pythonmonkey creates to handle coercion from python dicts to JS Objects. More...

#include <PyDictProxyHandler.hh>

Inheritance diagram for PyDictProxyHandler:
[legend]
Collaboration diagram for PyDictProxyHandler:
[legend]

Public Member Functions

 PyDictProxyHandler ()
 
bool ownPropertyKeys (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
 [[OwnPropertyKeys]]
 
bool delete_ (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::ObjectOpResult &result) const override
 [[Delete]]
 
bool has (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const override
 [[HasProperty]]
 
bool set (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::HandleValue v, JS::HandleValue receiver, JS::ObjectOpResult &result) const override
 [[Set]]
 
bool enumerate (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
 [[Enumerate]]
 
bool hasOwn (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const override
 Returns true if id is in proxy, false otherwise.
 
bool getOwnEnumerablePropertyKeys (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
 Returns vector of proxy's own keys.
 
bool getOwnPropertyDescriptor (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc) const override
 
bool defineProperty (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::Handle< JS::PropertyDescriptor > desc, JS::ObjectOpResult &result) const override
 
bool getBuiltinClass (JSContext *cx, JS::HandleObject proxy, js::ESClass *cls) const override
 
- Public Member Functions inherited from PyObjectProxyHandler
 PyObjectProxyHandler ()
 
 PyObjectProxyHandler (const void *childFamily)
 
void finalize (JS::GCContext *gcx, JSObject *proxy) const override
 Handles python object reference count when JS Proxy object is finalized.
 
bool ownPropertyKeys (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
 [[OwnPropertyKeys]]
 
bool delete_ (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::ObjectOpResult &result) const override
 [[Delete]]
 
bool has (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const override
 [[HasProperty]]
 
bool set (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::HandleValue v, JS::HandleValue receiver, JS::ObjectOpResult &result) const override
 [[Set]]
 
bool enumerate (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
 [[Enumerate]]
 
bool hasOwn (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const override
 Returns true if id is in proxy, false otherwise.
 
bool getOwnEnumerablePropertyKeys (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
 Returns vector of proxy's own keys.
 
bool getOwnPropertyDescriptor (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc) const override
 
bool defineProperty (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::Handle< JS::PropertyDescriptor > desc, JS::ObjectOpResult &result) const override
 
bool getBuiltinClass (JSContext *cx, JS::HandleObject proxy, js::ESClass *cls) const override
 
- Public Member Functions inherited from PyBaseProxyHandler
 PyBaseProxyHandler (const void *family)
 
bool getPrototypeIfOrdinary (JSContext *cx, JS::HandleObject proxy, bool *isOrdinary, JS::MutableHandleObject protop) const override final
 
bool preventExtensions (JSContext *cx, JS::HandleObject proxy, JS::ObjectOpResult &result) const override final
 
bool isExtensible (JSContext *cx, JS::HandleObject proxy, bool *extensible) const override final
 

Static Public Attributes

static const char family = 0
 
- Static Public Attributes inherited from PyObjectProxyHandler
static const char family = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from PyObjectProxyHandler
static bool handleOwnPropertyKeys (JSContext *cx, PyObject *keys, size_t length, JS::MutableHandleIdVector props)
 Helper function used by dicts and objects for ownPropertyKeys.
 
static bool handleGetOwnPropertyDescriptor (JSContext *cx, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc, PyObject *item)
 Helper function used by dicts and objects for get OwnPropertyDescriptor.
 
static bool object_toString (JSContext *cx, unsigned argc, JS::Value *vp)
 Helper function used by dicts and objects to convert dict/object to String.
 
static bool object_toLocaleString (JSContext *cx, unsigned argc, JS::Value *vp)
 Helper function used by dicts and objects to convert dict/object to LocaleString.
 
static bool object_valueOf (JSContext *cx, unsigned argc, JS::Value *vp)
 Helper function used by dicts and objects to get valueOf, just returns a new reference to self
 

Detailed Description

This struct is the ProxyHandler for JS Proxy Objects pythonmonkey creates to handle coercion from python dicts to JS Objects.

Constructor & Destructor Documentation

◆ PyDictProxyHandler()

PyDictProxyHandler::PyDictProxyHandler ( )

Member Function Documentation

◆ defineProperty()

bool PyDictProxyHandler::defineProperty ( JSContext *  cx,
JS::HandleObject  proxy,
JS::HandleId  id,
JS::Handle< JS::PropertyDescriptor >  desc,
JS::ObjectOpResult &  result 
) const
override

◆ delete_()

bool PyDictProxyHandler::delete_ ( JSContext *  cx,
JS::HandleObject  proxy,
JS::HandleId  id,
JS::ObjectOpResult &  result 
) const
override

[[Delete]]

Parameters
cx- pointer to JSContext
proxy- The proxy object who's property we wish to delete
id- The key we wish to delete
result- whether the call succeeded or not
Returns
true - call succeeded
false - call failed and an exception has been raised

◆ enumerate()

bool PyDictProxyHandler::enumerate ( JSContext *  cx,
JS::HandleObject  proxy,
JS::MutableHandleIdVector  props 
) const
override

[[Enumerate]]

Parameters
cx- pointer to JSContext
proxy- The proxy object who's keys we output
props- out-parameter of object IDs
Returns
true - call succeeded
false - call failed and an exception has been raised

◆ getBuiltinClass()

bool PyDictProxyHandler::getBuiltinClass ( JSContext *  cx,
JS::HandleObject  proxy,
js::ESClass *  cls 
) const
override

◆ getOwnEnumerablePropertyKeys()

bool PyDictProxyHandler::getOwnEnumerablePropertyKeys ( JSContext *  cx,
JS::HandleObject  proxy,
JS::MutableHandleIdVector  props 
) const
override

Returns vector of proxy's own keys.

Parameters
cx- Pointer to the JSContext
proxy- the proxy object
props- out parameter, the vector of proxy's own keys
Returns
true - the call succeeded
false - the call failed and an exception has been raised

◆ getOwnPropertyDescriptor()

bool PyDictProxyHandler::getOwnPropertyDescriptor ( JSContext *  cx,
JS::HandleObject  proxy,
JS::HandleId  id,
JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > >  desc 
) const
override

◆ has()

bool PyDictProxyHandler::has ( JSContext *  cx,
JS::HandleObject  proxy,
JS::HandleId  id,
bool *  bp 
) const
override

[[HasProperty]]

Parameters
cx- pointer to JSContext
proxy- The proxy object who's property we wish to check
id- key value of the property to check
bp- out-paramter: true if object has property, false if not
Returns
true - call succeeded
false - call failed and an exception has been raised

◆ hasOwn()

bool PyDictProxyHandler::hasOwn ( JSContext *  cx,
JS::HandleObject  proxy,
JS::HandleId  id,
bool *  bp 
) const
override

Returns true if id is in proxy, false otherwise.

Parameters
cxpointer to JSContext
proxyThe proxy object who's property we wish to check
idKey of the property we wish to check
bpout-paramter: true if object has property, false if not
Returns
true call succeeded
false call failed and an exception has been raised

◆ ownPropertyKeys()

bool PyDictProxyHandler::ownPropertyKeys ( JSContext *  cx,
JS::HandleObject  proxy,
JS::MutableHandleIdVector  props 
) const
override

[[OwnPropertyKeys]]

Parameters
cx- pointer to JSContext
proxy- The proxy object who's keys we output
props- out-parameter of object IDs
Returns
true - call succeeded
false - call failed and an exception has been raised

◆ set()

bool PyDictProxyHandler::set ( JSContext *  cx,
JS::HandleObject  proxy,
JS::HandleId  id,
JS::HandleValue  v,
JS::HandleValue  receiver,
JS::ObjectOpResult &  result 
) const
override

[[Set]]

Parameters
cxpointer to JSContext
proxyThe proxy object who's property we wish to set
idKey of the property we wish to set
vValue that we wish to set the property to
receiverThe this value to use when executing any code
resultwhether or not the call succeeded
Returns
true call succeed
false call failed and an exception has been raised

Member Data Documentation

◆ family

const char PyDictProxyHandler::family = 0
static

The documentation for this struct was generated from the following files: