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 /* When set, maps are *not* sorted (this avoids allocating tmp mem). */ 19 UPB_TXTENC_NOSORT = 4 20 }; 21 22 /* Encodes the given |msg| to text format. The message's reflection is given in 23 * |m|. The symtab in |symtab| is used to find extensions (if NULL, extensions 24 * will not be printed). 25 * 26 * Output is placed in the given buffer, and always NULL-terminated. The output 27 * size (excluding NULL) is returned. This means that a return value >= |size| 28 * implies that the output was truncated. (These are the same semantics as 29 * snprintf()). */ 30 size_t upb_text_encode(const upb_msg *msg, const upb_msgdef *m, 31 const upb_symtab *ext_pool, int options, char *buf, 32 size_t size); 33 34 #ifdef __cplusplus 35 } /* extern "C" */ 36 #endif 37 38 #endif /* UPB_TEXTENCODE_H_ */ 39