def __init__(self, name, subgroups, fields): self.name = name self.subgroups = subgroups self.fields = fields self.type_name = class_name(join_name('style', name, 'data')) self.member_name = class_member_name(join_name(name, 'data')) self.num_32_bit_words_for_bit_fields = _num_32_bit_words_for_bit_fields( field for field in fields if field.is_bit_field ) # Recursively get all the fields in the subgroups as well self.all_fields = _flatten_list(subgroup.all_fields for subgroup in subgroups) + fields
def __init__(self, name, subgroups, fields): self.name = name self.subgroups = subgroups self.fields = fields self.parent = None self.type_name = class_name(['style', name, 'data']) self.member_name = class_member_name([name, 'data']) self.num_32_bit_words_for_bit_fields = _num_32_bit_words_for_bit_fields( field for field in fields if field.is_bit_field) # Recursively get all the fields in the subgroups as well self.all_fields = _flatten_list(subgroup.all_fields for subgroup in subgroups) + fields # Ensure that all fields/subgroups on this group link to it for field in fields: field.group = self for subgroup in subgroups: subgroup.parent = self