• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // IWYU pragma: private, include "upb/reflection/def.h"
9 
10 #ifndef UPB_REFLECTION_DEF_POOL_H_
11 #define UPB_REFLECTION_DEF_POOL_H_
12 
13 #include "upb/base/status.h"
14 #include "upb/base/string_view.h"
15 #include "upb/reflection/common.h"
16 #include "upb/reflection/def_type.h"
17 
18 // Must be last.
19 #include "upb/port/def.inc"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 UPB_API void upb_DefPool_Free(upb_DefPool* s);
26 
27 UPB_API upb_DefPool* upb_DefPool_New(void);
28 
29 UPB_API const UPB_DESC(FeatureSetDefaults) *
30     upb_DefPool_FeatureSetDefaults(const upb_DefPool* s);
31 
32 UPB_API bool upb_DefPool_SetFeatureSetDefaults(upb_DefPool* s,
33                                                const char* serialized_defaults,
34                                                size_t serialized_len,
35                                                upb_Status* status);
36 
37 UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
38     const upb_DefPool* s, const char* sym);
39 
40 const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
41     const upb_DefPool* s, const char* sym, size_t len);
42 
43 UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
44                                                       const char* sym);
45 
46 const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
47                                                       const char* sym);
48 
49 const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
50                                               const char* name);
51 
52 const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
53                                                       const char* name,
54                                                       size_t len);
55 
56 const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
57     const upb_DefPool* s, const upb_MiniTableExtension* ext);
58 
59 UPB_API const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
60                                                     const char* sym);
61 
62 const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
63     const upb_DefPool* s, const char* name, size_t size);
64 
65 const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
66                                                       const upb_MessageDef* m,
67                                                       int32_t fieldnum);
68 
69 UPB_API const upb_ServiceDef* upb_DefPool_FindServiceByName(
70   const upb_DefPool* s, const char* name);
71 
72 const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
73     const upb_DefPool* s, const char* name, size_t size);
74 
75 const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
76                                                         const char* name);
77 
78 UPB_API const upb_FileDef* upb_DefPool_AddFile(
79     upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
80     upb_Status* status);
81 
82 UPB_API const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
83     const upb_DefPool* s);
84 
85 const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
86                                                   const upb_MessageDef* m,
87                                                   size_t* count);
88 
89 #ifdef __cplusplus
90 } /* extern "C" */
91 #endif
92 
93 #include "upb/port/undef.inc"
94 
95 #endif /* UPB_REFLECTION_DEF_POOL_H_ */
96