Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:25:23

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 // Users should include array.h or map.h instead.
0009 // IWYU pragma: private, include "upb/message/array.h"
0010 
0011 #ifndef UPB_MESSAGE_VALUE_H_
0012 #define UPB_MESSAGE_VALUE_H_
0013 
0014 #include <stdint.h>
0015 #include <string.h>
0016 
0017 #include "upb/base/string_view.h"
0018 
0019 // Must be last.
0020 #include "upb/port/def.inc"
0021 
0022 #ifdef __cplusplus
0023 extern "C" {
0024 #endif
0025 
0026 typedef union {
0027   bool bool_val;
0028   float float_val;
0029   double double_val;
0030   int32_t int32_val;
0031   int64_t int64_val;
0032   uint32_t uint32_val;
0033   uint64_t uint64_val;
0034   const struct upb_Array* array_val;
0035   const struct upb_Map* map_val;
0036   const struct upb_Message* msg_val;
0037   upb_StringView str_val;
0038 
0039   // EXPERIMENTAL: A tagged upb_Message*.  Users must use this instead of
0040   // msg_val if unlinked sub-messages may possibly be in use.  See the
0041   // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
0042   // information.
0043   uintptr_t tagged_msg_val;  // upb_TaggedMessagePtr
0044 } upb_MessageValue;
0045 
0046 UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) {
0047   upb_MessageValue zero;
0048   memset(&zero, 0, sizeof(zero));
0049   return zero;
0050 }
0051 
0052 typedef union {
0053   struct upb_Array* array;
0054   struct upb_Map* map;
0055   struct upb_Message* msg;
0056 } upb_MutableMessageValue;
0057 
0058 UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) {
0059   upb_MutableMessageValue zero;
0060   memset(&zero, 0, sizeof(zero));
0061   return zero;
0062 }
0063 
0064 #ifdef __cplusplus
0065 } /* extern "C" */
0066 #endif
0067 
0068 #include "upb/port/undef.inc"
0069 
0070 #endif /* UPB_MESSAGE_VALUE_H_ */