lv_iter.h

Typedefs

typedef lv_result_t (*lv_iter_next_cb)(void *instance, void *context, void *elem)
typedef void (*lv_iter_inspect_cb)(void *elem)

Functions

lv_iter_t *lv_iter_create(void *instance, uint32_t elem_size, uint32_t context_size, lv_iter_next_cb next_cb)

Create an iterator based on an instance, and then the next element of the iterator can be obtained through lv_iter_next, In order to obtain the next operation in a unified and abstract way.

参数:
  • instance -- The instance to be iterated

  • elem_size -- The size of the element to be iterated in bytes

  • context_size -- The size of the context to be passed to the next_cb in bytes

  • next_cb -- The callback function to get the next element

返回:

The iterator object

void *lv_iter_get_context(const lv_iter_t *iter)

Get the context of the iterator. You can use it to store some temporary variables associated with current iterator..

参数:

iter -- lv_iter_t object create before

返回:

the iter context

void lv_iter_destroy(lv_iter_t *iter)

Destroy the iterator object, and release the context. Other resources allocated by the user are not released. The user needs to release it by itself.

参数:

iter -- lv_iter_t object create before

lv_result_t lv_iter_next(lv_iter_t *iter, void *elem)

Get the next element of the iterator.

参数:
  • iter -- lv_iter_t object create before

  • elem -- The pointer to store the next element

返回:

LV_RESULT_OK: Get the next element successfully LV_RESULT_INVALID: The next element is invalid

void lv_iter_make_peekable(lv_iter_t *iter, uint32_t capacity)

Make the iterator peekable, which means that the user can peek the next element without advancing the iterator.

参数:
  • iter -- lv_iter_t object create before

  • capacity -- The capacity of the peek buffer

lv_result_t lv_iter_peek(lv_iter_t *iter, void *elem)

Peek the next element of the iterator without advancing the iterator.

参数:
  • iter -- lv_iter_t object create before

  • elem -- The pointer to store the next element

返回:

LV_RESULT_OK: Peek the next element successfully LV_RESULT_INVALID: The next element is invalid

lv_result_t lv_iter_peek_advance(lv_iter_t *iter)

Only advance the iterator without getting the next element.

参数:

iter -- lv_iter_t object create before

返回:

LV_RESULT_OK: Peek the next element successfully LV_RESULT_INVALID: The next element is invalid

lv_result_t lv_iter_peek_reset(lv_iter_t *iter)

Reset the peek cursor to the next cursor.

参数:

iter -- lv_iter_t object create before

返回:

LV_RESULT_OK: Reset the peek buffer successfully LV_RESULT_INVALID: The peek buffer is invalid

void lv_iter_inspect(lv_iter_t *iter, lv_iter_inspect_cb inspect_cb)

Inspect the element of the iterator. The callback function will be called for each element of the iterator.

参数:
  • iter -- lv_iter_t object create before

  • inspect_cb -- The callback function to inspect the element