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

Class JSArrayProxyMethodDefinitions

include/JSArrayProxy.hh:34–276  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

32 *
33 */
34struct JSArrayProxyMethodDefinitions {
35public:
36 /**
37 * @brief Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing the JSArrayProxy
38 *
39 * @param self - The JSArrayProxy to be free'd
40 */
41 static void JSArrayProxy_dealloc(JSArrayProxy *self);
42
43 /**
44 * @brief Length method (.mp_length and .sq_length), returns the number of keys in the JSObject, used by the python len() method
45 *
46 * @param self - The JSArrayProxy
47 * @return Py_ssize_t The length of the JSArrayProxy
48 */
49 static Py_ssize_t JSArrayProxy_length(JSArrayProxy *self);
50
51 /**
52 * @brief returns a value from the JSArrayProxy given a key, or dispatches to the given key method if such method is found
53 *
54 * @param self - The JSArrayProxy
55 * @param key - The key for the value in the JSArrayProxy
56 * @return PyObject* NULL on exception, the corresponding value otherwise
57 */
58 static PyObject *JSArrayProxy_get(JSArrayProxy *self, PyObject *key);
59
60
61 /**
62 * @brief Getter method (.mp_subscript), returns a value from the JSArrayProxy given a key which can be a slice, used by several built-in python methods as well as the [] and operator
63 *
64 * @param self - The JSArrayProxy
65 * @param key - The key for the value in the JSArrayProxy
66 * @return PyObject* NULL on exception, the corresponding value otherwise
67 */
68 static PyObject *JSArrayProxy_get_subscript(JSArrayProxy *self, PyObject *key);
69
70 /**
71 * @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
72 *
73 * @param self - The JSArrayProxy
74 * @param key - The key to be set or deleted
75 * @param value If NULL, the key-value pair is deleted, if not NULL then a key-value pair is assigned
76 * @return int -1 on exception, any other value otherwise
77 */
78 static int JSArrayProxy_assign_key(JSArrayProxy *self, PyObject *key, PyObject *value);
79
80 /**
81 * @brief Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and other pyObject
82 *
83 * @param self - The JSArrayProxy
84 * @param other - Any other PyObject
85 * @param op - Which boolean operator is being performed (Py_EQ for equality, Py_NE for inequality, all other operators are not implemented)
86 * @return PyObject* - True or false depending on result of comparison
87 */
88 static PyObject *JSArrayProxy_richcompare(JSArrayProxy *self, PyObject *other, int op);
89
90 /**
91 * @brief Return an iterator object to make JSArrayProxy iterable

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected