1 /* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
2 * These functions are rarely needed by applications directly.
14 /* Iterator for pb_field_t list */
16 const pb_field_t *start; /* Start of the pb_field_t array */
17 const pb_field_t *pos; /* Current position of the iterator */
18 unsigned required_field_index; /* Zero-based index that counts only the required fields */
19 void *dest_struct; /* Pointer to the destination structure to decode to */
20 void *pData; /* Pointer where to store current field value */
21 void *pSize; /* Pointer where to store the size of current array field */
24 /* Initialize the field iterator structure to beginning. */
25 void pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct);
27 /* Advance the iterator to the next field.
28 * Returns false when the iterator wraps back to the first field. */
29 bool pb_field_iter_next(pb_field_iter_t *iter);
31 /* Advance the iterator until it points at a field with the given tag.
32 * Returns false if no such field exists. */
33 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);