protobuf/ruby/ext/google/protobuf_c/defs.c
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2014 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #include <ctype.h>
32 #include <errno.h>
33 #include <ruby/version.h>
34 
35 #include "convert.h"
36 #include "message.h"
37 #include "protobuf.h"
38 
39 // -----------------------------------------------------------------------------
40 // Global map from upb {msg,enum}defs to wrapper Descriptor/EnumDescriptor
41 // instances.
42 // -----------------------------------------------------------------------------
43 
44 static VALUE get_msgdef_obj(VALUE descriptor_pool, const upb_msgdef* def);
45 static VALUE get_enumdef_obj(VALUE descriptor_pool, const upb_enumdef* def);
46 static VALUE get_fielddef_obj(VALUE descriptor_pool, const upb_fielddef* def);
47 static VALUE get_filedef_obj(VALUE descriptor_pool, const upb_filedef* def);
48 static VALUE get_oneofdef_obj(VALUE descriptor_pool, const upb_oneofdef* def);
49 
50 // A distinct object that is not accessible from Ruby. We use this as a
51 // constructor argument to enforce that certain objects cannot be created from
52 // Ruby.
53 VALUE c_only_cookie = Qnil;
54 
55 // -----------------------------------------------------------------------------
56 // Common utilities.
57 // -----------------------------------------------------------------------------
58 
59 static const char* get_str(VALUE str) {
60  Check_Type(str, T_STRING);
61  return RSTRING_PTR(str);
62 }
63 
64 static VALUE rb_str_maybe_null(const char* s) {
65  if (s == NULL) {
66  s = "";
67  }
68  return rb_str_new2(s);
69 }
70 
71 // -----------------------------------------------------------------------------
72 // DescriptorPool.
73 // -----------------------------------------------------------------------------
74 
75 typedef struct {
76  VALUE def_to_descriptor; // Hash table of def* -> Ruby descriptor.
79 
80 VALUE cDescriptorPool = Qnil;
81 
82 // Global singleton DescriptorPool. The user is free to create others, but this
83 // is used by generated code.
84 VALUE generated_pool = Qnil;
85 
86 static void DescriptorPool_mark(void* _self) {
87  DescriptorPool* self = _self;
88  rb_gc_mark(self->def_to_descriptor);
89 }
90 
91 static void DescriptorPool_free(void* _self) {
92  DescriptorPool* self = _self;
93  upb_symtab_free(self->symtab);
94  xfree(self);
95 }
96 
97 static const rb_data_type_t DescriptorPool_type = {
98  "Google::Protobuf::DescriptorPool",
100  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
101 };
102 
105  TypedData_Get_Struct(val, DescriptorPool, &DescriptorPool_type, ret);
106  return ret;
107 }
108 
109 // Exposed to other modules in defs.h.
110 const upb_symtab *DescriptorPool_GetSymtab(VALUE desc_pool_rb) {
111  DescriptorPool *pool = ruby_to_DescriptorPool(desc_pool_rb);
112  return pool->symtab;
113 }
114 
115 /*
116  * call-seq:
117  * DescriptorPool.new => pool
118  *
119  * Creates a new, empty, descriptor pool.
120  */
121 static VALUE DescriptorPool_alloc(VALUE klass) {
123  VALUE ret;
124 
125  self->def_to_descriptor = Qnil;
126  ret = TypedData_Wrap_Struct(klass, &DescriptorPool_type, self);
127 
128  self->def_to_descriptor = rb_hash_new();
129  self->symtab = upb_symtab_new();
130  ObjectCache_Add(self->symtab, ret);
131 
132  return ret;
133 }
134 
135 /*
136  * call-seq:
137  * DescriptorPool.add_serialized_file(serialized_file_proto)
138  *
139  * Adds the given serialized FileDescriptorProto to the pool.
140  */
142  VALUE serialized_file_proto) {
143  DescriptorPool* self = ruby_to_DescriptorPool(_self);
144  Check_Type(serialized_file_proto, T_STRING);
145  VALUE arena_rb = Arena_new();
146  upb_arena *arena = Arena_get(arena_rb);
149  RSTRING_PTR(serialized_file_proto),
150  RSTRING_LEN(serialized_file_proto), arena);
151  if (!file_proto) {
152  rb_raise(rb_eArgError, "Unable to parse FileDescriptorProto");
153  }
156  const upb_filedef* filedef =
157  upb_symtab_addfile(self->symtab, file_proto, &status);
158  if (!filedef) {
159  rb_raise(cTypeError, "Unable to build file to DescriptorPool: %s",
161  }
162  return get_filedef_obj(_self, filedef);
163 }
164 
165 /*
166  * call-seq:
167  * DescriptorPool.lookup(name) => descriptor
168  *
169  * Finds a Descriptor or EnumDescriptor by name and returns it, or nil if none
170  * exists with the given name.
171  */
172 static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
173  DescriptorPool* self = ruby_to_DescriptorPool(_self);
174  const char* name_str = get_str(name);
175  const upb_msgdef* msgdef;
176  const upb_enumdef* enumdef;
177 
178  msgdef = upb_symtab_lookupmsg(self->symtab, name_str);
179  if (msgdef) {
180  return get_msgdef_obj(_self, msgdef);
181  }
182 
183  enumdef = upb_symtab_lookupenum(self->symtab, name_str);
184  if (enumdef) {
185  return get_enumdef_obj(_self, enumdef);
186  }
187 
188  return Qnil;
189 }
190 
191 /*
192  * call-seq:
193  * DescriptorPool.generated_pool => descriptor_pool
194  *
195  * Class method that returns the global DescriptorPool. This is a singleton into
196  * which generated-code message and enum types are registered. The user may also
197  * register types in this pool for convenience so that they do not have to hold
198  * a reference to a private pool instance.
199  */
200 static VALUE DescriptorPool_generated_pool(VALUE _self) {
201  return generated_pool;
202 }
203 
204 static void DescriptorPool_register(VALUE module) {
205  VALUE klass = rb_define_class_under(
206  module, "DescriptorPool", rb_cObject);
207  rb_define_alloc_func(klass, DescriptorPool_alloc);
208  rb_define_method(klass, "add_serialized_file",
210  rb_define_method(klass, "lookup", DescriptorPool_lookup, 1);
211  rb_define_singleton_method(klass, "generated_pool",
213  rb_gc_register_address(&cDescriptorPool);
215 
216  rb_gc_register_address(&generated_pool);
217  generated_pool = rb_class_new_instance(0, NULL, klass);
218 }
219 
220 // -----------------------------------------------------------------------------
221 // Descriptor.
222 // -----------------------------------------------------------------------------
223 
224 typedef struct {
225  const upb_msgdef* msgdef;
226  VALUE klass;
227  VALUE descriptor_pool;
228 } Descriptor;
229 
230 VALUE cDescriptor = Qnil;
231 
232 static void Descriptor_mark(void* _self) {
233  Descriptor* self = _self;
234  rb_gc_mark(self->klass);
235  rb_gc_mark(self->descriptor_pool);
236 }
237 
238 static const rb_data_type_t Descriptor_type = {
239  "Google::Protobuf::Descriptor",
240  {Descriptor_mark, RUBY_DEFAULT_FREE, NULL},
241  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
242 };
243 
244 static Descriptor* ruby_to_Descriptor(VALUE val) {
245  Descriptor* ret;
246  TypedData_Get_Struct(val, Descriptor, &Descriptor_type, ret);
247  return ret;
248 }
249 
250 /*
251  * call-seq:
252  * Descriptor.new => descriptor
253  *
254  * Creates a new, empty, message type descriptor. At a minimum, its name must be
255  * set before it is added to a pool. It cannot be used to create messages until
256  * it is added to a pool, after which it becomes immutable (as part of a
257  * finalization process).
258  */
259 static VALUE Descriptor_alloc(VALUE klass) {
260  Descriptor* self = ALLOC(Descriptor);
261  VALUE ret = TypedData_Wrap_Struct(klass, &Descriptor_type, self);
262  self->msgdef = NULL;
263  self->klass = Qnil;
264  self->descriptor_pool = Qnil;
265  return ret;
266 }
267 
268 /*
269  * call-seq:
270  * Descriptor.new(c_only_cookie, ptr) => Descriptor
271  *
272  * Creates a descriptor wrapper object. May only be called from C.
273  */
274 static VALUE Descriptor_initialize(VALUE _self, VALUE cookie,
275  VALUE descriptor_pool, VALUE ptr) {
276  Descriptor* self = ruby_to_Descriptor(_self);
277 
278  if (cookie != c_only_cookie) {
279  rb_raise(rb_eRuntimeError,
280  "Descriptor objects may not be created from Ruby.");
281  }
282 
283  self->descriptor_pool = descriptor_pool;
284  self->msgdef = (const upb_msgdef*)NUM2ULL(ptr);
285 
286  return Qnil;
287 }
288 
289 /*
290  * call-seq:
291  * Descriptor.file_descriptor
292  *
293  * Returns the FileDescriptor object this message belongs to.
294  */
295 static VALUE Descriptor_file_descriptor(VALUE _self) {
296  Descriptor* self = ruby_to_Descriptor(_self);
297  return get_filedef_obj(self->descriptor_pool, upb_msgdef_file(self->msgdef));
298 }
299 
300 /*
301  * call-seq:
302  * Descriptor.name => name
303  *
304  * Returns the name of this message type as a fully-qualified string (e.g.,
305  * My.Package.MessageType).
306  */
307 static VALUE Descriptor_name(VALUE _self) {
308  Descriptor* self = ruby_to_Descriptor(_self);
309  return rb_str_maybe_null(upb_msgdef_fullname(self->msgdef));
310 }
311 
312 /*
313  * call-seq:
314  * Descriptor.each(&block)
315  *
316  * Iterates over fields in this message type, yielding to the block on each one.
317  */
318 static VALUE Descriptor_each(VALUE _self) {
319  Descriptor* self = ruby_to_Descriptor(_self);
320 
322  for (upb_msg_field_begin(&it, self->msgdef);
326  VALUE obj = get_fielddef_obj(self->descriptor_pool, field);
327  rb_yield(obj);
328  }
329  return Qnil;
330 }
331 
332 /*
333  * call-seq:
334  * Descriptor.lookup(name) => FieldDescriptor
335  *
336  * Returns the field descriptor for the field with the given name, if present,
337  * or nil if none.
338  */
339 static VALUE Descriptor_lookup(VALUE _self, VALUE name) {
340  Descriptor* self = ruby_to_Descriptor(_self);
341  const char* s = get_str(name);
342  const upb_fielddef* field = upb_msgdef_ntofz(self->msgdef, s);
343  if (field == NULL) {
344  return Qnil;
345  }
346  return get_fielddef_obj(self->descriptor_pool, field);
347 }
348 
349 /*
350  * call-seq:
351  * Descriptor.each_oneof(&block) => nil
352  *
353  * Invokes the given block for each oneof in this message type, passing the
354  * corresponding OneofDescriptor.
355  */
356 static VALUE Descriptor_each_oneof(VALUE _self) {
357  Descriptor* self = ruby_to_Descriptor(_self);
358 
360  for (upb_msg_oneof_begin(&it, self->msgdef);
363  const upb_oneofdef* oneof = upb_msg_iter_oneof(&it);
364  VALUE obj = get_oneofdef_obj(self->descriptor_pool, oneof);
365  rb_yield(obj);
366  }
367  return Qnil;
368 }
369 
370 /*
371  * call-seq:
372  * Descriptor.lookup_oneof(name) => OneofDescriptor
373  *
374  * Returns the oneof descriptor for the oneof with the given name, if present,
375  * or nil if none.
376  */
377 static VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name) {
378  Descriptor* self = ruby_to_Descriptor(_self);
379  const char* s = get_str(name);
380  const upb_oneofdef* oneof = upb_msgdef_ntooz(self->msgdef, s);
381  if (oneof == NULL) {
382  return Qnil;
383  }
384  return get_oneofdef_obj(self->descriptor_pool, oneof);
385 }
386 
387 /*
388  * call-seq:
389  * Descriptor.msgclass => message_klass
390  *
391  * Returns the Ruby class created for this message type.
392  */
393 static VALUE Descriptor_msgclass(VALUE _self) {
394  Descriptor* self = ruby_to_Descriptor(_self);
395  if (self->klass == Qnil) {
396  self->klass = build_class_from_descriptor(_self);
397  }
398  return self->klass;
399 }
400 
401 static void Descriptor_register(VALUE module) {
402  VALUE klass = rb_define_class_under(
403  module, "Descriptor", rb_cObject);
404  rb_define_alloc_func(klass, Descriptor_alloc);
405  rb_define_method(klass, "initialize", Descriptor_initialize, 3);
406  rb_define_method(klass, "each", Descriptor_each, 0);
407  rb_define_method(klass, "lookup", Descriptor_lookup, 1);
408  rb_define_method(klass, "each_oneof", Descriptor_each_oneof, 0);
409  rb_define_method(klass, "lookup_oneof", Descriptor_lookup_oneof, 1);
410  rb_define_method(klass, "msgclass", Descriptor_msgclass, 0);
411  rb_define_method(klass, "name", Descriptor_name, 0);
412  rb_define_method(klass, "file_descriptor", Descriptor_file_descriptor, 0);
413  rb_include_module(klass, rb_mEnumerable);
414  rb_gc_register_address(&cDescriptor);
415  cDescriptor = klass;
416 }
417 
418 // -----------------------------------------------------------------------------
419 // FileDescriptor.
420 // -----------------------------------------------------------------------------
421 
422 typedef struct {
423  const upb_filedef* filedef;
424  VALUE descriptor_pool; // Owns the upb_filedef.
426 
427 static VALUE cFileDescriptor = Qnil;
428 
429 static void FileDescriptor_mark(void* _self) {
430  FileDescriptor* self = _self;
431  rb_gc_mark(self->descriptor_pool);
432 }
433 
434 static const rb_data_type_t FileDescriptor_type = {
435  "Google::Protobuf::FileDescriptor",
436  {FileDescriptor_mark, RUBY_DEFAULT_FREE, NULL},
437  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
438 };
439 
442  TypedData_Get_Struct(val, FileDescriptor, &FileDescriptor_type, ret);
443  return ret;
444 }
445 
446 static VALUE FileDescriptor_alloc(VALUE klass) {
448  VALUE ret = TypedData_Wrap_Struct(klass, &FileDescriptor_type, self);
449  self->descriptor_pool = Qnil;
450  self->filedef = NULL;
451  return ret;
452 }
453 
454 /*
455  * call-seq:
456  * FileDescriptor.new => file
457  *
458  * Returns a new file descriptor. The syntax must be set before it's passed
459  * to a builder.
460  */
461 static VALUE FileDescriptor_initialize(VALUE _self, VALUE cookie,
462  VALUE descriptor_pool, VALUE ptr) {
463  FileDescriptor* self = ruby_to_FileDescriptor(_self);
464 
465  if (cookie != c_only_cookie) {
466  rb_raise(rb_eRuntimeError,
467  "Descriptor objects may not be created from Ruby.");
468  }
469 
470  self->descriptor_pool = descriptor_pool;
471  self->filedef = (const upb_filedef*)NUM2ULL(ptr);
472 
473  return Qnil;
474 }
475 
476 /*
477  * call-seq:
478  * FileDescriptor.name => name
479  *
480  * Returns the name of the file.
481  */
482 static VALUE FileDescriptor_name(VALUE _self) {
483  FileDescriptor* self = ruby_to_FileDescriptor(_self);
484  const char* name = upb_filedef_name(self->filedef);
485  return name == NULL ? Qnil : rb_str_new2(name);
486 }
487 
488 /*
489  * call-seq:
490  * FileDescriptor.syntax => syntax
491  *
492  * Returns this file descriptors syntax.
493  *
494  * Valid syntax versions are:
495  * :proto2 or :proto3.
496  */
497 static VALUE FileDescriptor_syntax(VALUE _self) {
498  FileDescriptor* self = ruby_to_FileDescriptor(_self);
499 
500  switch (upb_filedef_syntax(self->filedef)) {
501  case UPB_SYNTAX_PROTO3: return ID2SYM(rb_intern("proto3"));
502  case UPB_SYNTAX_PROTO2: return ID2SYM(rb_intern("proto2"));
503  default: return Qnil;
504  }
505 }
506 
507 static void FileDescriptor_register(VALUE module) {
508  VALUE klass = rb_define_class_under(
509  module, "FileDescriptor", rb_cObject);
510  rb_define_alloc_func(klass, FileDescriptor_alloc);
511  rb_define_method(klass, "initialize", FileDescriptor_initialize, 3);
512  rb_define_method(klass, "name", FileDescriptor_name, 0);
513  rb_define_method(klass, "syntax", FileDescriptor_syntax, 0);
514  rb_gc_register_address(&cFileDescriptor);
516 }
517 
518 // -----------------------------------------------------------------------------
519 // FieldDescriptor.
520 // -----------------------------------------------------------------------------
521 
522 typedef struct {
523  const upb_fielddef* fielddef;
524  VALUE descriptor_pool; // Owns the upb_fielddef.
526 
527 static VALUE cFieldDescriptor = Qnil;
528 
529 static void FieldDescriptor_mark(void* _self) {
530  FieldDescriptor* self = _self;
531  rb_gc_mark(self->descriptor_pool);
532 }
533 
534 static const rb_data_type_t FieldDescriptor_type = {
535  "Google::Protobuf::FieldDescriptor",
536  {FieldDescriptor_mark, RUBY_DEFAULT_FREE, NULL},
537  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
538 };
539 
542  TypedData_Get_Struct(val, FieldDescriptor, &FieldDescriptor_type, ret);
543  return ret;
544 }
545 
546 /*
547  * call-seq:
548  * FieldDescriptor.new => field
549  *
550  * Returns a new field descriptor. Its name, type, etc. must be set before it is
551  * added to a message type.
552  */
553 static VALUE FieldDescriptor_alloc(VALUE klass) {
555  VALUE ret = TypedData_Wrap_Struct(klass, &FieldDescriptor_type, self);
556  self->fielddef = NULL;
557  return ret;
558 }
559 
560 /*
561  * call-seq:
562  * EnumDescriptor.new(c_only_cookie, pool, ptr) => EnumDescriptor
563  *
564  * Creates a descriptor wrapper object. May only be called from C.
565  */
566 static VALUE FieldDescriptor_initialize(VALUE _self, VALUE cookie,
567  VALUE descriptor_pool, VALUE ptr) {
569 
570  if (cookie != c_only_cookie) {
571  rb_raise(rb_eRuntimeError,
572  "Descriptor objects may not be created from Ruby.");
573  }
574 
575  self->descriptor_pool = descriptor_pool;
576  self->fielddef = (const upb_fielddef*)NUM2ULL(ptr);
577 
578  return Qnil;
579 }
580 
581 /*
582  * call-seq:
583  * FieldDescriptor.name => name
584  *
585  * Returns the name of this field.
586  */
587 static VALUE FieldDescriptor_name(VALUE _self) {
589  return rb_str_maybe_null(upb_fielddef_name(self->fielddef));
590 }
591 
592 // Non-static, exposed to other .c files.
594  if (TYPE(type) != T_SYMBOL) {
595  rb_raise(rb_eArgError, "Expected symbol for field type.");
596  }
597 
598 #define CONVERT(upb, ruby) \
599  if (SYM2ID(type) == rb_intern( # ruby )) { \
600  return UPB_TYPE_ ## upb; \
601  }
602 
603  CONVERT(FLOAT, float);
604  CONVERT(DOUBLE, double);
605  CONVERT(BOOL, bool);
606  CONVERT(STRING, string);
607  CONVERT(BYTES, bytes);
609  CONVERT(ENUM, enum);
610  CONVERT(INT32, int32);
611  CONVERT(INT64, int64);
612  CONVERT(UINT32, uint32);
613  CONVERT(UINT64, uint64);
614 
615 #undef CONVERT
616 
617  rb_raise(rb_eArgError, "Unknown field type.");
618  return 0;
619 }
620 
622  switch (type) {
623 #define CONVERT(upb, ruby) \
624  case UPB_DESCRIPTOR_TYPE_ ## upb : return ID2SYM(rb_intern( # ruby ));
625  CONVERT(FLOAT, float);
626  CONVERT(DOUBLE, double);
627  CONVERT(BOOL, bool);
628  CONVERT(STRING, string);
629  CONVERT(BYTES, bytes);
631  CONVERT(GROUP, group);
632  CONVERT(ENUM, enum);
633  CONVERT(INT32, int32);
634  CONVERT(INT64, int64);
635  CONVERT(UINT32, uint32);
636  CONVERT(UINT64, uint64);
637  CONVERT(SINT32, sint32);
638  CONVERT(SINT64, sint64);
639  CONVERT(FIXED32, fixed32);
640  CONVERT(FIXED64, fixed64);
641  CONVERT(SFIXED32, sfixed32);
642  CONVERT(SFIXED64, sfixed64);
643 #undef CONVERT
644  }
645  return Qnil;
646 }
647 
648 /*
649  * call-seq:
650  * FieldDescriptor.type => type
651  *
652  * Returns this field's type, as a Ruby symbol, or nil if not yet set.
653  *
654  * Valid field types are:
655  * :int32, :int64, :uint32, :uint64, :float, :double, :bool, :string,
656  * :bytes, :message.
657  */
658 static VALUE FieldDescriptor__type(VALUE _self) {
661 }
662 
663 /*
664  * call-seq:
665  * FieldDescriptor.default => default
666  *
667  * Returns this field's default, as a Ruby object, or nil if not yet set.
668  */
669 static VALUE FieldDescriptor_default(VALUE _self) {
671  const upb_fielddef *f = self->fielddef;
672  upb_msgval default_val = {0};
673  if (upb_fielddef_issubmsg(f)) {
674  return Qnil;
675  } else if (!upb_fielddef_isseq(f)) {
676  default_val = upb_fielddef_default(f);
677  }
678  return Convert_UpbToRuby(default_val, TypeInfo_get(self->fielddef), Qnil);
679 }
680 
681 
682 /*
683  * call-seq:
684  * FieldDescriptor.json_name => json_name
685  *
686  * Returns this field's json_name, as a Ruby string, or nil if not yet set.
687  */
688 static VALUE FieldDescriptor_json_name(VALUE _self) {
690  const upb_fielddef *f = self->fielddef;
691  const char *json_name = upb_fielddef_jsonname(f);
692  return rb_str_new2(json_name);
693 }
694 
695 /*
696  * call-seq:
697  * FieldDescriptor.label => label
698  *
699  * Returns this field's label (i.e., plurality), as a Ruby symbol.
700  *
701  * Valid field labels are:
702  * :optional, :repeated
703  */
704 static VALUE FieldDescriptor_label(VALUE _self) {
706  switch (upb_fielddef_label(self->fielddef)) {
707 #define CONVERT(upb, ruby) \
708  case UPB_LABEL_ ## upb : return ID2SYM(rb_intern( # ruby ));
709 
710  CONVERT(OPTIONAL, optional);
711  CONVERT(REQUIRED, required);
712  CONVERT(REPEATED, repeated);
713 
714 #undef CONVERT
715  }
716 
717  return Qnil;
718 }
719 
720 /*
721  * call-seq:
722  * FieldDescriptor.number => number
723  *
724  * Returns the tag number for this field.
725  */
726 static VALUE FieldDescriptor_number(VALUE _self) {
728  return INT2NUM(upb_fielddef_number(self->fielddef));
729 }
730 
731 /*
732  * call-seq:
733  * FieldDescriptor.submsg_name => submsg_name
734  *
735  * Returns the name of the message or enum type corresponding to this field, if
736  * it is a message or enum field (respectively), or nil otherwise. This type
737  * name will be resolved within the context of the pool to which the containing
738  * message type is added.
739  */
740 static VALUE FieldDescriptor_submsg_name(VALUE _self) {
742  switch (upb_fielddef_type(self->fielddef)) {
743  case UPB_TYPE_ENUM:
744  return rb_str_new2(
746  case UPB_TYPE_MESSAGE:
747  return rb_str_new2(
749  default:
750  return Qnil;
751  }
752 }
753 
754 /*
755  * call-seq:
756  * FieldDescriptor.subtype => message_or_enum_descriptor
757  *
758  * Returns the message or enum descriptor corresponding to this field's type if
759  * it is a message or enum field, respectively, or nil otherwise. Cannot be
760  * called *until* the containing message type is added to a pool (and thus
761  * resolved).
762  */
763 static VALUE FieldDescriptor_subtype(VALUE _self) {
765  switch (upb_fielddef_type(self->fielddef)) {
766  case UPB_TYPE_ENUM:
767  return get_enumdef_obj(self->descriptor_pool,
768  upb_fielddef_enumsubdef(self->fielddef));
769  case UPB_TYPE_MESSAGE:
770  return get_msgdef_obj(self->descriptor_pool,
771  upb_fielddef_msgsubdef(self->fielddef));
772  default:
773  return Qnil;
774  }
775 }
776 
777 /*
778  * call-seq:
779  * FieldDescriptor.get(message) => value
780  *
781  * Returns the value set for this field on the given message. Raises an
782  * exception if message is of the wrong type.
783  */
784 static VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb) {
786  const upb_msgdef *m;
787 
788  Message_Get(msg_rb, &m);
789 
790  if (m != upb_fielddef_containingtype(self->fielddef)) {
791  rb_raise(cTypeError, "get method called on wrong message type");
792  }
793 
794  return Message_getfield(msg_rb, self->fielddef);
795 }
796 
797 /*
798  * call-seq:
799  * FieldDescriptor.has?(message) => boolean
800  *
801  * Returns whether the value is set on the given message. Raises an
802  * exception when calling for fields that do not have presence.
803  */
804 static VALUE FieldDescriptor_has(VALUE _self, VALUE msg_rb) {
806  const upb_msgdef *m;
807  const upb_msgdef *msg = Message_Get(msg_rb, &m);
808 
809  if (m != upb_fielddef_containingtype(self->fielddef)) {
810  rb_raise(cTypeError, "has method called on wrong message type");
811  } else if (!upb_fielddef_haspresence(self->fielddef)) {
812  rb_raise(rb_eArgError, "does not track presence");
813  }
814 
815  return upb_msg_has(msg, self->fielddef) ? Qtrue : Qfalse;
816 }
817 
818 /*
819  * call-seq:
820  * FieldDescriptor.clear(message)
821  *
822  * Clears the field from the message if it's set.
823  */
824 static VALUE FieldDescriptor_clear(VALUE _self, VALUE msg_rb) {
826  const upb_msgdef *m;
827  upb_msgdef *msg = Message_GetMutable(msg_rb, &m);
828 
829  if (m != upb_fielddef_containingtype(self->fielddef)) {
830  rb_raise(cTypeError, "has method called on wrong message type");
831  }
832 
833  upb_msg_clearfield(msg, self->fielddef);
834  return Qnil;
835 }
836 
837 /*
838  * call-seq:
839  * FieldDescriptor.set(message, value)
840  *
841  * Sets the value corresponding to this field to the given value on the given
842  * message. Raises an exception if message is of the wrong type. Performs the
843  * ordinary type-checks for field setting.
844  */
845 static VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value) {
847  const upb_msgdef *m;
848  upb_msgdef *msg = Message_GetMutable(msg_rb, &m);
850  upb_msgval msgval;
851 
852  if (m != upb_fielddef_containingtype(self->fielddef)) {
853  rb_raise(cTypeError, "set method called on wrong message type");
854  }
855 
856  msgval = Convert_RubyToUpb(value, upb_fielddef_name(self->fielddef),
857  TypeInfo_get(self->fielddef), arena);
858  upb_msg_set(msg, self->fielddef, msgval, arena);
859  return Qnil;
860 }
861 
862 static void FieldDescriptor_register(VALUE module) {
863  VALUE klass = rb_define_class_under(
864  module, "FieldDescriptor", rb_cObject);
865  rb_define_alloc_func(klass, FieldDescriptor_alloc);
866  rb_define_method(klass, "initialize", FieldDescriptor_initialize, 3);
867  rb_define_method(klass, "name", FieldDescriptor_name, 0);
868  rb_define_method(klass, "type", FieldDescriptor__type, 0);
869  rb_define_method(klass, "default", FieldDescriptor_default, 0);
870  rb_define_method(klass, "json_name", FieldDescriptor_json_name, 0);
871  rb_define_method(klass, "label", FieldDescriptor_label, 0);
872  rb_define_method(klass, "number", FieldDescriptor_number, 0);
873  rb_define_method(klass, "submsg_name", FieldDescriptor_submsg_name, 0);
874  rb_define_method(klass, "subtype", FieldDescriptor_subtype, 0);
875  rb_define_method(klass, "has?", FieldDescriptor_has, 1);
876  rb_define_method(klass, "clear", FieldDescriptor_clear, 1);
877  rb_define_method(klass, "get", FieldDescriptor_get, 1);
878  rb_define_method(klass, "set", FieldDescriptor_set, 2);
879  rb_gc_register_address(&cFieldDescriptor);
881 }
882 
883 // -----------------------------------------------------------------------------
884 // OneofDescriptor.
885 // -----------------------------------------------------------------------------
886 
887 typedef struct {
888  const upb_oneofdef* oneofdef;
889  VALUE descriptor_pool; // Owns the upb_oneofdef.
891 
892 static VALUE cOneofDescriptor = Qnil;
893 
894 static void OneofDescriptor_mark(void* _self) {
895  OneofDescriptor* self = _self;
896  rb_gc_mark(self->descriptor_pool);
897 }
898 
899 static const rb_data_type_t OneofDescriptor_type = {
900  "Google::Protobuf::OneofDescriptor",
901  {OneofDescriptor_mark, RUBY_DEFAULT_FREE, NULL},
902  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
903 };
904 
907  TypedData_Get_Struct(val, OneofDescriptor, &OneofDescriptor_type, ret);
908  return ret;
909 }
910 
911 /*
912  * call-seq:
913  * OneofDescriptor.new => oneof_descriptor
914  *
915  * Creates a new, empty, oneof descriptor. The oneof may only be modified prior
916  * to being added to a message descriptor which is subsequently added to a pool.
917  */
918 static VALUE OneofDescriptor_alloc(VALUE klass) {
920  VALUE ret = TypedData_Wrap_Struct(klass, &OneofDescriptor_type, self);
921  self->oneofdef = NULL;
922  self->descriptor_pool = Qnil;
923  return ret;
924 }
925 
926 /*
927  * call-seq:
928  * OneofDescriptor.new(c_only_cookie, pool, ptr) => OneofDescriptor
929  *
930  * Creates a descriptor wrapper object. May only be called from C.
931  */
932 static VALUE OneofDescriptor_initialize(VALUE _self, VALUE cookie,
933  VALUE descriptor_pool, VALUE ptr) {
935 
936  if (cookie != c_only_cookie) {
937  rb_raise(rb_eRuntimeError,
938  "Descriptor objects may not be created from Ruby.");
939  }
940 
941  self->descriptor_pool = descriptor_pool;
942  self->oneofdef = (const upb_oneofdef*)NUM2ULL(ptr);
943 
944  return Qnil;
945 }
946 
947 /*
948  * call-seq:
949  * OneofDescriptor.name => name
950  *
951  * Returns the name of this oneof.
952  */
953 static VALUE OneofDescriptor_name(VALUE _self) {
955  return rb_str_maybe_null(upb_oneofdef_name(self->oneofdef));
956 }
957 
958 /*
959  * call-seq:
960  * OneofDescriptor.each(&block) => nil
961  *
962  * Iterates through fields in this oneof, yielding to the block on each one.
963  */
964 static VALUE OneofDescriptor_each(VALUE _self) {
967  for (upb_oneof_begin(&it, self->oneofdef);
968  !upb_oneof_done(&it);
969  upb_oneof_next(&it)) {
971  VALUE obj = get_fielddef_obj(self->descriptor_pool, f);
972  rb_yield(obj);
973  }
974  return Qnil;
975 }
976 
977 static void OneofDescriptor_register(VALUE module) {
978  VALUE klass = rb_define_class_under(
979  module, "OneofDescriptor", rb_cObject);
980  rb_define_alloc_func(klass, OneofDescriptor_alloc);
981  rb_define_method(klass, "initialize", OneofDescriptor_initialize, 3);
982  rb_define_method(klass, "name", OneofDescriptor_name, 0);
983  rb_define_method(klass, "each", OneofDescriptor_each, 0);
984  rb_include_module(klass, rb_mEnumerable);
985  rb_gc_register_address(&cOneofDescriptor);
987 }
988 
989 // -----------------------------------------------------------------------------
990 // EnumDescriptor.
991 // -----------------------------------------------------------------------------
992 
993 typedef struct {
994  const upb_enumdef* enumdef;
995  VALUE module; // begins as nil
996  VALUE descriptor_pool; // Owns the upb_enumdef.
998 
999 static VALUE cEnumDescriptor = Qnil;
1000 
1001 static void EnumDescriptor_mark(void* _self) {
1002  EnumDescriptor* self = _self;
1003  rb_gc_mark(self->module);
1004  rb_gc_mark(self->descriptor_pool);
1005 }
1006 
1007 static const rb_data_type_t EnumDescriptor_type = {
1008  "Google::Protobuf::EnumDescriptor",
1009  {EnumDescriptor_mark, RUBY_DEFAULT_FREE, NULL},
1010  .flags = RUBY_TYPED_FREE_IMMEDIATELY,
1011 };
1012 
1015  TypedData_Get_Struct(val, EnumDescriptor, &EnumDescriptor_type, ret);
1016  return ret;
1017 }
1018 
1019 static VALUE EnumDescriptor_alloc(VALUE klass) {
1021  VALUE ret = TypedData_Wrap_Struct(klass, &EnumDescriptor_type, self);
1022  self->enumdef = NULL;
1023  self->module = Qnil;
1024  self->descriptor_pool = Qnil;
1025  return ret;
1026 }
1027 
1028 // Exposed to other modules in defs.h.
1029 const upb_enumdef *EnumDescriptor_GetEnumDef(VALUE enum_desc_rb) {
1030  EnumDescriptor *desc = ruby_to_EnumDescriptor(enum_desc_rb);
1031  return desc->enumdef;
1032 }
1033 
1034 /*
1035  * call-seq:
1036  * EnumDescriptor.new(c_only_cookie, ptr) => EnumDescriptor
1037  *
1038  * Creates a descriptor wrapper object. May only be called from C.
1039  */
1040 static VALUE EnumDescriptor_initialize(VALUE _self, VALUE cookie,
1041  VALUE descriptor_pool, VALUE ptr) {
1042  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1043 
1044  if (cookie != c_only_cookie) {
1045  rb_raise(rb_eRuntimeError,
1046  "Descriptor objects may not be created from Ruby.");
1047  }
1048 
1049  self->descriptor_pool = descriptor_pool;
1050  self->enumdef = (const upb_enumdef*)NUM2ULL(ptr);
1051 
1052  return Qnil;
1053 }
1054 
1055 /*
1056  * call-seq:
1057  * EnumDescriptor.file_descriptor
1058  *
1059  * Returns the FileDescriptor object this enum belongs to.
1060  */
1061 static VALUE EnumDescriptor_file_descriptor(VALUE _self) {
1062  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1063  return get_filedef_obj(self->descriptor_pool,
1064  upb_enumdef_file(self->enumdef));
1065 }
1066 
1067 /*
1068  * call-seq:
1069  * EnumDescriptor.name => name
1070  *
1071  * Returns the name of this enum type.
1072  */
1073 static VALUE EnumDescriptor_name(VALUE _self) {
1074  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1075  return rb_str_maybe_null(upb_enumdef_fullname(self->enumdef));
1076 }
1077 
1078 /*
1079  * call-seq:
1080  * EnumDescriptor.lookup_name(name) => value
1081  *
1082  * Returns the numeric value corresponding to the given key name (as a Ruby
1083  * symbol), or nil if none.
1084  */
1085 static VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name) {
1086  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1087  const char* name_str= rb_id2name(SYM2ID(name));
1088  int32_t val = 0;
1089  if (upb_enumdef_ntoiz(self->enumdef, name_str, &val)) {
1090  return INT2NUM(val);
1091  } else {
1092  return Qnil;
1093  }
1094 }
1095 
1096 /*
1097  * call-seq:
1098  * EnumDescriptor.lookup_value(name) => value
1099  *
1100  * Returns the key name (as a Ruby symbol) corresponding to the integer value,
1101  * or nil if none.
1102  */
1103 static VALUE EnumDescriptor_lookup_value(VALUE _self, VALUE number) {
1104  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1105  int32_t val = NUM2INT(number);
1106  const char* name = upb_enumdef_iton(self->enumdef, val);
1107  if (name != NULL) {
1108  return ID2SYM(rb_intern(name));
1109  } else {
1110  return Qnil;
1111  }
1112 }
1113 
1114 /*
1115  * call-seq:
1116  * EnumDescriptor.each(&block)
1117  *
1118  * Iterates over key => value mappings in this enum's definition, yielding to
1119  * the block with (key, value) arguments for each one.
1120  */
1121 static VALUE EnumDescriptor_each(VALUE _self) {
1122  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1123 
1124  upb_enum_iter it;
1125  for (upb_enum_begin(&it, self->enumdef);
1126  !upb_enum_done(&it);
1127  upb_enum_next(&it)) {
1128  VALUE key = ID2SYM(rb_intern(upb_enum_iter_name(&it)));
1129  VALUE number = INT2NUM(upb_enum_iter_number(&it));
1130  rb_yield_values(2, key, number);
1131  }
1132 
1133  return Qnil;
1134 }
1135 
1136 /*
1137  * call-seq:
1138  * EnumDescriptor.enummodule => module
1139  *
1140  * Returns the Ruby module corresponding to this enum type.
1141  */
1142 static VALUE EnumDescriptor_enummodule(VALUE _self) {
1143  EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
1144  if (self->module == Qnil) {
1145  self->module = build_module_from_enumdesc(_self);
1146  }
1147  return self->module;
1148 }
1149 
1150 static void EnumDescriptor_register(VALUE module) {
1151  VALUE klass = rb_define_class_under(
1152  module, "EnumDescriptor", rb_cObject);
1153  rb_define_alloc_func(klass, EnumDescriptor_alloc);
1154  rb_define_method(klass, "initialize", EnumDescriptor_initialize, 3);
1155  rb_define_method(klass, "name", EnumDescriptor_name, 0);
1156  rb_define_method(klass, "lookup_name", EnumDescriptor_lookup_name, 1);
1157  rb_define_method(klass, "lookup_value", EnumDescriptor_lookup_value, 1);
1158  rb_define_method(klass, "each", EnumDescriptor_each, 0);
1159  rb_define_method(klass, "enummodule", EnumDescriptor_enummodule, 0);
1160  rb_define_method(klass, "file_descriptor", EnumDescriptor_file_descriptor, 0);
1161  rb_include_module(klass, rb_mEnumerable);
1162  rb_gc_register_address(&cEnumDescriptor);
1164 }
1165 
1166 static VALUE get_def_obj(VALUE _descriptor_pool, const void* ptr, VALUE klass) {
1167  DescriptorPool* descriptor_pool = ruby_to_DescriptorPool(_descriptor_pool);
1168  VALUE key = ULL2NUM((intptr_t)ptr);
1169  VALUE def;
1170 
1171  def = rb_hash_aref(descriptor_pool->def_to_descriptor, key);
1172 
1173  if (ptr == NULL) {
1174  return Qnil;
1175  }
1176 
1177  if (def == Qnil) {
1178  // Lazily create wrapper object.
1179  VALUE args[3] = { c_only_cookie, _descriptor_pool, key };
1180  def = rb_class_new_instance(3, args, klass);
1181  rb_hash_aset(descriptor_pool->def_to_descriptor, key, def);
1182  }
1183 
1184  return def;
1185 }
1186 
1187 static VALUE get_msgdef_obj(VALUE descriptor_pool, const upb_msgdef* def) {
1188  return get_def_obj(descriptor_pool, def, cDescriptor);
1189 }
1190 
1191 static VALUE get_enumdef_obj(VALUE descriptor_pool, const upb_enumdef* def) {
1192  return get_def_obj(descriptor_pool, def, cEnumDescriptor);
1193 }
1194 
1195 static VALUE get_fielddef_obj(VALUE descriptor_pool, const upb_fielddef* def) {
1196  return get_def_obj(descriptor_pool, def, cFieldDescriptor);
1197 }
1198 
1199 static VALUE get_filedef_obj(VALUE descriptor_pool, const upb_filedef* def) {
1200  return get_def_obj(descriptor_pool, def, cFileDescriptor);
1201 }
1202 
1203 static VALUE get_oneofdef_obj(VALUE descriptor_pool, const upb_oneofdef* def) {
1204  return get_def_obj(descriptor_pool, def, cOneofDescriptor);
1205 }
1206 
1207 // -----------------------------------------------------------------------------
1208 // Shared functions
1209 // -----------------------------------------------------------------------------
1210 
1211 // Functions exposed to other modules in defs.h.
1212 
1215  VALUE pool = ObjectCache_Get(symtab);
1216  PBRUBY_ASSERT(pool != Qnil);
1217  VALUE desc_rb = get_msgdef_obj(pool, m);
1218  const Descriptor* desc = ruby_to_Descriptor(desc_rb);
1219  return desc->klass;
1220 }
1221 
1222 const upb_msgdef *Descriptor_GetMsgDef(VALUE desc_rb) {
1223  const Descriptor* desc = ruby_to_Descriptor(desc_rb);
1224  return desc->msgdef;
1225 }
1226 
1227 VALUE TypeInfo_InitArg(int argc, VALUE *argv, int skip_arg) {
1228  if (argc > skip_arg) {
1229  if (argc > 1 + skip_arg) {
1230  rb_raise(rb_eArgError, "Expected a maximum of %d arguments.", skip_arg + 1);
1231  }
1232  return argv[skip_arg];
1233  } else {
1234  return Qnil;
1235  }
1236 }
1237 
1238 TypeInfo TypeInfo_FromClass(int argc, VALUE* argv, int skip_arg,
1239  VALUE* type_class, VALUE* init_arg) {
1240  TypeInfo ret = {ruby_to_fieldtype(argv[skip_arg])};
1241 
1242  if (ret.type == UPB_TYPE_MESSAGE || ret.type == UPB_TYPE_ENUM) {
1243  *init_arg = TypeInfo_InitArg(argc, argv, skip_arg + 2);
1244 
1245  if (argc < 2 + skip_arg) {
1246  rb_raise(rb_eArgError, "Expected at least %d arguments for message/enum.",
1247  2 + skip_arg);
1248  }
1249 
1250  VALUE klass = argv[1 + skip_arg];
1252  *type_class = klass;
1253 
1254  if (desc == Qnil) {
1255  rb_raise(rb_eArgError,
1256  "Type class has no descriptor. Please pass a "
1257  "class or enum as returned by the DescriptorPool.");
1258  }
1259 
1260  if (ret.type == UPB_TYPE_MESSAGE) {
1261  ret.def.msgdef = ruby_to_Descriptor(desc)->msgdef;
1263  } else {
1264  PBRUBY_ASSERT(ret.type == UPB_TYPE_ENUM);
1265  ret.def.enumdef = ruby_to_EnumDescriptor(desc)->enumdef;
1266  }
1267  } else {
1268  *init_arg = TypeInfo_InitArg(argc, argv, skip_arg + 1);
1269  }
1270 
1271  return ret;
1272 }
1273 
1274 void Defs_register(VALUE module) {
1281 
1282  rb_gc_register_address(&c_only_cookie);
1283  c_only_cookie = rb_class_new_instance(0, NULL, rb_cObject);
1284 }
xds_interop_client.str
str
Definition: xds_interop_client.py:487
Descriptor_lookup
static VALUE Descriptor_lookup(VALUE _self, VALUE name)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:339
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
DescriptorPool_GetSymtab
const upb_symtab * DescriptorPool_GetSymtab(VALUE desc_pool_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:110
upb_msgdef_file
const upb_filedef * upb_msgdef_file(const upb_msgdef *m)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3536
obj
OPENSSL_EXPORT const ASN1_OBJECT * obj
Definition: x509.h:1671
UPB_SYNTAX_PROTO2
@ UPB_SYNTAX_PROTO2
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:2972
EnumDescriptor_lookup_value
static VALUE EnumDescriptor_lookup_value(VALUE _self, VALUE number)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1103
cEnumDescriptor
static VALUE cEnumDescriptor
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:999
upb_arena
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2252
Convert_RubyToUpb
upb_msgval Convert_RubyToUpb(VALUE value, const char *name, TypeInfo type_info, upb_arena *arena)
Definition: protobuf/ruby/ext/google/protobuf_c/convert.c:127
MESSAGE
static const char MESSAGE[]
Definition: test-callback-stack.c:31
Descriptor_initialize
static VALUE Descriptor_initialize(VALUE _self, VALUE cookie, VALUE descriptor_pool, VALUE ptr)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:274
upb_symtab_addfile
const upb_filedef * upb_symtab_addfile(upb_symtab *s, const google_protobuf_FileDescriptorProto *file_proto, upb_status *status)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4590
regen-readme.it
it
Definition: regen-readme.py:15
EnumDescriptor
struct EnumDescriptor EnumDescriptor
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:641
upb_fielddef_label
upb_label_t upb_fielddef_label(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3347
oneofdef
const upb_oneofdef * oneofdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1183
upb_oneof_done
bool upb_oneof_done(upb_oneof_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3718
FieldDescriptor_get
static VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:784
FieldDescriptor_clear
static VALUE FieldDescriptor_clear(VALUE _self, VALUE msg_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:824
upb_status_clear
void upb_status_clear(upb_status *status)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2196
upb_msg_field_next
void upb_msg_field_next(upb_msg_field_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3626
Convert_UpbToRuby
VALUE Convert_UpbToRuby(upb_msgval upb_val, TypeInfo type_info, VALUE arena)
Definition: protobuf/ruby/ext/google/protobuf_c/convert.c:230
TypeInfo_InitArg
VALUE TypeInfo_InitArg(int argc, VALUE *argv, int skip_arg)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1227
upb_enum_iter_name
const char * upb_enum_iter_name(upb_enum_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3289
FieldDescriptor_submsg_name
static VALUE FieldDescriptor_submsg_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:740
FileDescriptor_alloc
static VALUE FileDescriptor_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:446
ruby_to_OneofDescriptor
static OneofDescriptor * ruby_to_OneofDescriptor(VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:905
upb_status
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:197
upb_enum_done
bool upb_enum_done(upb_enum_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3271
ruby_to_FileDescriptor
static FileDescriptor * ruby_to_FileDescriptor(VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:440
upb_symtab_new
upb_symtab * upb_symtab_new(void)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4545
EnumDescriptor_name
static VALUE EnumDescriptor_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1073
google::protobuf::int64
int64_t int64
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/stubs/port.h:151
OneofDescriptor_mark
static void OneofDescriptor_mark(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:894
upb_fielddef_issubmsg
bool upb_fielddef_issubmsg(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3486
upb_enumdef_fullname
const char * upb_enumdef_fullname(const upb_enumdef *e)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3244
c_only_cookie
VALUE c_only_cookie
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:53
Descriptor_each
static VALUE Descriptor_each(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:318
upb_fieldtype_t
upb_fieldtype_t
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:472
upb_filedef_syntax
upb_syntax_t upb_filedef_syntax(const upb_filedef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4512
OneofDescriptor_register
static void OneofDescriptor_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:977
upb_symtab_free
void upb_symtab_free(upb_symtab *s)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4540
FileDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:128
FileDescriptor_register
static void FileDescriptor_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:507
Descriptor_DefToClass
VALUE Descriptor_DefToClass(const upb_msgdef *m)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1213
Descriptor_alloc
static VALUE Descriptor_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:259
grpc::protobuf::FieldDescriptor
GRPC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor
Definition: include/grpcpp/impl/codegen/config_protobuf.h:84
Descriptor::msgdef
const upb_msgdef * msgdef
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:122
upb_msg_iter_field
upb_fielddef * upb_msg_iter_field(const upb_msg_field_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3632
upb_oneof_iter_field
upb_fielddef * upb_oneof_iter_field(const upb_oneof_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3722
google::protobuf::uint32
uint32_t uint32
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/stubs/port.h:155
ruby_to_Descriptor
static Descriptor * ruby_to_Descriptor(VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:244
FieldDescriptor_has
static VALUE FieldDescriptor_has(VALUE _self, VALUE msg_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:804
build_class_from_descriptor
void build_class_from_descriptor(PHP_PROTO_HASHTABLE_VALUE php_descriptor TSRMLS_DC)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/message.c:276
OneofDescriptor_initialize
static VALUE OneofDescriptor_initialize(VALUE _self, VALUE cookie, VALUE descriptor_pool, VALUE ptr)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:932
TypeInfo
Definition: protobuf/php/ext/google/protobuf/def.h:69
PBRUBY_ASSERT
#define PBRUBY_ASSERT(expr)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.h:110
EnumDescriptor_file_descriptor
static VALUE EnumDescriptor_file_descriptor(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1061
status
absl::Status status
Definition: rls.cc:251
upb_enumdef_file
const upb_filedef * upb_enumdef_file(const upb_enumdef *e)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3252
MessageOrEnum_GetDescriptor
VALUE MessageOrEnum_GetDescriptor(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:46
upb_msg_has
bool upb_msg_has(const upb_msg *msg, const upb_fielddef *f)
Definition: php-upb.c:7062
setup.name
name
Definition: setup.py:542
OneofDescriptor_name
static VALUE OneofDescriptor_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:953
upb_msg_oneof_done
bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3662
grpc::protobuf::DescriptorPool
GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool
Definition: include/grpcpp/impl/codegen/config_protobuf.h:82
TypeInfo_FromClass
TypeInfo TypeInfo_FromClass(int argc, VALUE *argv, int skip_arg, VALUE *type_class, VALUE *init_arg)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1238
EnumDescriptor::enumdef
const upb_enumdef * enumdef
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:144
EnumDescriptor_type
static const rb_data_type_t EnumDescriptor_type
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1007
FileDescriptor_syntax
static VALUE FileDescriptor_syntax(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:497
Arena_get
upb_arena * Arena_get(VALUE _arena)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:201
FieldDescriptor_register
static void FieldDescriptor_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:862
upb_fielddef_jsonname
const char * upb_fielddef_jsonname(const upb_fielddef *f)
Definition: php-upb.c:5199
upb_msg_set
void upb_msg_set(upb_msg *msg, const upb_fielddef *f, upb_msgval val, upb_arena *a)
Definition: php-upb.c:7132
get_def_obj
static VALUE get_def_obj(VALUE _descriptor_pool, const void *ptr, VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1166
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
BOOL
int BOOL
Definition: undname.c:46
upb_enumdef_ntoiz
UPB_INLINE bool upb_enumdef_ntoiz(const upb_enumdef *e, const char *name, int32_t *num)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:3607
Descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:121
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
Descriptor_lookup_oneof
static VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:377
FieldDescriptor_mark
static void FieldDescriptor_mark(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:529
upb_fielddef_msgsubdef
const upb_msgdef * upb_fielddef_msgsubdef(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3476
get_str
static const char * get_str(VALUE str)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:59
DescriptorPool_mark
static void DescriptorPool_mark(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:86
upb_msg_field_done
bool upb_msg_field_done(const upb_msg_field_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3628
upb_oneofdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2992
FieldDescriptor_name
static VALUE FieldDescriptor_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:587
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
DescriptorPool_type
static const rb_data_type_t DescriptorPool_type
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:97
DescriptorPool_free
static void DescriptorPool_free(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:91
UPB_TYPE_ENUM
@ UPB_TYPE_ENUM
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:479
upb_msg_oneof_begin
void upb_msg_oneof_begin(upb_msg_oneof_iter *iter, const upb_msgdef *m)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3645
get_msgdef_obj
static VALUE get_msgdef_obj(VALUE descriptor_pool, const upb_msgdef *def)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1187
google::protobuf::int32
int32_t int32
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/stubs/port.h:150
FieldDescriptor_type
static const rb_data_type_t FieldDescriptor_type
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:534
autogen_x86imm.f
f
Definition: autogen_x86imm.py:9
upb_msgdef_fullname
const char * upb_msgdef_fullname(const upb_msgdef *m)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3532
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
EnumDescriptor_initialize
static VALUE EnumDescriptor_initialize(VALUE _self, VALUE cookie, VALUE descriptor_pool, VALUE ptr)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1040
upb_oneof_next
void upb_oneof_next(upb_oneof_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3714
upb_filedef_name
const char * upb_filedef_name(const upb_filedef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4496
upb_status_errmsg
const char * upb_status_errmsg(const upb_status *status)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2204
ruby_to_DescriptorPool
static DescriptorPool * ruby_to_DescriptorPool(VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:103
upb_oneof_begin
void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3710
upb_enum_iter_number
int32_t upb_enum_iter_number(upb_enum_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3293
upb_inttable_iter
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:1113
ruby_to_EnumDescriptor
static EnumDescriptor * ruby_to_EnumDescriptor(VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1013
build_module_from_enumdesc
VALUE build_module_from_enumdesc(VALUE _enumdesc)
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/message.c:798
protobuf.h
FieldDescriptor_default
static VALUE FieldDescriptor_default(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:669
DescriptorPool_register
static void DescriptorPool_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:204
upb_fielddef_number
uint32_t upb_fielddef_number(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3351
Descriptor_GetMsgDef
const upb_msgdef * Descriptor_GetMsgDef(VALUE desc_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1222
def
int def(FILE *source, FILE *dest, int level)
Definition: bloaty/third_party/zlib/examples/zpipe.c:36
upb_enumdef_iton
const char * upb_enumdef_iton(const upb_enumdef *def, int32_t num)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3283
upb_symtab
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3018
number
int32_t number
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:850
FileDescriptor_type
static const rb_data_type_t FileDescriptor_type
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:434
upb_filedef_symtab
const upb_symtab * upb_filedef_symtab(const upb_filedef *f)
Definition: php-upb.c:5646
DescriptorPool::def_to_descriptor
VALUE def_to_descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:111
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
google::protobuf::uint64
uint64_t uint64
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/stubs/port.h:156
Message_GetMutable
upb_msg * Message_GetMutable(VALUE msg_rb, const upb_msgdef **m)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:98
FieldDescriptor__type
static VALUE FieldDescriptor__type(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:658
OneofDescriptor_type
static const rb_data_type_t OneofDescriptor_type
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:899
get_enumdef_obj
static VALUE get_enumdef_obj(VALUE descriptor_pool, const upb_enumdef *def)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1191
get_filedef_obj
static VALUE get_filedef_obj(VALUE descriptor_pool, const upb_filedef *def)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1199
upb_msgdef_ntooz
const UPB_INLINE upb_oneofdef * upb_msgdef_ntooz(const upb_msgdef *m, const char *name)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:3345
upb_fielddef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2934
ObjectCache_Add
void ObjectCache_Add(const void *key, VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:383
performance.bq_upload_result.required
required
Definition: bq_upload_result.py:299
EnumDescriptor_lookup_name
static VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1085
upb_filedef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3000
upb_fielddef_containingtype
const upb_msgdef * upb_fielddef_containingtype(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3414
EnumDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:143
get_fielddef_obj
static VALUE get_fielddef_obj(VALUE descriptor_pool, const upb_fielddef *def)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1195
upb_enum_begin
void upb_enum_begin(upb_enum_iter *i, const upb_enumdef *e)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3265
upb_msg_iter_oneof
const upb_oneofdef * upb_msg_iter_oneof(const upb_msg_oneof_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3666
DescriptorPool_lookup
static VALUE DescriptorPool_lookup(VALUE _self, VALUE name)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:172
cTypeError
VALUE cTypeError
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.c:35
FieldDescriptor_number
static VALUE FieldDescriptor_number(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:726
EnumDescriptor_GetEnumDef
const upb_enumdef * EnumDescriptor_GetEnumDef(VALUE enum_desc_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1029
EnumDescriptor_register
static void EnumDescriptor_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1150
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
upb_fielddef_default
upb_msgval upb_fielddef_default(const upb_fielddef *f)
Definition: php-upb.c:5220
upb_enum_next
void upb_enum_next(upb_enum_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3270
OneofDescriptor_alloc
static VALUE OneofDescriptor_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:918
FileDescriptor_mark
static void FileDescriptor_mark(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:429
OneofDescriptor
struct OneofDescriptor OneofDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:58
upb_symtab_lookupenum
const upb_enumdef * upb_symtab_lookupenum(const upb_symtab *s, const char *sym)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4578
value
const char * value
Definition: hpack_parser_table.cc:165
symtab
upb_symtab * symtab
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:774
TypeInfo_get
static TypeInfo TypeInfo_get(const upb_fielddef *f)
Definition: defs.h:61
upb_descriptortype_t
upb_descriptortype_t
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:498
Defs_register
void Defs_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1274
EnumDescriptor_mark
static void EnumDescriptor_mark(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1001
cDescriptorPool
VALUE cDescriptorPool
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:80
upb_msgval
Definition: php-upb.h:4612
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
Message_getfield
VALUE Message_getfield(VALUE _self, const upb_fielddef *f)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:294
key
const char * key
Definition: hpack_parser_table.cc:164
upload.group
group
Definition: bloaty/third_party/googletest/googlemock/scripts/upload.py:397
FieldDescriptor_alloc
static VALUE FieldDescriptor_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:553
bytes
uint8 bytes[10]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:153
ruby_to_fieldtype
upb_fieldtype_t ruby_to_fieldtype(VALUE type)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:593
upb_enumdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2984
ruby_to_FieldDescriptor
static FieldDescriptor * ruby_to_FieldDescriptor(VALUE val)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:540
Message_Get
const upb_msg * Message_Get(VALUE msg_rb, const upb_msgdef **m)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:92
OneofDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:138
upb_fielddef_haspresence
bool upb_fielddef_haspresence(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3512
Message_CheckClass
void Message_CheckClass(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:115
ALLOC
#define ALLOC(class_name)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1486
upb_msg_field_begin
void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3622
upb_msg_clearfield
void upb_msg_clearfield(upb_msg *msg, const upb_fielddef *f)
Definition: php-upb.c:7145
upb_fielddef_enumsubdef
const upb_enumdef * upb_fielddef_enumsubdef(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3481
upb_oneofdef_name
const char * upb_oneofdef_name(const upb_oneofdef *o)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3681
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
google_protobuf_FileDescriptorProto_parse
UPB_INLINE google_protobuf_FileDescriptorProto * google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size, upb_Arena *arena)
Definition: descriptor.upb.h:223
FieldDescriptor_json_name
static VALUE FieldDescriptor_json_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:688
upb_fielddef_descriptortype
upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3339
descriptor_database_test_wrapper.module
module
Definition: descriptor_database_test_wrapper.py:30
msgdef
const upb_msgdef * msgdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:808
FieldDescriptor_label
static VALUE FieldDescriptor_label(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:704
cDescriptor
VALUE cDescriptor
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:230
enumdef
const upb_enumdef * enumdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:839
Message_GetArena
VALUE Message_GetArena(VALUE msg_rb)
Definition: protobuf/ruby/ext/google/protobuf_c/message.c:110
Descriptor_register
static void Descriptor_register(VALUE module)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:401
UPB_SYNTAX_PROTO3
@ UPB_SYNTAX_PROTO3
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:2973
desc
#define desc
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:338
DescriptorPool_alloc
static VALUE DescriptorPool_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:121
FieldDescriptor_set
static VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:845
descriptortype_to_ruby
static VALUE descriptortype_to_ruby(upb_descriptortype_t type)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:621
UPB_TYPE_MESSAGE
@ UPB_TYPE_MESSAGE
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:483
make_dist_html.GROUP
string GROUP
Definition: make_dist_html.py:52
cOneofDescriptor
static VALUE cOneofDescriptor
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:892
FieldDescriptor_initialize
static VALUE FieldDescriptor_initialize(VALUE _self, VALUE cookie, VALUE descriptor_pool, VALUE ptr)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:566
FileDescriptor
struct FileDescriptor FileDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:56
pool
InternalDescriptorPool * pool
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:807
TYPE
#define TYPE(u, l)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:8202
upb_msg_oneof_next
void upb_msg_oneof_next(upb_msg_oneof_iter *iter)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3654
DescriptorPool_add_serialized_file
VALUE DescriptorPool_add_serialized_file(VALUE _self, VALUE serialized_file_proto)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:141
cFileDescriptor
static VALUE cFileDescriptor
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:427
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
Arena_new
VALUE Arena_new()
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:217
Descriptor_msgclass
static VALUE Descriptor_msgclass(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:393
grpc::protobuf::Descriptor
GRPC_CUSTOM_DESCRIPTOR Descriptor
Definition: include/grpcpp/impl/codegen/config_protobuf.h:81
Descriptor_name
static VALUE Descriptor_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:307
upb_strtable_iter
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:1086
fielddef
const upb_fielddef * fielddef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:825
EnumDescriptor_each
static VALUE EnumDescriptor_each(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1121
self
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/map.c:543
regress.m
m
Definition: regress/regress.py:25
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
upb_fielddef_isseq
bool upb_fielddef_isseq(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3495
CONVERT
#define CONVERT(upb, ruby)
DescriptorPool
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:110
Descriptor_type
static const rb_data_type_t Descriptor_type
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:238
convert.h
OneofDescriptor_each
static VALUE OneofDescriptor_each(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:964
DescriptorPool_generated_pool
static VALUE DescriptorPool_generated_pool(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:200
klass
zend_class_entry * klass
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:810
google_protobuf_FileDescriptorProto
struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto
Definition: descriptor.upb.h:51
Descriptor_file_descriptor
static VALUE Descriptor_file_descriptor(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:295
FieldDescriptor_subtype
static VALUE FieldDescriptor_subtype(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:763
ObjectCache_Get
VALUE ObjectCache_Get(const void *key)
Definition: protobuf/ruby/ext/google/protobuf_c/protobuf.c:397
EnumDescriptor_enummodule
static VALUE EnumDescriptor_enummodule(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1142
upb_symtab_lookupmsg
const upb_msgdef * upb_symtab_lookupmsg(const upb_symtab *s, const char *sym)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:4565
rb_str_maybe_null
static VALUE rb_str_maybe_null(const char *s)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:64
repeated
static grpc_slice repeated(char c, size_t length)
Definition: message_compress_test.cc:109
EnumDescriptor_alloc
static VALUE EnumDescriptor_alloc(VALUE klass)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1019
errno.h
upb_msgdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:2962
upb_msgdef_ntofz
const UPB_INLINE upb_fielddef * upb_msgdef_ntofz(const upb_msgdef *m, const char *name)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.h:3350
upb_fielddef_name
const char * upb_fielddef_name(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3367
upb_fielddef_type
upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:3304
FileDescriptor_name
static VALUE FileDescriptor_name(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:482
generated_pool
VALUE generated_pool
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:84
FileDescriptor_initialize
static VALUE FileDescriptor_initialize(VALUE _self, VALUE cookie, VALUE descriptor_pool, VALUE ptr)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:461
cFieldDescriptor
static VALUE cFieldDescriptor
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:527
Descriptor_mark
static void Descriptor_mark(void *_self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:232
Descriptor_each_oneof
static VALUE Descriptor_each_oneof(VALUE _self)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:356
message.h
get_oneofdef_obj
static VALUE get_oneofdef_obj(VALUE descriptor_pool, const upb_oneofdef *def)
Definition: protobuf/ruby/ext/google/protobuf_c/defs.c:1203


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:09