Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/upb/mini_table/message.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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_MINI_TABLE_MESSAGE_H_
0009 #define UPB_MINI_TABLE_MESSAGE_H_
0010 
0011 #include <stdint.h>
0012 
0013 #include "upb/mini_table/enum.h"
0014 #include "upb/mini_table/field.h"
0015 #include "upb/mini_table/internal/message.h"
0016 
0017 // Must be last.
0018 #include "upb/port/def.inc"
0019 
0020 typedef struct upb_MiniTable upb_MiniTable;
0021 
0022 #ifdef __cplusplus
0023 extern "C" {
0024 #endif
0025 
0026 UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
0027     const upb_MiniTable* m, uint32_t number);
0028 
0029 UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
0030     const upb_MiniTable* m, uint32_t index);
0031 
0032 UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m);
0033 
0034 UPB_API_INLINE bool upb_MiniTable_IsMessageSet(const upb_MiniTable* m);
0035 
0036 // DEPRECATED: use upb_MiniTable_SubMessage() instead
0037 // Returns the MiniTable for a message field, NULL if the field is unlinked.
0038 UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
0039     const upb_MiniTable* m, const upb_MiniTableField* f);
0040 
0041 // Returns the MiniTable for a message field if it is a submessage, otherwise
0042 // returns NULL.
0043 //
0044 // WARNING: if dynamic tree shaking is in use, the return value may be the
0045 // "empty", zero-field placeholder message instead of the real message type.
0046 // If the message is later linked, this function will begin returning the real
0047 // message type.
0048 UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
0049     const upb_MiniTable* m, const upb_MiniTableField* f);
0050 
0051 // Returns the MiniTable for a map field.  The given field must refer to a map.
0052 UPB_API_INLINE const upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
0053     const upb_MiniTable* m, const upb_MiniTableField* f);
0054 
0055 // Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
0056 UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
0057     const upb_MiniTable* m, const upb_MiniTableField* f);
0058 
0059 // Returns the MiniTableField for the key of a map.
0060 UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapKey(
0061     const upb_MiniTable* m);
0062 
0063 // Returns the MiniTableField for the value of a map.
0064 UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapValue(
0065     const upb_MiniTable* m);
0066 
0067 // Returns true if this MiniTable field is linked to a MiniTable for the
0068 // sub-message.
0069 UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(const upb_MiniTable* m,
0070                                                 const upb_MiniTableField* f);
0071 
0072 // If this field is in a oneof, returns the first field in the oneof.
0073 //
0074 // Otherwise returns NULL.
0075 //
0076 // Usage:
0077 //   const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
0078 //   do {
0079 //       ..
0080 //   } while (upb_MiniTable_NextOneofField(m, &field);
0081 //
0082 const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
0083                                                  const upb_MiniTableField* f);
0084 
0085 // Iterates to the next field in the oneof. If this is the last field in the
0086 // oneof, returns false. The ordering of fields in the oneof is not
0087 // guaranteed.
0088 // REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
0089 //           by prior upb_MiniTable_NextOneofField calls.
0090 bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
0091                                   const upb_MiniTableField** f);
0092 
0093 #ifdef __cplusplus
0094 } /* extern "C" */
0095 #endif
0096 
0097 #include "upb/port/undef.inc"
0098 
0099 #endif /* UPB_MINI_TABLE_MESSAGE_H_ */