Method functions to operate on REPY_IteratorHelper objects. More...
Functions | |
| REPY_IteratorHelper * | REPY_IteratorHelper_Create (REPY_Handle py_object, REPY_Handle py_scope_nullable, const char *var_name, REPY_bool auto_destroy) |
| Create a REPY_IteratorHelper object on the heap. | |
| void | REPY_IteratorHelper_Destroy (REPY_IteratorHelper *helper) |
| Destructs a REPY_IteratorHelper object from the heap. | |
| REPY_bool | REPY_IteratorHelper_Update (REPY_IteratorHelper *helper) |
| Makes the REPY_IteratorHelper move on to the next object in the iteration. | |
| REPY_u32 | REPY_IteratorHelper_GetIndex (REPY_IteratorHelper *helper) |
| Gets the current index of a REPY_IteratorHelper object. | |
| REPY_Handle | REPY_IteratorHelper_BorrowCurrent (REPY_IteratorHelper *helper) |
| Gets the REPY_Handle for a REPY_IteratorHelper object's current Python object. | |
Method functions to operate on REPY_IteratorHelper objects.
| REPY_Handle REPY_IteratorHelper_BorrowCurrent | ( | REPY_IteratorHelper * | helper | ) |
Gets the REPY_Handle for a REPY_IteratorHelper object's current Python object.
The term Borrow is used because the lifetime of the returned REPY_Handle is managed by the REPY_IteratorHelper itself, and therefore you should not release it manually.
If you need to access this object outside of the current iteration step, use REPY_CopyHandle.
| helper | The REPY_teratorHelper to get the REPY_Handle from. |
| REPY_IteratorHelper * REPY_IteratorHelper_Create | ( | REPY_Handle | py_object, |
| REPY_Handle | py_scope_nullable, | ||
| const char * | var_name, | ||
| REPY_bool | auto_destroy ) |
Create a REPY_IteratorHelper object on the heap.
Used by the REPY_FOREACH and REPY_FN_FOREACH_CACHE macros.
| py_object | a REPY_Handle for the Python object to iterate through. |
| py_scope_nullable | a REPY_Handle to a Python dict being used a local scope. Can be REPY_NO_OBJECT. |
| var_name | the variable name for the REPY_IteratorHelper pointer. If py_scope_nullable is set to REPY_NO_OBJECT, use NULL. |
| auto_destroy | If true, the REPY_IteratorHelper will automatically be destroyed once the loop ends. |
| void REPY_IteratorHelper_Destroy | ( | REPY_IteratorHelper * | helper | ) |
Destructs a REPY_IteratorHelper object from the heap.
Used by the various cleanup macros for REPY_FOREACH and REPY_FN_FOREACH_CACHE.
REPY_IteratorHelper_Update can also destroy a REPY_IteratorHelper when it's finished, if auto_destroy is set to true.
| helper | A pointer to the REPY_IteratorHelper to destroy. |
| REPY_u32 REPY_IteratorHelper_GetIndex | ( | REPY_IteratorHelper * | helper | ) |
Gets the current index of a REPY_IteratorHelper object.
An index value isn't something intrinsic to Pythonic for loops. Instead, the REPY_IteratorHelper internally counts what index value the iterator is on.
| helper | The REPY_IteratorHelper to get the index from. |
| REPY_bool REPY_IteratorHelper_Update | ( | REPY_IteratorHelper * | helper | ) |
Makes the REPY_IteratorHelper move on to the next object in the iteration.
Used by the REPY_FOREACH and REPY_FN_FOREACH_CACHE macros.
| helper | A pointer to the REPY_IteratorHelper to update. |