MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / JSObjectProxyMethodDefinitions

Class JSObjectProxyMethodDefinitions

include/JSObjectProxy.hh:34–248  ·  view source on GitHub ↗

* @brief This struct is a bundle of methods used by the JSObjectProxy type * */

Source from the content-addressed store, hash-verified

32 *
33 */
34struct JSObjectProxyMethodDefinitions {
35public:
36 /**
37 * @brief Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing the JSObjectProxy
38 *
39 * @param self - The JSObjectProxy to be free'd
40 */
41 static void JSObjectProxy_dealloc(JSObjectProxy *self);
42
43 /**
44 * @brief Length method (.mp_length), returns the number of key-value pairs in the JSObject, used by the python len() method
45 *
46 * @param self - The JSObjectProxy
47 * @return Py_ssize_t The length of the JSObjectProxy
48 */
49 static Py_ssize_t JSObjectProxy_length(JSObjectProxy *self);
50
51 /**
52 * @brief Getter method, returns a value from the JSObjectProxy given a key, used by several built-in python methods as well as the . operator
53 *
54 * @param self - The JSObjectProxy
55 * @param key - The key for the value in the JSObjectProxy
56 * @return PyObject* NULL on exception, the corresponding value otherwise
57 */
58 static PyObject *JSObjectProxy_get(JSObjectProxy *self, PyObject *key);
59
60 /**
61 * @brief Getter method (.mp_subscript), returns a value from the JSObjectProxy given a key, used by the [] operator
62 *
63 * @param self - The JSObjectProxy
64 * @param key - The key for the value in the JSObjectProxy
65 * @return PyObject* NULL on exception, the corresponding value otherwise
66 */
67 static PyObject *JSObjectProxy_get_subscript(JSObjectProxy *self, PyObject *key);
68
69 /**
70 * @brief Test method (.sq_contains), returns whether a key exists, used by the in operator
71 *
72 * @param self - The JSObjectProxy
73 * @param key - The key for the value in the JSObjectProxy
74 * @return int 1 if `key` is in dict, 0 if not, and -1 on error
75 */
76 static int JSObjectProxy_contains(JSObjectProxy *self, PyObject *key);
77
78 /**
79 * @brief Assign method (.mp_ass_subscript), assigns a key-value pair if value is non-NULL, or deletes a key-value pair if value is NULL
80 *
81 * @param self - The JSObjectProxy
82 * @param key - The key to be set or deleted
83 * @param value If NULL, the key-value pair is deleted, if not NULL then a key-value pair is assigned
84 * @return int -1 on exception, any other value otherwise
85 */
86 static int JSObjectProxy_assign(JSObjectProxy *self, PyObject *key, PyObject *value);
87
88 /**
89 * @brief Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and other pyobject
90 *
91 * @param self - The JSObjectProxy

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected