RecompExternalPython for N64Recompiled 2.0.0
Loading...
Searching...
No Matches
Object Attribute Functions

Functions related to accessing the members and propertied of objects. More...

Functions

REPY_u32 REPY_Len (REPY_Handle object)
 Gets the length of an appropriate Python object as a u32.
REPY_Handle REPY_GetAttr (REPY_Handle object, REPY_Handle key, REPY_Handle default_value_nullable)
 Returns a REPY_Handle for a named attribute of a Python object, using a REPY_Handle for the attribute name.
REPY_Handle REPY_GetAttrCStr (REPY_Handle object, char *key, REPY_Handle default_value_nullable)
 Returns a REPY_Handle for a named attribute of a Python object, using a NULL-terminated C string for the name.
void REPY_SetAttr (REPY_Handle object, REPY_Handle key, REPY_Handle value)
 Assigned a named attribute of a Python object, using a REPY_Handle for the attribute name.
void REPY_SetAttrCStr (REPY_Handle object, char *key, REPY_Handle value)
 Assigned a named attribute of a Python object, using a NULL-terminated C string for the name.
REPY_bool REPY_HasAttr (REPY_Handle object, REPY_Handle key)
 Checks if a Python object has an attribute with a specific name, using a REPY_Handle for the attribute name.
REPY_bool REPY_HasAttrCStr (REPY_Handle object, char *key)
 Checks if a Python object has an attribute with a specific name, using a NULL-terminated C string for the name.
void REPY_DelAttr (REPY_Handle object, REPY_Handle key)
 Deletes an attribute from a Python object by name, using a REPY_Handle for the attribute name.
void REPY_DelAttrCStr (REPY_Handle object, char *key)
 Deletes an attribute from a Python object by name, using a NULL-terminated C string for the name.

Detailed Description

Functions related to accessing the members and propertied of objects.

Function Documentation

◆ REPY_DelAttr()

void REPY_DelAttr ( REPY_Handle object,
REPY_Handle key )

Deletes an attribute from a Python object by name, using a REPY_Handle for the attribute name.

This function is analogous to Python's own delattr, and should work all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute to delete. The Python object referenced should generally be a str, as is standard with delattr.

◆ REPY_DelAttrCStr()

void REPY_DelAttrCStr ( REPY_Handle object,
char * key )

Deletes an attribute from a Python object by name, using a NULL-terminated C string for the name.

This function is analogous to Python's own delattr, and should work all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute to delete. Should be a NULL-terminated C string. Will be REPY_NO_HANDLE if an error occured.

◆ REPY_GetAttr()

REPY_Handle REPY_GetAttr ( REPY_Handle object,
REPY_Handle key,
REPY_Handle default_value_nullable )

Returns a REPY_Handle for a named attribute of a Python object, using a REPY_Handle for the attribute name.

This function is analogous to Python's own getattr function, and should work in all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute you're trying to access. The Python object referenced should generally be a str, as is standard with getattr.
default_value_nullableA default Python object to return if the attribute isn't found. Use REPY_NO_OBJECT to ignore this argument. Note that if this default object is returned, the return value will be a new handle to the same object.
Returns
A handle to the desired attribute. Not that REPY_NO_OBJECT being returned doesn't necessarily mean that the object doesn't exist, only that an error has occured.

◆ REPY_GetAttrCStr()

REPY_Handle REPY_GetAttrCStr ( REPY_Handle object,
char * key,
REPY_Handle default_value_nullable )

Returns a REPY_Handle for a named attribute of a Python object, using a NULL-terminated C string for the name.

This function is analogous to Python's own getattr function, and should work in all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute you're trying to access. Should be a NULL-terminated C string.
default_value_nullableA default Python object to return if the attribute isn't found. Use REPY_NO_OBJECT to ignore this argument. Note that if this default object is returned, the return value will be a new handle to the same object.
Returns
A handle to the desired attribute. Not that REPY_NO_OBJECT being returned doesn't necessarily mean that the object doesn't exist, only that an error has occured.

◆ REPY_HasAttr()

REPY_bool REPY_HasAttr ( REPY_Handle object,
REPY_Handle key )

Checks if a Python object has an attribute with a specific name, using a REPY_Handle for the attribute name.

This function is analogous to Python's own hasattr function, and should work in all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute to check. The Python object referenced should generally be a str, as is standard with hasattr.
Returns
true if the attribute exists, false otherwise.

◆ REPY_HasAttrCStr()

REPY_bool REPY_HasAttrCStr ( REPY_Handle object,
char * key )

Checks if a Python object has an attribute with a specific name, using a NULL-terminated C string for the name.

This function is analogous to Python's own hasattr function, and should work in all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute to check. Should be a NULL-terminated C string.
Returns
true if the attribute exists, false otherwise.

◆ REPY_Len()

REPY_u32 REPY_Len ( REPY_Handle object)

Gets the length of an appropriate Python object as a u32.

This function is analogous to Python's own len function, and should work in all the same circumstances.

Parameters
objectThe Python object to get the length of.

◆ REPY_SetAttr()

void REPY_SetAttr ( REPY_Handle object,
REPY_Handle key,
REPY_Handle value )

Assigned a named attribute of a Python object, using a REPY_Handle for the attribute name.

This function is analogous to Python's own setattr function, and should work in all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute you're trying to assign to. The Python object referenced should generally be a str, as is standard with setattr.
valueThe Python object to assign to the attribute.

◆ REPY_SetAttrCStr()

void REPY_SetAttrCStr ( REPY_Handle object,
char * key,
REPY_Handle value )

Assigned a named attribute of a Python object, using a NULL-terminated C string for the name.

This function is analogous to Python's own setattr function, and should work in all the same circumstances.

Parameters
objectThe parent Python object.
keyThe name of attribute you're trying to assign to. The Python object referenced should generally be a str, as is standard with setattr.
valueThe Python object to assign to the attribute.