xref: /aosp_15_r20/external/grpc-grpc/third_party/upb/upb/reflection/internal/field_def.h (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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_REFLECTION_FIELD_DEF_INTERNAL_H_
9 #define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
10 
11 #include "upb/reflection/field_def.h"
12 
13 // Must be last.
14 #include "upb/port/def.inc"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
21 
22 bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
23 bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
24 int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
25 uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
26 void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
27                            upb_FieldDef* f);
28 void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
29                                            const upb_FieldDef* f);
30 
31 // Allocate and initialize an array of |n| extensions (field defs).
32 upb_FieldDef* _upb_Extensions_New(upb_DefBuilder* ctx, int n,
33                                   const UPB_DESC(FieldDescriptorProto*)
34                                       const* protos,
35                                   const UPB_DESC(FeatureSet*) parent_features,
36                                   const char* prefix, upb_MessageDef* m);
37 
38 // Allocate and initialize an array of |n| field defs.
39 upb_FieldDef* _upb_FieldDefs_New(upb_DefBuilder* ctx, int n,
40                                  const UPB_DESC(FieldDescriptorProto*)
41                                      const* protos,
42                                  const UPB_DESC(FeatureSet*) parent_features,
43                                  const char* prefix, upb_MessageDef* m,
44                                  bool* is_sorted);
45 
46 // Allocate and return a list of pointers to the |n| field defs in |ff|,
47 // sorted by field number.
48 const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
49                                            upb_Arena* a);
50 
51 #ifdef __cplusplus
52 } /* extern "C" */
53 #endif
54 
55 #include "upb/port/undef.inc"
56 
57 #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
58