textencode.h 988 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef UPB_TEXTENCODE_H_
  2. #define UPB_TEXTENCODE_H_
  3. #include "upb/def.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. enum {
  8. /* When set, prints everything on a single line. */
  9. UPB_TXTENC_SINGLELINE = 1,
  10. /* When set, unknown fields are not printed. */
  11. UPB_TXTENC_SKIPUNKNOWN = 2
  12. };
  13. /* Encodes the given |msg| to text format. The message's reflection is given in
  14. * |m|. The symtab in |symtab| is used to find extensions (if NULL, extensions
  15. * will not be printed).
  16. *
  17. * Output is placed in the given buffer, and always NULL-terminated. The output
  18. * size (excluding NULL) is returned. This means that a return value >= |size|
  19. * implies that the output was truncated. (These are the same semantics as
  20. * snprintf()). */
  21. size_t upb_textencode(const upb_msg *msg, const upb_msgdef *m,
  22. const upb_symtab *ext_pool, int options, char *buf,
  23. size_t size);
  24. #ifdef __cplusplus
  25. } /* extern "C" */
  26. #endif
  27. #endif /* UPB_TEXTENCODE_H_ */