1 /*
2 ** upb_decode: parsing into a upb_msg using a upb_msglayout.
3 */
4 
5 #ifndef UPB_DECODE_H_
6 #define UPB_DECODE_H_
7 
8 #include "upb/msg.h"
9 
10 /* Must be last. */
11 #include "upb/port_def.inc"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 enum {
18   /* If set, strings will alias the input buffer instead of copying into the
19    * arena. */
20   UPB_DECODE_ALIAS = 1,
21 };
22 
23 #define UPB_DECODE_MAXDEPTH(depth) ((depth) << 16)
24 
25 bool _upb_decode(const char *buf, size_t size, upb_msg *msg,
26                  const upb_msglayout *l, upb_arena *arena, int options);
27 
28 UPB_INLINE
upb_decode(const char * buf,size_t size,upb_msg * msg,const upb_msglayout * l,upb_arena * arena)29 bool upb_decode(const char *buf, size_t size, upb_msg *msg,
30                 const upb_msglayout *l, upb_arena *arena) {
31   return _upb_decode(buf, size, msg, l, arena, 0);
32 }
33 
34 #ifdef __cplusplus
35 }  /* extern "C" */
36 #endif
37 
38 #include "upb/port_undef.inc"
39 
40 #endif  /* UPB_DECODE_H_ */
41