PythonMonkey   v1.0.1 (dev)
Loading...
Searching...
No Matches
JSObjectProxyMethodDefinitions Struct Reference

This struct is a bundle of methods used by the JSObjectProxy type. More...

#include <JSObjectProxy.hh>

Static Public Member Functions

static void JSObjectProxy_dealloc (JSObjectProxy *self)
 Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing the JSObjectProxy.
 
static Py_ssize_t JSObjectProxy_length (JSObjectProxy *self)
 Length method (.mp_length), returns the number of key-value pairs in the JSObject, used by the python len() method.
 
static PyObject * JSObjectProxy_get (JSObjectProxy *self, PyObject *key)
 Getter method, returns a value from the JSObjectProxy given a key, used by several built-in python methods as well as the . operator.
 
static PyObject * JSObjectProxy_get_subscript (JSObjectProxy *self, PyObject *key)
 Getter method (.mp_subscript), returns a value from the JSObjectProxy given a key, used by the [] operator.
 
static int JSObjectProxy_contains (JSObjectProxy *self, PyObject *key)
 Test method (.sq_contains), returns whether a key exists, used by the in operator.
 
static int JSObjectProxy_assign (JSObjectProxy *self, PyObject *key, PyObject *value)
 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.
 
static PyObject * JSObjectProxy_richcompare (JSObjectProxy *self, PyObject *other, int op)
 Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and other pyobject.
 
static bool JSObjectProxy_richcompare_helper (JSObjectProxy *self, PyObject *other, std::unordered_map< PyObject *, PyObject * > &visited)
 Helper function for JSObjectProxy_richcompare.
 
static PyObject * JSObjectProxy_iter (JSObjectProxy *self)
 Return an iterator object to make JSObjectProxy iterable, emitting (key, value) tuples.
 
static PyObject * JSObjectProxy_iter_next (JSObjectProxy *self)
 Implements next operator function.
 
static PyObject * JSObjectProxy_repr (JSObjectProxy *self)
 Compute a string representation of the JSObjectProxy.
 
static PyObject * JSObjectProxy_or (JSObjectProxy *self, PyObject *other)
 Set union operation.
 
static PyObject * JSObjectProxy_ior (JSObjectProxy *self, PyObject *other)
 Set union operation, in place.
 
static PyObject * JSObjectProxy_get_method (JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
 get method
 
static PyObject * JSObjectProxy_setdefault_method (JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
 setdefault method
 
static PyObject * JSObjectProxy_pop_method (JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs)
 pop method
 
static PyObject * JSObjectProxy_clear_method (JSObjectProxy *self)
 clear method
 
static PyObject * JSObjectProxy_copy_method (JSObjectProxy *self)
 copy method
 
static PyObject * JSObjectProxy_update_method (JSObjectProxy *self, PyObject *args, PyObject *kwds)
 update method update the dict with another dict or iterable
 
static PyObject * JSObjectProxy_keys_method (JSObjectProxy *self)
 keys method
 
static PyObject * JSObjectProxy_values_method (JSObjectProxy *self)
 values method
 
static PyObject * JSObjectProxy_items_method (JSObjectProxy *self)
 items method
 
static int JSObjectProxy_traverse (JSObjectProxy *self, visitproc visit, void *arg)
 tp_traverse
 
static int JSObjectProxy_clear (JSObjectProxy *self)
 tp_clear
 

Detailed Description

This struct is a bundle of methods used by the JSObjectProxy type.

Member Function Documentation

◆ JSObjectProxy_assign()

int JSObjectProxyMethodDefinitions::JSObjectProxy_assign ( JSObjectProxy self,
PyObject *  key,
PyObject *  value 
)
static

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.

Parameters
self- The JSObjectProxy
key- The key to be set or deleted
valueIf NULL, the key-value pair is deleted, if not NULL then a key-value pair is assigned
Returns
int -1 on exception, any other value otherwise

◆ JSObjectProxy_clear()

int JSObjectProxyMethodDefinitions::JSObjectProxy_clear ( JSObjectProxy self)
static

tp_clear

Parameters
self- The JSObjectProxy
Returns
0 on success

◆ JSObjectProxy_clear_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_clear_method ( JSObjectProxy self)
static

clear method

Parameters
self- The JSObjectProxy
Returns
None

◆ JSObjectProxy_contains()

int JSObjectProxyMethodDefinitions::JSObjectProxy_contains ( JSObjectProxy self,
PyObject *  key 
)
static

Test method (.sq_contains), returns whether a key exists, used by the in operator.

Parameters
self- The JSObjectProxy
key- The key for the value in the JSObjectProxy
Returns
int 1 if key is in dict, 0 if not, and -1 on error

◆ JSObjectProxy_copy_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_copy_method ( JSObjectProxy self)
static

copy method

Parameters
self- The JSObjectProxy
Returns
PyObject* copy of the dict

◆ JSObjectProxy_dealloc()

void JSObjectProxyMethodDefinitions::JSObjectProxy_dealloc ( JSObjectProxy self)
static

Deallocation method (.tp_dealloc), removes the reference to the underlying JSObject before freeing the JSObjectProxy.

Parameters
self- The JSObjectProxy to be free'd

◆ JSObjectProxy_get()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_get ( JSObjectProxy self,
PyObject *  key 
)
static

Getter method, returns a value from the JSObjectProxy given a key, used by several built-in python methods as well as the . operator.

Parameters
self- The JSObjectProxy
key- The key for the value in the JSObjectProxy
Returns
PyObject* NULL on exception, the corresponding value otherwise

◆ JSObjectProxy_get_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_get_method ( JSObjectProxy self,
PyObject *const args,
Py_ssize_t  nargs 
)
static

get method

Parameters
self- The JSObjectProxy
args- arguments to the method
nargs- number of args to the method
Returns
PyObject* the value for key if first arg key is in the dictionary, else second arg default

◆ JSObjectProxy_get_subscript()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_get_subscript ( JSObjectProxy self,
PyObject *  key 
)
static

Getter method (.mp_subscript), returns a value from the JSObjectProxy given a key, used by the [] operator.

Parameters
self- The JSObjectProxy
key- The key for the value in the JSObjectProxy
Returns
PyObject* NULL on exception, the corresponding value otherwise

◆ JSObjectProxy_ior()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_ior ( JSObjectProxy self,
PyObject *  other 
)
static

Set union operation, in place.

Parameters
self- The JSObjectProxy
other- The other PyObject to be or'd, expected to be dict or JSObjectProxy
Returns
PyObject* The resulting new dict, must be same object as self

◆ JSObjectProxy_items_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_items_method ( JSObjectProxy self)
static

items method

Parameters
self- The JSObjectProxy
Returns
PyObject* items view of the dict

◆ JSObjectProxy_iter()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_iter ( JSObjectProxy self)
static

Return an iterator object to make JSObjectProxy iterable, emitting (key, value) tuples.

Parameters
self- The JSObjectProxy
Returns
PyObject* - iterator object

◆ JSObjectProxy_iter_next()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_iter_next ( JSObjectProxy self)
static

Implements next operator function.

Parameters
self- The JSObjectProxy
Returns
PyObject* - call result

◆ JSObjectProxy_keys_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_keys_method ( JSObjectProxy self)
static

keys method

Parameters
self- The JSObjectProxy
Returns
PyObject* keys of the dict

◆ JSObjectProxy_length()

Py_ssize_t JSObjectProxyMethodDefinitions::JSObjectProxy_length ( JSObjectProxy self)
static

Length method (.mp_length), returns the number of key-value pairs in the JSObject, used by the python len() method.

Parameters
self- The JSObjectProxy
Returns
Py_ssize_t The length of the JSObjectProxy

◆ JSObjectProxy_or()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_or ( JSObjectProxy self,
PyObject *  other 
)
static

Set union operation.

Parameters
self- The JSObjectProxy
other- The other PyObject to be or'd, expected to be dict or JSObjectProxy
Returns
PyObject* The resulting new dict

◆ JSObjectProxy_pop_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_pop_method ( JSObjectProxy self,
PyObject *const args,
Py_ssize_t  nargs 
)
static

pop method

Parameters
self- The JSObjectProxy
args- arguments to the method
nargs- number of args to the method
Returns
PyObject* If the first arg key is not found, return the second arg default if given; otherwise raise a KeyError

◆ JSObjectProxy_repr()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_repr ( JSObjectProxy self)
static

Compute a string representation of the JSObjectProxy.

Parameters
self- The JSObjectProxy
Returns
the string representation (a PyUnicodeObject) on success, NULL on failure

◆ JSObjectProxy_richcompare()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_richcompare ( JSObjectProxy self,
PyObject *  other,
int  op 
)
static

Comparison method (.tp_richcompare), returns appropriate boolean given a comparison operator and other pyobject.

Parameters
self- The JSObjectProxy
other- Any other PyObject
op- Which boolean operator is being performed (Py_EQ for equality, Py_NE for inequality, all other operators are not implemented)
Returns
PyObject* - True or false depending on result of comparison

◆ JSObjectProxy_richcompare_helper()

bool JSObjectProxyMethodDefinitions::JSObjectProxy_richcompare_helper ( JSObjectProxy self,
PyObject *  other,
std::unordered_map< PyObject *, PyObject * > &  visited 
)
static

Helper function for JSObjectProxy_richcompare.

Parameters
self- The PyObject on the left side of the operator (guaranteed to be a JSObjectProxy *)
other- The PyObject on the right side of the operator
visited
Returns
bool - Whether the compared objects are equal or not

◆ JSObjectProxy_setdefault_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_setdefault_method ( JSObjectProxy self,
PyObject *const args,
Py_ssize_t  nargs 
)
static

setdefault method

Parameters
self- The JSObjectProxy
args- arguments to the method
nargs- number of args to the method
Returns
PyObject* the value for key if first arg key is in the dictionary, else second default

◆ JSObjectProxy_traverse()

int JSObjectProxyMethodDefinitions::JSObjectProxy_traverse ( JSObjectProxy self,
visitproc  visit,
void *  arg 
)
static

tp_traverse

Parameters
self- The JSObjectProxy
visit- The function to be applied on each element of the object
arg- The argument to the visit function
Returns
0 on success

◆ JSObjectProxy_update_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_update_method ( JSObjectProxy self,
PyObject *  args,
PyObject *  kwds 
)
static

update method update the dict with another dict or iterable

Parameters
self- The JSObjectProxy
args- arguments to the sort method
kwds- keyword arguments to the sort method (key-value pairs to be updated in the dict)
Returns
None

◆ JSObjectProxy_values_method()

PyObject * JSObjectProxyMethodDefinitions::JSObjectProxy_values_method ( JSObjectProxy self)
static

values method

Parameters
self- The JSObjectProxy
Returns
PyObject* values view of the dict

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