1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2024 Google LLC. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 #ifndef UPB_TEXT_ENCODE_DEBUG_H_ 9 #define UPB_TEXT_ENCODE_DEBUG_H_ 10 11 #include <stddef.h> 12 13 #include "upb/message/message.h" 14 #include "upb/mini_table/message.h" 15 #include "upb/text/options.h" // IWYU pragma: export 16 17 // Must be last. 18 #include "upb/port/def.inc" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /* Encodes the given |msg| to a pseudo-text format: Instead of printing field 25 * name to value entries, it will print field number to value entries; much like 26 * how unknown fields are printed in upb_TextEncode in this directory's 27 * encode.h. |mt| should correspond to the |msg|'s minitable. 28 * 29 * Output is placed in the given buffer, and always NULL-terminated. The output 30 * size (excluding NULL) iss returned. This means that a return value >= |size| 31 * implies that the output was truncated. (These are the same semantics as 32 * snprintf()). */ 33 UPB_API size_t upb_DebugString(const upb_Message* msg, const upb_MiniTable* mt, 34 int options, char* buf, size_t size); 35 36 #ifdef __cplusplus 37 } /* extern "C" */ 38 #endif 39 40 #include "upb/port/undef.inc" 41 42 #endif /* UPB_TEXT_ENCODE_DEBUG_H_ */ 43