Lines Matching defs:name
15 // * Neither the name of Google Inc. nor the names of its
158 static void remove_path(upb_strview *name) {
159 const char* last = strrchr(name->data, '.');
161 size_t remove = last - name->data + 1;
162 name->data += remove;
163 name->size -= remove;
193 upb_strview name;
196 name = google_protobuf_DescriptorProto_name(msg_msgs[i]);
197 remove_path(&name);
198 google_protobuf_DescriptorProto_set_name(msg_msgs[i], name);
223 * name: "test.proto"
226 * name: "Bar"
228 * name: "Baz"
244 * above descriptor. We need to infer that "foo" is the package name, and not
271 upb_strview name = google_protobuf_DescriptorProto_name(msgs[i]);
272 rb_ary_push(msg_names, rb_str_new(name.data, name.size));
278 upb_strview name = google_protobuf_EnumDescriptorProto_name(enums[i]);
279 rb_ary_push(enum_names, rb_str_new(name.data, name.size));
283 // Call Ruby code to calculate package name and nesting.
301 upb_strview name = google_protobuf_DescriptorProto_name(msgs[i]);
302 remove_path(&name);
303 google_protobuf_DescriptorProto_set_name(msgs[i], name);
307 upb_strview name = google_protobuf_EnumDescriptorProto_name(enums[i]);
308 remove_path(&name);
309 google_protobuf_EnumDescriptorProto_set_name(enums[i], name);
341 #define DEFINE_CLASS(name, string_name) \
342 VALUE c ## name = Qnil; \
343 const rb_data_type_t _ ## name ## _type = { \
345 { name ## _mark, name ## _free, NULL }, \
347 name* ruby_to_ ## name(VALUE val) { \
348 name* ret; \
349 TypedData_Get_Struct(val, name, &_ ## name ## _type, ret); \
443 * DescriptorPool.lookup(name) => descriptor
445 * Finds a Descriptor or EnumDescriptor by name and returns it, or nil if none
446 * exists with the given name.
448 VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
450 const char* name_str = get_str(name);
507 * Creates a new, empty, message type descriptor. At a minimum, its name must be
532 rb_define_method(klass, "name", Descriptor_name, 0);
573 * Descriptor.name => name
575 * Returns the name of this message type as a fully-qualified string (e.g.,
605 * Descriptor.lookup(name) => FieldDescriptor
607 * Returns the field descriptor for the field with the given name, if present,
610 VALUE Descriptor_lookup(VALUE _self, VALUE name) {
612 const char* s = get_str(name);
643 * Descriptor.lookup_oneof(name) => OneofDescriptor
645 * Returns the oneof descriptor for the oneof with the given name, if present,
648 VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name) {
650 const char* s = get_str(name);
722 rb_define_method(klass, "name", FileDescriptor_name, 0);
730 * FileDescriptor.name => name
732 * Returns the name of the file.
736 const char* name = upb_filedef_name(self->filedef);
737 return name == NULL ? Qnil : rb_str_new2(name);
778 * Returns a new field descriptor. Its name, type, etc. must be set before it is
793 rb_define_method(klass, "name", FieldDescriptor_name, 0);
831 * FieldDescriptor.name => name
833 * Returns the name of this field.
1039 * Returns the name of the message or enum type corresponding to this field, if
1041 * name will be resolved within the context of the pool to which the containing
1190 rb_define_method(klass, "name", OneofDescriptor_name, 0);
1220 * OneofDescriptor.name => name
1222 * Returns the name of this oneof.
1299 rb_define_method(klass, "name", EnumDescriptor_name, 0);
1324 * EnumDescriptor.name => name
1326 * Returns the name of this enum type.
1335 * EnumDescriptor.lookup_name(name) => value
1337 * Returns the numeric value corresponding to the given key name (as a Ruby
1340 VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name) {
1342 const char* name_str= rb_id2name(SYM2ID(name));
1353 * EnumDescriptor.lookup_value(name) => value
1355 * Returns the key name (as a Ruby symbol) corresponding to the integer value,
1361 const char* name = upb_enumdef_iton(self->enumdef, val);
1362 if (name != NULL) {
1363 return ID2SYM(rb_intern(name));
1448 * MessageBuilderContext.new(file_builder, name) => context
1456 VALUE name) {
1466 self->msg_proto, FileBuilderContext_strdup(_file_builder, name));
1471 static void msgdef_add_field(VALUE msgbuilder_rb, upb_label_t label, VALUE name,
1484 Check_Type(name, T_SYMBOL);
1485 name_str = rb_id2str(SYM2ID(name));
1501 // Make it an absolute type name by prepending a dot.
1561 * MessageBuilderContext.optional(name, type, number, type_class = nil,
1570 VALUE name, type, number;
1573 rb_scan_args(argc, argv, "32", &name, &type, &number, &type_class, &options);
1575 // Allow passing (name, type, number, options) or
1576 // (name, type, number, type_class, options)
1582 msgdef_add_field(_self, UPB_LABEL_OPTIONAL, name, type, number, type_class,
1590 * MessageBuilderContext.proto3_optional(name, type, number,
1601 VALUE name, type, number;
1604 rb_scan_args(argc, argv, "32", &name, &type, &number, &type_class, &options);
1606 // Allow passing (name, type, number, options) or
1607 // (name, type, number, type_class, options)
1613 msgdef_add_field(_self, UPB_LABEL_OPTIONAL, name, type, number, type_class,
1621 * MessageBuilderContext.required(name, type, number, type_class = nil,
1634 VALUE name, type, number;
1637 rb_scan_args(argc, argv, "32", &name, &type, &number, &type_class, &options);
1639 // Allow passing (name, type, number, options) or
1640 // (name, type, number, type_class, options)
1646 msgdef_add_field(_self, UPB_LABEL_REQUIRED, name, type, number, type_class,
1654 * MessageBuilderContext.repeated(name, type, number, type_class = nil)
1662 VALUE name, type, number, type_class;
1667 name = argv[0];
1672 msgdef_add_field(_self, UPB_LABEL_REPEATED, name, type, number, type_class,
1680 * MessageBuilderContext.map(name, key_type, value_type, number,
1692 VALUE name, key_type, value_type, number, type_class;
1700 name = argv[0];
1734 rb_str_cat2(mapentry_desc_name, rb_id2name(SYM2ID(name)));
1753 // repeated MapEntry <name> = <number>;
1754 rb_funcall(_self, rb_intern("repeated"), 4, name,
1762 * MessageBuilderContext.oneof(name, &block) => nil
1764 * Creates a new OneofDescriptor with the given name, creates a
1771 VALUE MessageBuilderContext_oneof(VALUE _self, VALUE name) {
1781 // Create oneof_proto and set its name.
1785 oneof_proto, FileBuilderContext_strdup_sym(self->file_builder, name));
1814 upb_strview name = google_protobuf_FieldDescriptorProto_name(fields[i]);
1815 rb_hash_aset(names, rb_str_new(name.data, name.size), Qtrue);
1818 upb_strview name = google_protobuf_OneofDescriptorProto_name(oneofs[i]);
1819 rb_hash_aset(names, rb_str_new(name.data, name.size), Qtrue);
1903 * OneofBuilderContext.optional(name, type, number, type_class = nil,
1913 VALUE name, type, number;
1916 rb_scan_args(argc, argv, "32", &name, &type, &number, &type_class, &options);
1918 msgdef_add_field(self->message_builder, UPB_LABEL_OPTIONAL, name, type,
1967 VALUE name) {
1977 self->enum_proto, FileBuilderContext_strdup(_file_builder, name));
1984 * EnumBuilder.add_value(name, number)
1986 * Adds the given name => number mapping to the enum type. Name must be a Ruby
1989 VALUE EnumBuilderContext_value(VALUE _self, VALUE name, VALUE number) {
1999 enum_value, FileBuilderContext_strdup_sym(self->file_builder, name));
2076 VALUE name, VALUE options) {
2081 self->file_proto, FileBuilderContext_strdup(_self, name));
2109 * FileBuilderContext.add_message(name, &block)
2111 * Creates a new, empty descriptor with the given name, and invokes the block in
2118 VALUE FileBuilderContext_add_message(VALUE _self, VALUE name) {
2119 VALUE args[2] = { _self, name };
2129 * FileBuilderContext.add_enum(name, &block)
2131 * Creates a new, empty enum descriptor with the given name, and invokes the
2137 VALUE FileBuilderContext_add_enum(VALUE _self, VALUE name) {
2138 VALUE args[2] = { _self, name };
2213 * Builder.add_file(name, options = nil, &block)
2215 * Creates a new, file descriptor with the given name and options and invokes
2224 VALUE name, options;
2228 rb_scan_args(argc, argv, "11", &name, &options);
2231 VALUE args[3] = { self->descriptor_pool, name, options };
2247 VALUE name = rb_str_new2("ruby_default_file.proto");
2248 VALUE args [3] = { self->descriptor_pool, name, rb_hash_new() };
2258 * Builder.add_message(name, &block)
2267 VALUE Builder_add_message(VALUE _self, VALUE name) {
2269 rb_funcall_with_block(file_builder, rb_intern("add_message"), 1, &name,
2276 * Builder.add_enum(name, &block)
2286 VALUE Builder_add_enum(VALUE _self, VALUE name) {
2288 rb_funcall_with_block(file_builder, rb_intern("add_enum"), 1, &name,