forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyIterableProxyHandler.hh
More file actions
39 lines (31 loc) · 1002 Bytes
/
PyIterableProxyHandler.hh
File metadata and controls
39 lines (31 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @file PyIterableProxyHandler.hh
* @author Philippe Laporte (philippe@distributive.network)
* @brief Struct for creating JS proxy objects for iterables
* @date 2024-04-08
*
* @copyright Copyright (c) 2024 Distributive Corp.
*
*/
#ifndef PythonMonkey_PyIterableProxy_
#define PythonMonkey_PyIterableProxy_
#include "include/PyObjectProxyHandler.hh"
/**
* @brief This struct is the ProxyHandler for JS Proxy Iterable pythonmonkey creates to handle coercion from python iterables to JS Objects
*
*/
struct PyIterableProxyHandler : public PyObjectProxyHandler {
public:
PyIterableProxyHandler() : PyObjectProxyHandler(&family) {};
static const char family;
bool getOwnPropertyDescriptor(
JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc
) const override;
/**
* @brief An array of method definitions for Iterable prototype methods
*
*/
static JSMethodDef iterable_methods[];
};
#endif