Functions that operate on Python dict objects. More...
Functions | |
| REPY_Handle | REPY_CreateDict (REPY_u32 size,...) |
| Create a Python dict and return a REPY_Handle for it. | |
| REPY_Handle | REPY_CreateDict_SUH (REPY_u32 size,...) |
| Create a Python dict and return a REPY_Handle for it. | |
| REPY_Handle | REPY_DictGet (REPY_Handle dict, REPY_Handle key) |
| Get an entry from a Python dict, using a REPY handle for the key. | |
| REPY_Handle | REPY_DictGetCStr (REPY_Handle dict, char *key) |
| Get an entry from a Python dict, using a NULL-terminated C string for the key. | |
| void | REPY_DictSet (REPY_Handle dict, REPY_Handle key, REPY_Handle value) |
| Sets/adds a Python object to a Python dict, using a REPY handle for the key. | |
| void | REPY_DictSetCStr (REPY_Handle dict, char *key, REPY_Handle value) |
| Sets/adds a Python object to a Python dict, using a NULL-terminated C string for the key. | |
| REPY_bool | REPY_DictHas (REPY_Handle dict, REPY_Handle key) |
| Checks if a Python dict has an entry with a specific key, using a REPY handle for the key. | |
| REPY_bool | REPY_DictHasCStr (REPY_Handle dict, char *key) |
| Checks if a Python dict has an entry with a specific key, using a NULL-terminated C string for the key. | |
| void | REPY_DictDel (REPY_Handle dict, REPY_Handle key) |
| Remove an entry from a dict via it's key, using a REPY handle for the key. | |
| void | REPY_DictDelCStr (REPY_Handle dict, char *key) |
| Remove an entry from a dict via it's key, using a NULL-terminated C string for the key. | |
Functions that operate on Python dict objects.
| REPY_Handle REPY_CreateDict | ( | REPY_u32 | size, |
| ... ) |
Create a Python dict and return a REPY_Handle for it.
Because the REPY_Handle created by this function requires manual release, it's not recommended to use this function nested inside REPY_Call (or any of it's sister functions) to pass keyword arguments. Use REPY_CreateDict_SUH instead.
| size | The number of entries in the dict. Use 0 for an empty dict. |
| ... | REPY_Handle arguments for each entry in the dict. Each argument should be a two-entry tuple representing a key/value pair (using REPY_CreatePair or REPY_CreatePair_SUH makes this easy). Leave out if size is 0. |
| REPY_Handle REPY_CreateDict_SUH | ( | REPY_u32 | size, |
| ... ) |
Create a Python dict and return a REPY_Handle for it.
This is the recommended function for constructing a keyword arguments tuple nested inside a call to REPY_Call (or any of it's sister functions).
At this time, this function is just shorthand for REPY_MakeSUH(REPY_CreateDict(size, ...)), and thus will perform similarly. However, internal performance improvements may make this function more performant in the future.
| size | The number of entries in the dict. Use 0 for an empty dict. |
| ... | REPY_Handle arguments for each entry in the dict. Each argument should be a two-entry tuple representing a key/value pair (using REPY_CreatePair or REPY_CreatePair_SUH makes this easy). Leave out if size is 0. |
| void REPY_DictDel | ( | REPY_Handle | dict, |
| REPY_Handle | key ) |
Remove an entry from a dict via it's key, using a REPY handle for the key.
Note that any hashable Python type can be used as a dict key, not just str objects.
| dict | The dict to remove an entry from. |
| key | The key for the entry. Should be a hashable Python type. |
| void REPY_DictDelCStr | ( | REPY_Handle | dict, |
| char * | key ) |
Remove an entry from a dict via it's key, using a NULL-terminated C string for the key.
The key variable will treated as a str object, as that is the most common use-case, as well as the use-case for code execution scopes.
| dict | The dict to remove an entry from. |
| key | The key for the entry. Should be a NULL-terminated C string. |
| REPY_Handle REPY_DictGet | ( | REPY_Handle | dict, |
| REPY_Handle | key ) |
Get an entry from a Python dict, using a REPY handle for the key.
Note that any hashable Python type can be used as a dict key, not just str objects.
| dict | The dict to get an entry from. |
| key | The key for the entry. Should be a hashable Python type. |
| REPY_Handle REPY_DictGetCStr | ( | REPY_Handle | dict, |
| char * | key ) |
Get an entry from a Python dict, using a NULL-terminated C string for the key.
The key variable will treated as a str object, as that is the most common use-case, as well as the use-case for code execution scopes.
| dict | The dict to get an entry from. |
| key | The key for the entry. Should be a NULL-terminated C string. |
| REPY_bool REPY_DictHas | ( | REPY_Handle | dict, |
| REPY_Handle | key ) |
Checks if a Python dict has an entry with a specific key, using a REPY handle for the key.
Note that any hashable Python type can be used as a dict key, not just str objects.
| dict | The dict to check for a key in. |
| key | The key for the entry. Should be a hashable Python type. |
| REPY_bool REPY_DictHasCStr | ( | REPY_Handle | dict, |
| char * | key ) |
Checks if a Python dict has an entry with a specific key, using a NULL-terminated C string for the key.
The key variable will treated as a str object, as that is the most common use-case, as well as the use-case for code execution scopes.
| dict | The dict to check for a key in. |
| key | The key for the entry. Should be a NULL-terminated C string. |
| void REPY_DictSet | ( | REPY_Handle | dict, |
| REPY_Handle | key, | ||
| REPY_Handle | value ) |
Sets/adds a Python object to a Python dict, using a REPY handle for the key.
Note that any hashable Python type can be used as a dict key, not just str objects.
| dict | The dict to insert into. |
| key | The key for the entry. Should be a hashable Python type. |
| value | The object to add. |
| void REPY_DictSetCStr | ( | REPY_Handle | dict, |
| char * | key, | ||
| REPY_Handle | value ) |
Sets/adds a Python object to a Python dict, using a NULL-terminated C string for the key.
The key variable will treated as a str object, as that is the most common use-case, as well as the use-case for code execution scopes.
| dict | The dict to insert into. |
| key | The key for the entry. Should be a NULL-terminated C string. |
| value | The object to add. |