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 start of the structure */
20 void *pData; /* Pointer to current field value */
21 void *pSize; /* Pointer to count/has field */
24 /* Initialize the field iterator structure to beginning.
25 * Returns false if the message type is empty. */
26 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct);
28 /* Advance the iterator to the next field.
29 * Returns false when the iterator wraps back to the first field. */
30 bool pb_field_iter_next(pb_field_iter_t *iter);
32 /* Advance the iterator until it points at a field with the given tag.
33 * Returns false if no such field exists. */
34 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);