• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 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_H_
9 #define UPB_TEXT_ENCODE_H_
10 
11 #include "upb/reflection/def.h"
12 #include "upb/text/options.h"  // IWYU pragma: export
13 
14 // Must be last.
15 #include "upb/port/def.inc"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* Encodes the given |msg| to text format.  The message's reflection is given in
22  * |m|.  The symtab in |symtab| is used to find extensions (if NULL, extensions
23  * will not be printed).
24  *
25  * Output is placed in the given buffer, and always NULL-terminated.  The output
26  * size (excluding NULL) is returned.  This means that a return value >= |size|
27  * implies that the output was truncated.  (These are the same semantics as
28  * snprintf()). */
29 size_t upb_TextEncode(const upb_Message* msg, const upb_MessageDef* m,
30                       const upb_DefPool* ext_pool, int options, char* buf,
31                       size_t size);
32 
33 #ifdef __cplusplus
34 } /* extern "C" */
35 #endif
36 
37 #include "upb/port/undef.inc"
38 
39 #endif /* UPB_TEXT_ENCODE_H_ */
40