Lines Matching refs:field
1030 def add_field(self, field): argument
1031 field.union_name = self.name
1032 field.rules = 'ONEOF'
1033 field.anonymous = self.anonymous
1034 self.fields.append(field)
1039 if field.pbtype == 'MSG_W_CB':
1148 for field in self.fields:
1149 if field.requires_custom_field_callback():
1171 for f in desc.field:
1179 field = Field(self.name, f, field_options)
1185 self.fields.append(field)
1187 self.oneofs[f.oneof_index].add_field(field)
1192 self.fields.append(field)
1194 if field.math_include_required:
1229 for index, field in enumerate(self.fields):
1236 msg_fields.append("%s %s" % (str(field), trailing_comment))
1264 for field in self.fields:
1265 parts.append(field.get_initializer(null_init))
1289 for field in self.all_fields():
1290 if field.tag == tag:
1291 return field
1308 while any(field.name == Field.macro_x_param for field in self.all_fields()):
1310 while any(field.name == Field.macro_a_param for field in self.all_fields()):
1338 for field in sorted_fields:
1339 if field.pbtype in ['MESSAGE', 'MSG_W_CB']:
1340 if field.rules == 'ONEOF':
1341 … result += "#define %s_%s_%s_MSGTYPE %s\n" % (self.name, field.union_name, field.name, field.ctype)
1343 result += "#define %s_%s_MSGTYPE %s\n" % (self.name, field.name, field.ctype)
1374 max_tag = max(field.tag for field in self.all_fields())
1376 max_arraysize = max((field.max_count or 0) for field in self.all_fields())
1377 max_datasize = max(field.data_size(dependencies) for field in self.all_fields())
1402 for field in self.fields:
1403 fsize = field.encoded_size(dependencies)
1424 for field in reversed(list(optional_only.field)):
1425 field.ClearField(str('extendee'))
1426 parsed_field = self.field_for_tag(field.number)
1428 optional_only.field.remove(field)
1429 elif (field.label == FieldD.LABEL_REPEATED or
1430 field.type == FieldD.TYPE_MESSAGE):
1431 optional_only.field.remove(field)
1432 elif hasattr(field, 'oneof_index') and field.HasField('oneof_index'):
1433 optional_only.field.remove(field)
1434 elif field.type == FieldD.TYPE_ENUM:
1437 enumname = names_from_type_name(field.type_name)
1444 if field.HasField('default_value'):
1445 defvals = [v for n,v in enumtype.values if n.parts[-1] == field.default_value]
1450 field.type = FieldD.TYPE_INT64
1451 field.default_value = str(defvals[0])
1452 field.ClearField(str('type_name'))
1454 optional_only.field.remove(field)
1455 elif not field.HasField('default_value'):
1456 optional_only.field.remove(field)
1458 if len(optional_only.field) == 0:
1468 for field in optional_only.field:
1469 if field.type == FieldD.TYPE_STRING:
1470 setattr(msg, field.name, field.default_value)
1471 elif field.type == FieldD.TYPE_BYTES:
1472 setattr(msg, field.name, codecs.escape_decode(field.default_value)[0])
1473 elif field.type in [FieldD.TYPE_FLOAT, FieldD.TYPE_DOUBLE]:
1474 setattr(msg, field.name, float(field.default_value))
1475 elif field.type == FieldD.TYPE_BOOL:
1476 setattr(msg, field.name, field.default_value == 'true')
1478 setattr(msg, field.name, int(field.default_value))
1644 for field in message.field:
1645 if field.type in (FieldD.TYPE_MESSAGE, FieldD.TYPE_ENUM):
1646 field.type_name = mangle_field_typename(field.type_name)
1678 for field in message.all_fields():
1679 if field.default in enum.value_longnames:
1680 idx = enum.value_longnames.index(field.default)
1681 field.default = enum.values[idx][0]
1687 for field in message.all_fields():
1688 if field.pbtype == 'ENUM' and field.ctype == enum.names:
1689 field.pbtype = 'UENUM'
1780 for field in msg.fields:
1781 yield field.tags()
1916 for field in msg.all_fields():
1917 if field.ctype == 'double':