Lines Matching defs:name

3027   /* Tables for looking up fields by number and name. */
3061 const char *name;
3120 static bool upb_isident(upb_strview name, bool full, upb_status *s) {
3121 const char *str = name.data;
3122 size_t len = name.size;
3129 upb_status_seterrf(s, "invalid name: unexpected '.' (%s)", str);
3136 s, "invalid name: path components must start with a letter (%s)",
3143 upb_status_seterrf(s, "invalid name: non-alphanumeric character (%s)",
3158 /* No '.' in the name, return the full string. */
3291 const char *name = upb_msgdef_fullname(m);
3292 if (name == NULL) {
3296 if (!strcmp(name, "google.protobuf.Any")) {
3298 } else if (!strcmp(name, "google.protobuf.FieldMask")) {
3300 } else if (!strcmp(name, "google.protobuf.Duration")) {
3302 } else if (!strcmp(name, "google.protobuf.Timestamp")) {
3304 } else if (!strcmp(name, "google.protobuf.DoubleValue")) {
3306 } else if (!strcmp(name, "google.protobuf.FloatValue")) {
3308 } else if (!strcmp(name, "google.protobuf.Int64Value")) {
3310 } else if (!strcmp(name, "google.protobuf.UInt64Value")) {
3312 } else if (!strcmp(name, "google.protobuf.Int32Value")) {
3314 } else if (!strcmp(name, "google.protobuf.UInt32Value")) {
3316 } else if (!strcmp(name, "google.protobuf.BoolValue")) {
3318 } else if (!strcmp(name, "google.protobuf.StringValue")) {
3320 } else if (!strcmp(name, "google.protobuf.BytesValue")) {
3322 } else if (!strcmp(name, "google.protobuf.Value")) {
3324 } else if (!strcmp(name, "google.protobuf.ListValue")) {
3326 } else if (!strcmp(name, "google.protobuf.Struct")) {
3365 bool upb_enumdef_ntoi(const upb_enumdef *def, const char *name,
3368 if (!upb_strtable_lookup2(&def->ntoi, name, len, &v)) {
3632 const upb_fielddef *upb_msgdef_ntof(const upb_msgdef *m, const char *name,
3636 if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
3643 const upb_oneofdef *upb_msgdef_ntoo(const upb_msgdef *m, const char *name,
3647 if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
3654 bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len,
3658 if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
3664 return *o || *f; /* False if this was a JSON name. */
3668 const char *name, size_t len) {
3672 if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
3803 const char *name, size_t length) {
3805 return upb_strtable_lookup2(&o->ntof, name, length, &val) ?
4086 upb_strview name) {
4088 /* ret = prefix + '.' + name; */
4090 char *ret = upb_malloc(ctx->alloc, n + name.size + 2);
4094 memcpy(&ret[n + 1], name.data, name.size);
4095 ret[n + 1 + name.size] = '\0';
4098 return strviewdup(ctx, name);
4102 size_t getjsonname(const char *name, char *buf, size_t len) {
4111 if (!name) {
4120 for (src = 0; name[src]; src++) {
4121 if (name[src] == '_') {
4127 WRITE(toupper(name[src]));
4130 WRITE(name[src]);
4140 static char* makejsonname(const char* name, upb_alloc *alloc) {
4141 size_t size = getjsonname(name, NULL, 0);
4143 getjsonname(name, json_name, size);
4147 static bool symtab_add(const symtab_addctx *ctx, const char *name,
4150 if (upb_strtable_lookup(ctx->addtab, name, &tmp) ||
4151 upb_strtable_lookup(&ctx->symtab->syms, name, &tmp)) {
4152 upb_status_seterrf(ctx->status, "duplicate symbol '%s'", name);
4156 CHK_OOM(upb_strtable_insert3(ctx->addtab, name, strlen(name), v, ctx->tmp));
4179 "type mismatch when resolving field %s, name %s",
4201 upb_status_seterrf(ctx->status, "couldn't resolve name '%s'", sym.data);
4212 upb_strview name = google_protobuf_OneofDescriptorProto_name(oneof_proto);
4217 o->full_name = makefullname(ctx, m->full_name, name);
4221 CHK_OOM(upb_strtable_insert3(&m->ntof, name.data, name.size, v, ctx->alloc));
4358 upb_strview name;
4365 upb_status_seterrmsg(ctx->status, "field has no name");
4369 name = google_protobuf_FieldDescriptorProto_name(field_proto);
4370 CHK(upb_isident(name, false, ctx->status));
4371 full_name = makefullname(ctx, prefix, name);
4398 upb_status_seterrf(ctx->status, "duplicate field name (%s)", shortname);
4419 upb_strtable_insert3(&m->ntof, name.data, name.size, field_v, alloc));
4498 CHK(upb_strtable_insert3(&oneof->ntof, name.data, name.size, v, alloc));
4520 upb_strview name;
4523 name = google_protobuf_EnumDescriptorProto_name(enum_proto);
4524 CHK(upb_isident(name, false, ctx->status));
4527 e->full_name = makefullname(ctx, prefix, name);
4547 upb_strview name = google_protobuf_EnumValueDescriptorProto_name(value);
4548 char *name2 = strviewdup(ctx, name);
4588 upb_strview name;
4590 name = google_protobuf_DescriptorProto_name(msg_proto);
4591 CHK(upb_isident(name, false, ctx->status));
4594 m->full_name = makefullname(ctx, prefix, name);
4696 upb_strview name;
4707 name = google_protobuf_FieldDescriptorProto_extendee(field_proto);
4708 f->msgdef = symtab_resolve(ctx, f, prefix, name, UPB_DEFTYPE_MSG);
4714 upb_status_seterrf(ctx->status, "field '%s' is missing type name",
4719 name = google_protobuf_FieldDescriptorProto_type_name(field_proto);
4722 f->sub.msgdef = symtab_resolve(ctx, f, prefix, name, UPB_DEFTYPE_MSG);
4725 f->sub.enumdef = symtab_resolve(ctx, f, prefix, name, UPB_DEFTYPE_ENUM);
4791 upb_status_seterrmsg(ctx->status, "File has no name");
4795 file->name =
4908 CHK_OOM(upb_strtable_insert3(&s->files, file->name, strlen(file->name),
4924 return f->name;
5011 const upb_filedef *upb_symtab_lookupfile(const upb_symtab *s, const char *name) {
5013 return upb_strtable_lookup(&s->files, name, &v) ? upb_value_getconstptr(v)
5611 #define SETTER(name, handlerctype, handlertype) \
5612 bool upb_handlers_set##name(upb_handlers *h, const upb_fielddef *f, \
7611 #define PRIMITIVE_OP(type, wt, name, convfunc, ctype) \
7615 upb_sink_put ## name(d->top->sink, arg, (convfunc)(val)); \
8693 #define TYPE(name, ctype, fmt) \
8694 static bool textprinter_put ## name(void *closure, const void *handler_data, \
8779 const char *name = handler_data;
8781 putf(p, "%s {%c", name, p->single_line_ ? ' ' : '\n');
8843 const char *name =
8847 attr.handler_data = name;
9142 /* The table mapping json name to fielddef for this message. */
9536 * example, to look up a member name in a hash table, or to turn a string into
9635 * processing (field name lookup, string->number conversion, etc). */
10317 /* Resolve enum symbolic name to integer value. */
10806 * name, and we are reinterpreting it as some arbitrary key type. In
12271 const char *name;
12273 /* Add an entry for the JSON name. */
12274 name = upb_fielddef_jsonname(f);
12275 upb_strtable_insert3(&m->name_table, name, strlen(name), v, alloc);
12277 if (strcmp(name, upb_fielddef_name(f)) != 0) {
12278 /* Since the JSON name is different from the regular field name, add an
12279 * entry for the raw name (compliant proto3 JSON parsers must accept
12281 const char *name = upb_fielddef_name(f);
12282 upb_strtable_insert3(&m->name_table, name, strlen(name), v, alloc);
12378 /* Populate parser methods for all submessages, so the name tables will
12452 /* Convert fielddef name to JSON name and return as a string piece. */
12625 /* Print a map key given a field name. Called by scalar field handlers and by
13434 /* type_url's json name is "@type" */
13653 #define WRAPPER(wellknowntype, name) \
13655 printer_sethandlers_##name(closure, h); \
13674 #define TYPE(type, name, ctype) \
13677 upb_handlers_set##name(h, f, repeated_##ctype, &empty_attr); \
13679 upb_handlers_set##name(h, f, scalar_##ctype, &name_attr); \