Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:31:56

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2023 Google LLC.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 #ifndef UPB_JSON_DECODE_H_
0009 #define UPB_JSON_DECODE_H_
0010 
0011 #include <stddef.h>
0012 
0013 #include "upb/base/status.h"
0014 #include "upb/mem/arena.h"
0015 #include "upb/message/message.h"
0016 #include "upb/reflection/def.h"
0017 
0018 // Must be last.
0019 #include "upb/port/def.inc"
0020 
0021 #ifdef __cplusplus
0022 extern "C" {
0023 #endif
0024 
0025 enum { upb_JsonDecode_IgnoreUnknown = 1 };
0026 
0027 enum {
0028   kUpb_JsonDecodeResult_Ok = 0,
0029   kUpb_JsonDecodeResult_Error = 2,
0030 };
0031 
0032 UPB_API int upb_JsonDecodeDetectingNonconformance(const char* buf, size_t size,
0033                                                   upb_Message* msg,
0034                                                   const upb_MessageDef* m,
0035                                                   const upb_DefPool* symtab,
0036                                                   int options, upb_Arena* arena,
0037                                                   upb_Status* status);
0038 
0039 UPB_API_INLINE bool upb_JsonDecode(const char* buf, size_t size,
0040                                    upb_Message* msg, const upb_MessageDef* m,
0041                                    const upb_DefPool* symtab, int options,
0042                                    upb_Arena* arena, upb_Status* status) {
0043   return upb_JsonDecodeDetectingNonconformance(buf, size, msg, m, symtab,
0044                                                options, arena, status) ==
0045          kUpb_JsonDecodeResult_Ok;
0046 }
0047 
0048 #ifdef __cplusplus
0049 } /* extern "C" */
0050 #endif
0051 
0052 #include "upb/port/undef.inc"
0053 
0054 #endif /* UPB_JSONDECODE_H_ */