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