def.hpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2021, Google LLC
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of Google LLC nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT,
19 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef UPB_DEF_HPP_
27 #define UPB_DEF_HPP_
28 
29 #include <cstring>
30 #include <memory>
31 #include <string>
32 #include <vector>
33 
34 #include "upb/def.h"
35 #include "upb/reflection.h"
36 #include "upb/upb.hpp"
37 
38 namespace upb {
39 
41 
42 class EnumDefPtr;
43 class FileDefPtr;
44 class MessageDefPtr;
45 class OneofDefPtr;
46 
47 // A upb::FieldDefPtr describes a single field in a message. It is most often
48 // found as a part of a upb_MessageDef, but can also stand alone to represent
49 // an extension.
50 class FieldDefPtr {
51  public:
52  FieldDefPtr() : ptr_(nullptr) {}
53  explicit FieldDefPtr(const upb_FieldDef* ptr) : ptr_(ptr) {}
54 
55  const upb_FieldDef* ptr() const { return ptr_; }
56  explicit operator bool() const { return ptr_ != nullptr; }
57 
58  typedef upb_CType Type;
59  typedef upb_Label Label;
61 
62  const char* full_name() const { return upb_FieldDef_FullName(ptr_); }
63 
64  Type type() const { return upb_FieldDef_CType(ptr_); }
65  Label label() const { return upb_FieldDef_Label(ptr_); }
66  const char* name() const { return upb_FieldDef_Name(ptr_); }
67  const char* json_name() const { return upb_FieldDef_JsonName(ptr_); }
68  uint32_t number() const { return upb_FieldDef_Number(ptr_); }
69  bool is_extension() const { return upb_FieldDef_IsExtension(ptr_); }
70 
71  // For non-string, non-submessage fields, this indicates whether binary
72  // protobufs are encoded in packed or non-packed format.
73  //
74  // Note: this accessor reflects the fact that "packed" has different defaults
75  // depending on whether the proto is proto2 or proto3.
76  bool packed() const { return upb_FieldDef_IsPacked(ptr_); }
77 
78  // An integer that can be used as an index into an array of fields for
79  // whatever message this field belongs to. Guaranteed to be less than
80  // f->containing_type()->field_count(). May only be accessed once the def has
81  // been finalized.
82  uint32_t index() const { return upb_FieldDef_Index(ptr_); }
83 
84  // The MessageDef to which this field belongs.
85  //
86  // If this field has been added to a MessageDef, that message can be retrieved
87  // directly (this is always the case for frozen FieldDefs).
88  //
89  // If the field has not yet been added to a MessageDef, you can set the name
90  // of the containing type symbolically instead. This is mostly useful for
91  // extensions, where the extension is declared separately from the message.
93 
94  // The OneofDef to which this field belongs, or NULL if this field is not part
95  // of a oneof.
97 
98  // The field's type according to the enum in descriptor.proto. This is not
99  // the same as UPB_TYPE_*, because it distinguishes between (for example)
100  // INT32 and SINT32, whereas our "type" enum does not. This return of
101  // descriptor_type() is a function of type(), integer_format(), and
102  // is_tag_delimited().
104 
105  // Convenient field type tests.
106  bool IsSubMessage() const { return upb_FieldDef_IsSubMessage(ptr_); }
107  bool IsString() const { return upb_FieldDef_IsString(ptr_); }
108  bool IsSequence() const { return upb_FieldDef_IsRepeated(ptr_); }
109  bool IsPrimitive() const { return upb_FieldDef_IsPrimitive(ptr_); }
110  bool IsMap() const { return upb_FieldDef_IsMap(ptr_); }
111 
113 
114  // Returns the enum or submessage def for this field, if any. The field's
115  // type must match (ie. you may only call enum_subdef() for fields where
116  // type() == kUpb_CType_Enum).
117  EnumDefPtr enum_subdef() const;
119 
120  private:
122 };
123 
124 // Class that represents a oneof.
125 class OneofDefPtr {
126  public:
127  OneofDefPtr() : ptr_(nullptr) {}
128  explicit OneofDefPtr(const upb_OneofDef* ptr) : ptr_(ptr) {}
129 
130  const upb_OneofDef* ptr() const { return ptr_; }
131  explicit operator bool() const { return ptr_ != nullptr; }
132 
133  // Returns the MessageDef that contains this OneofDef.
135 
136  // Returns the name of this oneof.
137  const char* name() const { return upb_OneofDef_Name(ptr_); }
138 
139  // Returns the number of fields in the oneof.
140  int field_count() const { return upb_OneofDef_FieldCount(ptr_); }
141  FieldDefPtr field(int i) const {
143  }
144 
145  // Looks up by name.
146  FieldDefPtr FindFieldByName(const char* name, size_t len) const {
148  }
149  FieldDefPtr FindFieldByName(const char* name) const {
151  }
152 
153  template <class T>
155  return FindFieldByName(str.c_str(), str.size());
156  }
157 
158  // Looks up by tag number.
161  }
162 
163  private:
165 };
166 
167 // Structure that describes a single .proto message type.
169  public:
170  MessageDefPtr() : ptr_(nullptr) {}
171  explicit MessageDefPtr(const upb_MessageDef* ptr) : ptr_(ptr) {}
172 
173  const upb_MessageDef* ptr() const { return ptr_; }
174  explicit operator bool() const { return ptr_ != nullptr; }
175 
176  FileDefPtr file() const;
177 
178  const char* full_name() const { return upb_MessageDef_FullName(ptr_); }
179  const char* name() const { return upb_MessageDef_Name(ptr_); }
180 
181  // The number of fields that belong to the MessageDef.
182  int field_count() const { return upb_MessageDef_FieldCount(ptr_); }
183  FieldDefPtr field(int i) const {
185  }
186 
187  // The number of oneofs that belong to the MessageDef.
188  int oneof_count() const { return upb_MessageDef_OneofCount(ptr_); }
189  OneofDefPtr oneof(int i) const {
191  }
192 
194 
195  // These return null pointers if the field is not found.
198  }
199  FieldDefPtr FindFieldByName(const char* name, size_t len) const {
201  }
202  FieldDefPtr FindFieldByName(const char* name) const {
204  }
205 
206  template <class T>
208  return FindFieldByName(str.c_str(), str.size());
209  }
210 
211  OneofDefPtr FindOneofByName(const char* name, size_t len) const {
213  }
214 
215  OneofDefPtr FindOneofByName(const char* name) const {
217  }
218 
219  template <class T>
221  return FindOneofByName(str.c_str(), str.size());
222  }
223 
224  // Is this message a map entry?
225  bool mapentry() const { return upb_MessageDef_IsMapEntry(ptr_); }
226 
227  // Return the type of well known type message. kUpb_WellKnown_Unspecified for
228  // non-well-known message.
231  }
232 
233  private:
234  class FieldIter {
235  public:
236  explicit FieldIter(const upb_MessageDef* m, int i) : m_(m), i_(i) {}
237  void operator++() { i_++; }
238 
241  }
242  bool operator!=(const FieldIter& other) { return i_ != other.i_; }
243  bool operator==(const FieldIter& other) { return i_ == other.i_; }
244 
245  private:
247  int i_;
248  };
249 
251  public:
252  explicit FieldAccessor(const upb_MessageDef* md) : md_(md) {}
253  FieldIter begin() { return FieldIter(md_, 0); }
255 
256  private:
258  };
259 
260  class OneofIter {
261  public:
262  explicit OneofIter(const upb_MessageDef* m, int i) : m_(m), i_(i) {}
263  void operator++() { i_++; }
264 
267  }
268  bool operator!=(const OneofIter& other) { return i_ != other.i_; }
269  bool operator==(const OneofIter& other) { return i_ == other.i_; }
270 
271  private:
273  int i_;
274  };
275 
277  public:
278  explicit OneofAccessor(const upb_MessageDef* md) : md_(md) {}
279  OneofIter begin() { return OneofIter(md_, 0); }
281 
282  private:
284  };
285 
286  public:
287  FieldAccessor fields() const { return FieldAccessor(ptr()); }
288  OneofAccessor oneofs() const { return OneofAccessor(ptr()); }
289 
290  private:
292 };
293 
295  public:
296  EnumValDefPtr() : ptr_(nullptr) {}
297  explicit EnumValDefPtr(const upb_EnumValueDef* ptr) : ptr_(ptr) {}
298 
300  const char* full_name() const { return upb_EnumValueDef_FullName(ptr_); }
301  const char* name() const { return upb_EnumValueDef_Name(ptr_); }
302 
303  private:
305 };
306 
307 class EnumDefPtr {
308  public:
309  EnumDefPtr() : ptr_(nullptr) {}
310  explicit EnumDefPtr(const upb_EnumDef* ptr) : ptr_(ptr) {}
311 
312  const upb_EnumDef* ptr() const { return ptr_; }
313  explicit operator bool() const { return ptr_ != nullptr; }
314 
315  const char* full_name() const { return upb_EnumDef_FullName(ptr_); }
316  const char* name() const { return upb_EnumDef_Name(ptr_); }
317 
318  // The value that is used as the default when no field default is specified.
319  // If not set explicitly, the first value that was added will be used.
320  // The default value must be a member of the enum.
321  // Requires that value_count() > 0.
323 
324  // Returns the number of values currently defined in the enum. Note that
325  // multiple names can refer to the same number, so this may be greater than
326  // the total number of unique numbers.
327  int value_count() const { return upb_EnumDef_ValueCount(ptr_); }
328 
329  // Lookups from name to integer, returning true if found.
330  EnumValDefPtr FindValueByName(const char* name) const {
332  }
333 
334  // Finds the name corresponding to the given number, or NULL if none was
335  // found. If more than one name corresponds to this number, returns the
336  // first one that was added.
339  }
340 
341  private:
343 };
344 
345 // Class that represents a .proto file with some things defined in it.
346 //
347 // Many users won't care about FileDefs, but they are necessary if you want to
348 // read the values of file-level options.
349 class FileDefPtr {
350  public:
351  explicit FileDefPtr(const upb_FileDef* ptr) : ptr_(ptr) {}
352 
353  const upb_FileDef* ptr() const { return ptr_; }
354  explicit operator bool() const { return ptr_ != nullptr; }
355 
356  // Get/set name of the file (eg. "foo/bar.proto").
357  const char* name() const { return upb_FileDef_Name(ptr_); }
358 
359  // Package name for definitions inside the file (eg. "foo.bar").
360  const char* package() const { return upb_FileDef_Package(ptr_); }
361 
362  // Syntax for the file. Defaults to proto2.
364 
365  // Get the list of dependencies from the file. These are returned in the
366  // order that they were added to the FileDefPtr.
368  const FileDefPtr dependency(int index) const {
370  }
371 
372  private:
374 };
375 
376 // Non-const methods in upb::SymbolTable are NOT thread-safe.
377 class SymbolTable {
378  public:
381 
382  const upb_DefPool* ptr() const { return ptr_.get(); }
383  upb_DefPool* ptr() { return ptr_.get(); }
384 
385  // Finds an entry in the symbol table with this exact name. If not found,
386  // returns NULL.
387  MessageDefPtr FindMessageByName(const char* sym) const {
389  }
390 
391  EnumDefPtr FindEnumByName(const char* sym) const {
392  return EnumDefPtr(upb_DefPool_FindEnumByName(ptr_.get(), sym));
393  }
394 
395  FileDefPtr FindFileByName(const char* name) const {
397  }
398 
399  // TODO: iteration?
400 
401  // Adds the given serialized FileDescriptorProto to the pool.
403  Status* status) {
404  return FileDefPtr(
405  upb_DefPool_AddFile(ptr_.get(), file_proto, status->ptr()));
406  }
407 
408  private:
409  std::unique_ptr<upb_DefPool, decltype(&upb_DefPool_Free)> ptr_;
410 };
411 
414 }
415 
418 }
419 
422 }
423 
426 }
427 
430 }
431 
434 }
435 
436 } // namespace upb
437 
438 #endif // UPB_DEF_HPP_
upb_FieldDef_IsPrimitive
bool upb_FieldDef_IsPrimitive(const upb_FieldDef *f)
Definition: upb/upb/def.c:655
upb::EnumDefPtr::ptr_
const upb_EnumDef * ptr_
Definition: def.hpp:342
upb_OneofDef_Name
const char * upb_OneofDef_Name(const upb_OneofDef *o)
Definition: upb/upb/def.c:870
xds_interop_client.str
str
Definition: xds_interop_client.py:487
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
upb_MessageDef_FindOneofByNameWithSize
const upb_OneofDef * upb_MessageDef_FindOneofByNameWithSize(const upb_MessageDef *m, const char *name, size_t len)
Definition: upb/upb/def.c:739
upb_FieldDef_Type
upb_FieldType upb_FieldDef_Type(const upb_FieldDef *f)
Definition: upb/upb/def.c:535
upb_FieldDef_Number
uint32_t upb_FieldDef_Number(const upb_FieldDef *f)
Definition: upb/upb/def.c:541
upb::FileDefPtr::name
const char * name() const
Definition: def.hpp:357
upb::MessageDefPtr::field_count
int field_count() const
Definition: def.hpp:182
upb_FieldDef_IsPacked
bool upb_FieldDef_IsPacked(const upb_FieldDef *f)
Definition: upb/upb/def.c:547
upb::OneofDefPtr::FindFieldByName
FieldDefPtr FindFieldByName(const char *name) const
Definition: def.hpp:149
upb::MessageDefPtr::name
const char * name() const
Definition: def.hpp:179
upb_FieldType
upb_FieldType
Definition: upb/upb/upb.h:308
upb::MessageDefPtr::FieldIter::operator++
void operator++()
Definition: def.hpp:237
upb::FieldDefPtr::IsSequence
bool IsSequence() const
Definition: def.hpp:108
upb::OneofDefPtr::OneofDefPtr
OneofDefPtr(const upb_OneofDef *ptr)
Definition: def.hpp:128
upb::FieldDefPtr::packed
bool packed() const
Definition: def.hpp:76
upb::MessageDefPtr::FieldIter::operator*
FieldDefPtr operator*()
Definition: def.hpp:239
upb::EnumDefPtr::EnumDefPtr
EnumDefPtr()
Definition: def.hpp:309
upb_CType
upb_CType
Definition: upb/upb/upb.h:286
upb::SymbolTable
Definition: def.hpp:377
upb::MessageDefPtr
Definition: def.hpp:168
upb_DefPool_FindEnumByName
const upb_EnumDef * upb_DefPool_FindEnumByName(const upb_DefPool *s, const char *sym)
Definition: upb/upb/def.c:1135
upb::OneofDefPtr::FindFieldByName
FieldDefPtr FindFieldByName(const char *name, size_t len) const
Definition: def.hpp:146
upb::MessageDefPtr::FindOneofByName
OneofDefPtr FindOneofByName(const T &str) const
Definition: def.hpp:220
upb::MessageDefPtr::FieldIter::operator!=
bool operator!=(const FieldIter &other)
Definition: def.hpp:242
bool
bool
Definition: setup_once.h:312
upb::MessageDefPtr::OneofIter::operator*
OneofDefPtr operator*()
Definition: def.hpp:265
upb::EnumValDefPtr::EnumValDefPtr
EnumValDefPtr(const upb_EnumValueDef *ptr)
Definition: def.hpp:297
upb::FileDefPtr::ptr
const upb_FileDef * ptr() const
Definition: def.hpp:353
upb_FileDef_Package
const char * upb_FileDef_Package(const upb_FileDef *f)
Definition: upb/upb/def.c:922
upb::MessageDefPtr::OneofIter::operator!=
bool operator!=(const OneofIter &other)
Definition: def.hpp:268
upb::FieldDefPtr::descriptor_type
DescriptorType descriptor_type() const
Definition: def.hpp:103
upb::OneofDefPtr::ptr
const upb_OneofDef * ptr() const
Definition: def.hpp:130
upb::MessageDefPtr::OneofIter::i_
int i_
Definition: def.hpp:273
upb_MessageDef_Syntax
upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef *m)
Definition: upb/upb/def.c:717
upb::OneofDefPtr::name
const char * name() const
Definition: def.hpp:137
upb::MessageDefPtr::FieldAccessor::md_
const upb_MessageDef * md_
Definition: def.hpp:257
upb_OneofDef_LookupNumber
const upb_FieldDef * upb_OneofDef_LookupNumber(const upb_OneofDef *o, uint32_t num)
Definition: upb/upb/def.c:903
upb_EnumValueDef_Name
const char * upb_EnumValueDef_Name(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:454
upb_MessageDef
Definition: upb/upb/def.c:100
upb::EnumDefPtr::default_value
int32_t default_value() const
Definition: def.hpp:322
upb_FileDef_Dependency
const upb_FileDef * upb_FileDef_Dependency(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:958
upb::MessageDefPtr::ptr
const upb_MessageDef * ptr() const
Definition: def.hpp:173
upb::OneofDefPtr::OneofDefPtr
OneofDefPtr()
Definition: def.hpp:127
upb::MessageDefPtr::FieldIter::FieldIter
FieldIter(const upb_MessageDef *m, int i)
Definition: def.hpp:236
upb::MessageDefPtr::FindFieldByName
FieldDefPtr FindFieldByName(const T &str) const
Definition: def.hpp:207
upb::FieldDefPtr::FieldDefPtr
FieldDefPtr(const upb_FieldDef *ptr)
Definition: def.hpp:53
upb::FieldDefPtr
Definition: def.hpp:50
upb::SymbolTable::AddFile
FileDefPtr AddFile(const google_protobuf_FileDescriptorProto *file_proto, Status *status)
Definition: def.hpp:402
upb::MessageDefPtr::OneofAccessor::end
OneofIter end()
Definition: def.hpp:280
upb::MessageDefPtr::OneofIter
Definition: def.hpp:260
upb_OneofDef_ContainingType
const upb_MessageDef * upb_OneofDef_ContainingType(const upb_OneofDef *o)
Definition: upb/upb/def.c:874
status
absl::Status status
Definition: rls.cc:251
upb::FieldDefPtr::label
Label label() const
Definition: def.hpp:65
upb::MessageDefPtr::FieldIter
Definition: def.hpp:234
setup.name
name
Definition: setup.py:542
upb_OneofDef
Definition: upb/upb/def.c:157
upb::FieldDefPtr::enum_subdef
EnumDefPtr enum_subdef() const
Definition: def.hpp:432
upb::EnumDefPtr::value_count
int value_count() const
Definition: def.hpp:327
upb::SymbolTable::FindEnumByName
EnumDefPtr FindEnumByName(const char *sym) const
Definition: def.hpp:391
upb::FieldDefPtr::DescriptorType
upb_FieldType DescriptorType
Definition: def.hpp:60
upb::EnumDefPtr
Definition: def.hpp:307
upb::FieldDefPtr::containing_oneof
OneofDefPtr containing_oneof() const
Definition: def.hpp:428
upb::MessageDefPtr::FieldAccessor::FieldAccessor
FieldAccessor(const upb_MessageDef *md)
Definition: def.hpp:252
upb::EnumDefPtr::ptr
const upb_EnumDef * ptr() const
Definition: def.hpp:312
upb::FieldDefPtr::containing_type
MessageDefPtr containing_type() const
Definition: def.hpp:420
T
#define T(upbtypeconst, upbtype, ctype, default_value)
upb_WellKnown
upb_WellKnown
Definition: upb/upb/def.h:71
upb::MessageDefPtr::FindFieldByName
FieldDefPtr FindFieldByName(const char *name, size_t len) const
Definition: def.hpp:199
upb_FileDef_Syntax
upb_Syntax upb_FileDef_Syntax(const upb_FileDef *f)
Definition: upb/upb/def.c:924
upb::FileDefPtr::ptr_
const upb_FileDef * ptr_
Definition: def.hpp:373
upb::MessageDefPtr::MessageDefPtr
MessageDefPtr(const upb_MessageDef *ptr)
Definition: def.hpp:171
upb_DefPool
struct upb_DefPool upb_DefPool
Definition: upb/upb/def.h:63
upb_EnumDef_FindValueByNumber
const upb_EnumValueDef * upb_EnumDef_FindValueByNumber(const upb_EnumDef *def, int32_t num)
Definition: upb/upb/def.c:417
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
upb_MessageValue
Definition: upb/upb/reflection.h:40
upb_FieldDef_Index
uint32_t upb_FieldDef_Index(const upb_FieldDef *f)
Definition: upb/upb/def.c:537
upb_FieldDef_Label
upb_Label upb_FieldDef_Label(const upb_FieldDef *f)
Definition: upb/upb/def.c:539
upb::FieldDefPtr::ptr
const upb_FieldDef * ptr() const
Definition: def.hpp:55
upb::FieldDefPtr::number
uint32_t number() const
Definition: def.hpp:68
upb::FieldDefPtr::IsString
bool IsString() const
Definition: def.hpp:107
upb_MessageDef_IsMapEntry
UPB_INLINE bool upb_MessageDef_IsMapEntry(const upb_MessageDef *m)
Definition: upb/upb/def.h:209
upb_MessageDef_WellKnownType
upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef *m)
Definition: upb/upb/def.c:855
upb_MessageDef_Name
const char * upb_MessageDef_Name(const upb_MessageDef *m)
Definition: upb/upb/def.c:713
upb::FieldDefPtr::type
Type type() const
Definition: def.hpp:64
upb_OneofDef_LookupName
const UPB_INLINE upb_FieldDef * upb_OneofDef_LookupName(const upb_OneofDef *o, const char *name)
Definition: upb/upb/def.h:150
upb::MessageDefPtr::OneofIter::operator++
void operator++()
Definition: def.hpp:263
upb_FieldDef_IsMap
bool upb_FieldDef_IsMap(const upb_FieldDef *f)
Definition: upb/upb/def.c:659
upb::FieldDefPtr::ptr_
const upb_FieldDef * ptr_
Definition: def.hpp:121
upb::MessageDefPtr::FieldIter::m_
const upb_MessageDef * m_
Definition: def.hpp:246
Type
Definition: bloaty/third_party/protobuf/src/google/protobuf/type.pb.h:182
upb::FieldDefPtr::json_name
const char * json_name() const
Definition: def.hpp:67
upb::FieldDefPtr::name
const char * name() const
Definition: def.hpp:66
upb::EnumValDefPtr::ptr_
const upb_EnumValueDef * ptr_
Definition: def.hpp:304
upb::MessageDefPtr::field
FieldDefPtr field(int i) const
Definition: def.hpp:183
upb::MessageDefPtr::FindFieldByName
FieldDefPtr FindFieldByName(const char *name) const
Definition: def.hpp:202
upb::OneofDefPtr::field
FieldDefPtr field(int i) const
Definition: def.hpp:141
upb::SymbolTable::ptr_
std::unique_ptr< upb_DefPool, decltype(&upb_DefPool_Free)> ptr_
Definition: def.hpp:409
upb::MessageDefPtr::OneofIter::m_
const upb_MessageDef * m_
Definition: def.hpp:272
upb_OneofDef_FieldCount
int upb_OneofDef_FieldCount(const upb_OneofDef *o)
Definition: upb/upb/def.c:878
upb_DefPool_New
upb_DefPool * upb_DefPool_New(void)
Definition: upb/upb/def.c:1086
upb_EnumValueDef
Definition: upb/upb/def.c:150
upb_EnumDef_FullName
const char * upb_EnumDef_FullName(const upb_EnumDef *e)
Definition: upb/upb/def.c:390
upb::EnumValDefPtr::EnumValDefPtr
EnumValDefPtr()
Definition: def.hpp:296
upb_FieldDef_Default
upb_MessageValue upb_FieldDef_Default(const upb_FieldDef *f)
Definition: upb/upb/def.c:581
upb::MessageDefPtr::FieldAccessor
Definition: def.hpp:250
upb_Syntax
upb_Syntax
Definition: upb/upb/def.h:65
upb::MessageDefPtr::OneofIter::OneofIter
OneofIter(const upb_MessageDef *m, int i)
Definition: def.hpp:262
upb::MessageDefPtr::oneof_count
int oneof_count() const
Definition: def.hpp:188
upb_FieldDef_IsExtension
bool upb_FieldDef_IsExtension(const upb_FieldDef *f)
Definition: upb/upb/def.c:543
reflection.h
upb::FileDefPtr
Definition: def.hpp:349
number
int32_t number
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:850
upb::SymbolTable::ptr
const upb_DefPool * ptr() const
Definition: def.hpp:382
upb_FileDef_Name
const char * upb_FileDef_Name(const upb_FileDef *f)
Definition: upb/upb/def.c:920
upb
Definition: def.hpp:38
upb_MessageDef_FindFieldByName
const UPB_INLINE upb_FieldDef * upb_MessageDef_FindFieldByName(const upb_MessageDef *m, const char *name)
Definition: upb/upb/def.h:204
upb::MessageDefPtr::FindOneofByName
OneofDefPtr FindOneofByName(const char *name, size_t len) const
Definition: def.hpp:211
upb::MessageDefPtr::FieldAccessor::end
FieldIter end()
Definition: def.hpp:254
upb::OneofDefPtr::FindFieldByNumber
FieldDefPtr FindFieldByNumber(uint32_t num) const
Definition: def.hpp:159
upb::MessageDefPtr::ptr_
const upb_MessageDef * ptr_
Definition: def.hpp:291
upb::EnumValDefPtr
Definition: def.hpp:294
upb::MessageDefPtr::FindOneofByName
OneofDefPtr FindOneofByName(const char *name) const
Definition: def.hpp:215
upb::EnumValDefPtr::number
int32_t number() const
Definition: def.hpp:299
upb_FieldDef_CType
upb_CType upb_FieldDef_CType(const upb_FieldDef *f)
Definition: upb/upb/def.c:500
upb_EnumDef_ValueCount
int upb_EnumDef_ValueCount(const upb_EnumDef *e)
Definition: upb/upb/def.c:407
upb::FieldDefPtr::IsPrimitive
bool IsPrimitive() const
Definition: def.hpp:109
upb_MessageDef_Oneof
const upb_OneofDef * upb_MessageDef_Oneof(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:833
upb_FieldDef_MessageSubDef
const upb_MessageDef * upb_FieldDef_MessageSubDef(const upb_FieldDef *f)
Definition: upb/upb/def.c:619
upb::MessageDefPtr::mapentry
bool mapentry() const
Definition: def.hpp:225
upb_FieldDef_EnumSubDef
const upb_EnumDef * upb_FieldDef_EnumSubDef(const upb_FieldDef *f)
Definition: upb/upb/def.c:623
upb::OneofDefPtr::containing_type
MessageDefPtr containing_type() const
Definition: def.hpp:424
upb_FieldDef
Definition: upb/upb/def.c:56
upb::EnumDefPtr::name
const char * name() const
Definition: def.hpp:316
upb_OneofDef_LookupNameWithSize
const upb_FieldDef * upb_OneofDef_LookupNameWithSize(const upb_OneofDef *o, const char *name, size_t length)
Definition: upb/upb/def.c:894
upb_EnumValueDef_FullName
const char * upb_EnumValueDef_FullName(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:450
upb::OneofDefPtr
Definition: def.hpp:125
upb::SymbolTable::SymbolTable
SymbolTable()
Definition: def.hpp:379
upb::FieldDefPtr::Type
upb_CType Type
Definition: def.hpp:58
upb_EnumDef_Default
int32_t upb_EnumDef_Default(const upb_EnumDef *e)
Definition: upb/upb/def.c:402
upb::SymbolTable::SymbolTable
SymbolTable(upb_DefPool *s)
Definition: def.hpp:380
upb::FieldDefPtr::IsMap
bool IsMap() const
Definition: def.hpp:110
benchmark.md
md
Definition: benchmark.py:86
upb_FieldDef_ContainingType
const upb_MessageDef * upb_FieldDef_ContainingType(const upb_FieldDef *f)
Definition: upb/upb/def.c:563
upb::MessageDefPtr::OneofIter::operator==
bool operator==(const OneofIter &other)
Definition: def.hpp:269
upb_DefPool_Free
void upb_DefPool_Free(upb_DefPool *s)
Definition: upb/upb/def.c:1081
upb_FieldDef_JsonName
const char * upb_FieldDef_JsonName(const upb_FieldDef *f)
Definition: upb/upb/def.c:553
upb_MessageDef_FindOneofByName
const UPB_INLINE upb_OneofDef * upb_MessageDef_FindOneofByName(const upb_MessageDef *m, const char *name)
Definition: upb/upb/def.h:199
upb::MessageDefPtr::full_name
const char * full_name() const
Definition: def.hpp:178
upb::FileDefPtr::FileDefPtr
FileDefPtr(const upb_FileDef *ptr)
Definition: def.hpp:351
upb_FileDef
Definition: upb/upb/def.c:171
upb::MessageDefPtr::file
FileDefPtr file() const
Definition: def.hpp:412
upb::FieldDefPtr::default_value
MessageValue default_value() const
Definition: def.hpp:112
upb::MessageDefPtr::MessageDefPtr
MessageDefPtr()
Definition: def.hpp:170
def.h
upb_OneofDef_Field
const upb_FieldDef * upb_OneofDef_Field(const upb_OneofDef *o, int i)
Definition: upb/upb/def.c:880
upb::EnumDefPtr::full_name
const char * full_name() const
Definition: def.hpp:315
upb.hpp
upb::FileDefPtr::package
const char * package() const
Definition: def.hpp:360
upb::EnumValDefPtr::full_name
const char * full_name() const
Definition: def.hpp:300
upb::MessageDefPtr::wellknowntype
upb_WellKnown wellknowntype() const
Definition: def.hpp:229
upb_FieldDef_IsRepeated
bool upb_FieldDef_IsRepeated(const upb_FieldDef *f)
Definition: upb/upb/def.c:651
upb::FieldDefPtr::FieldDefPtr
FieldDefPtr()
Definition: def.hpp:52
upb_EnumDef_Name
const char * upb_EnumDef_Name(const upb_EnumDef *e)
Definition: upb/upb/def.c:392
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
upb::MessageDefPtr::OneofAccessor::md_
const upb_MessageDef * md_
Definition: def.hpp:283
upb_FieldDef_IsString
bool upb_FieldDef_IsString(const upb_FieldDef *f)
Definition: upb/upb/def.c:646
upb::FieldDefPtr::Label
upb_Label Label
Definition: def.hpp:59
upb_MessageDef_OneofCount
int upb_MessageDef_OneofCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:798
upb::MessageDefPtr::FindFieldByNumber
FieldDefPtr FindFieldByNumber(uint32_t number) const
Definition: def.hpp:196
upb::MessageDefPtr::OneofAccessor
Definition: def.hpp:276
upb::FieldDefPtr::IsSubMessage
bool IsSubMessage() const
Definition: def.hpp:106
upb::FileDefPtr::dependency
const FileDefPtr dependency(int index) const
Definition: def.hpp:368
upb::FieldDefPtr::full_name
const char * full_name() const
Definition: def.hpp:62
upb::EnumDefPtr::EnumDefPtr
EnumDefPtr(const upb_EnumDef *ptr)
Definition: def.hpp:310
xds_manager.num
num
Definition: xds_manager.py:56
upb::SymbolTable::FindMessageByName
MessageDefPtr FindMessageByName(const char *sym) const
Definition: def.hpp:387
upb::FileDefPtr::syntax
upb_Syntax syntax() const
Definition: def.hpp:363
upb_MessageDef_FullName
const char * upb_MessageDef_FullName(const upb_MessageDef *m)
Definition: upb/upb/def.c:701
upb_MessageDef_File
const upb_FileDef * upb_MessageDef_File(const upb_MessageDef *m)
Definition: upb/upb/def.c:705
upb::MessageDefPtr::FieldIter::i_
int i_
Definition: def.hpp:247
upb_DefPool_AddFile
const upb_FileDef * upb_DefPool_AddFile(upb_DefPool *s, const google_protobuf_FileDescriptorProto *file_proto, upb_Status *status)
Definition: upb/upb/def.c:3140
upb::SymbolTable::FindFileByName
FileDefPtr FindFileByName(const char *name) const
Definition: def.hpp:395
upb_FieldDef_IsSubMessage
bool upb_FieldDef_IsSubMessage(const upb_FieldDef *f)
Definition: upb/upb/def.c:642
upb::MessageDefPtr::fields
FieldAccessor fields() const
Definition: def.hpp:287
upb_FieldDef_ContainingOneof
const upb_OneofDef * upb_FieldDef_ContainingOneof(const upb_FieldDef *f)
Definition: upb/upb/def.c:571
upb::OneofDefPtr::field_count
int field_count() const
Definition: def.hpp:140
upb_EnumDef
Definition: upb/upb/def.c:134
upb::MessageDefPtr::syntax
upb_Syntax syntax() const
Definition: def.hpp:193
upb::MessageDefPtr::oneof
OneofDefPtr oneof(int i) const
Definition: def.hpp:189
upb_FieldDef_Name
const char * upb_FieldDef_Name(const upb_FieldDef *f)
Definition: upb/upb/def.c:549
upb::FieldDefPtr::is_extension
bool is_extension() const
Definition: def.hpp:69
upb::EnumDefPtr::FindValueByNumber
EnumValDefPtr FindValueByNumber(int32_t num) const
Definition: def.hpp:337
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
upb_Label
upb_Label
Definition: upb/upb/upb.h:301
upb_MessageDef_FieldCount
int upb_MessageDef_FieldCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:794
upb::MessageDefPtr::OneofAccessor::begin
OneofIter begin()
Definition: def.hpp:279
upb::OneofDefPtr::FindFieldByName
FieldDefPtr FindFieldByName(const T &str) const
Definition: def.hpp:154
upb::FieldDefPtr::message_subdef
MessageDefPtr message_subdef() const
Definition: def.hpp:416
upb::EnumDefPtr::FindValueByName
EnumValDefPtr FindValueByName(const char *name) const
Definition: def.hpp:330
upb::MessageValue
upb_MessageValue MessageValue
Definition: def.hpp:40
upb_MessageDef_Field
const upb_FieldDef * upb_MessageDef_Field(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:828
regress.m
m
Definition: regress/regress.py:25
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
upb::Status
Definition: upb.hpp:35
upb::MessageDefPtr::OneofAccessor::OneofAccessor
OneofAccessor(const upb_MessageDef *md)
Definition: def.hpp:278
upb::EnumValDefPtr::name
const char * name() const
Definition: def.hpp:301
upb::MessageDefPtr::FieldAccessor::begin
FieldIter begin()
Definition: def.hpp:253
upb::SymbolTable::ptr
upb_DefPool * ptr()
Definition: def.hpp:383
google_protobuf_FileDescriptorProto
struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto
Definition: descriptor.upb.h:51
upb_DefPool
Definition: upb/upb/def.c:217
upb::FieldDefPtr::index
uint32_t index() const
Definition: def.hpp:82
upb_MessageDef_FindFieldByNumber
const upb_FieldDef * upb_MessageDef_FindFieldByNumber(const upb_MessageDef *m, uint32_t i)
Definition: upb/upb/def.c:721
upb_EnumValueDef_Number
int32_t upb_EnumValueDef_Number(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:458
upb_DefPool_FindMessageByName
const upb_MessageDef * upb_DefPool_FindMessageByName(const upb_DefPool *s, const char *sym)
Definition: upb/upb/def.c:1125
upb_MessageDef_FindFieldByNameWithSize
const upb_FieldDef * upb_MessageDef_FindFieldByNameWithSize(const upb_MessageDef *m, const char *name, size_t len)
Definition: upb/upb/def.c:728
upb::MessageDefPtr::FieldIter::operator==
bool operator==(const FieldIter &other)
Definition: def.hpp:243
upb_FieldDef_FullName
const char * upb_FieldDef_FullName(const upb_FieldDef *f)
Definition: upb/upb/def.c:496
upb::FileDefPtr::dependency_count
int dependency_count() const
Definition: def.hpp:367
upb::OneofDefPtr::ptr_
const upb_OneofDef * ptr_
Definition: def.hpp:164
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
upb_EnumDef_FindValueByName
const UPB_INLINE upb_EnumValueDef * upb_EnumDef_FindValueByName(const upb_EnumDef *e, const char *name)
Definition: upb/upb/def.h:273
upb::MessageDefPtr::oneofs
OneofAccessor oneofs() const
Definition: def.hpp:288
upb_FileDef_DependencyCount
int upb_FileDef_DependencyCount(const upb_FileDef *f)
Definition: upb/upb/def.c:930
upb_DefPool_FindFileByName
const upb_FileDef * upb_DefPool_FindFileByName(const upb_DefPool *s, const char *name)
Definition: upb/upb/def.c:1145


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:03