added iOS source code
[wl-app.git] / iOS / Pods / nanopb / pb_common.h
1 /* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
2  * These functions are rarely needed by applications directly.
3  */
4
5 #ifndef PB_COMMON_H_INCLUDED
6 #define PB_COMMON_H_INCLUDED
7
8 #include "pb.h"
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 /* Iterator for pb_field_t list */
15 struct pb_field_iter_s {
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 */
22 };
23 typedef struct pb_field_iter_s pb_field_iter_t;
24
25 /* Initialize the field iterator structure to beginning.
26  * Returns false if the message type is empty. */
27 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct);
28
29 /* Advance the iterator to the next field.
30  * Returns false when the iterator wraps back to the first field. */
31 bool pb_field_iter_next(pb_field_iter_t *iter);
32
33 /* Advance the iterator until it points at a field with the given tag.
34  * Returns false if no such field exists. */
35 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
36
37 #ifdef __cplusplus
38 } /* extern "C" */
39 #endif
40
41 #endif
42