pb_common.h 985 B

12345678910111213141516171819202122232425262728293031323334
  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. #ifndef PB_COMMON_H_INCLUDED
  5. #define PB_COMMON_H_INCLUDED
  6. #include "pb.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /* Initialize the field iterator structure to beginning.
  11. * Returns false if the message type is empty. */
  12. bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message);
  13. /* Get a field iterator for extension field. */
  14. bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension);
  15. /* Advance the iterator to the next field.
  16. * Returns false when the iterator wraps back to the first field. */
  17. bool pb_field_iter_next(pb_field_iter_t *iter);
  18. /* Advance the iterator until it points at a field with the given tag.
  19. * Returns false if no such field exists. */
  20. bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
  21. #ifdef __cplusplus
  22. } /* extern "C" */
  23. #endif
  24. #endif