diff --git a/src/andrew.cr b/src/andrew.cr index 45b8dc4..c691c84 100644 --- a/src/andrew.cr +++ b/src/andrew.cr @@ -63,7 +63,10 @@ end class BitfieldGenerator YAML.mapping( - class_name: String, + class_name: { + type: String, + default: "no_class" + }, name: String, out_type: String, start: Int32, @@ -77,7 +80,10 @@ end class AttributeGenerator YAML.mapping( - class_name: String, + class_name: { + type: String, + default: "no_class" + }, name: String, out_type: String, start: Int32 @@ -92,7 +98,10 @@ end class RepeatGenerator YAML.mapping( - class_name: String, + class_name: { + type: String, + default: "no_class" + }, name: String, out_type: String, start: Int32, @@ -105,7 +114,10 @@ end class AttributeAfterGenerator YAML.mapping( - class_name: String, + class_name: { + type: String, + default: "no_class" + }, name: String, out_type: String, start: Int32, diff --git a/src/views/class.ecr b/src/views/class.ecr index 626e068..7d706a5 100644 --- a/src/views/class.ecr +++ b/src/views/class.ecr @@ -3,7 +3,7 @@ class <%= @name %> { virtual <%= @name %>() = 0; <% if !(@attributes.nil?) %> <%- @attributes.not_nil!.each do |attr| -%> - +<%- attr.class_name = @name -%> <%= attr.to_s %> <%- end -%> diff --git a/tests/record.yml b/tests/record.yml index 264d5b1..1494495 100644 --- a/tests/record.yml +++ b/tests/record.yml @@ -9,20 +9,14 @@ classes: name: uuid out_type: std::array start: 0 - class_name: record_identifier - name: x out_type: bitops::regulated start: 16 - class_name: record_identifier - name: y out_type: bitops::regulated start: 20 - class_name: record_identifier - bitfields: [] - repeats: [] - attributeafters: [] - name: record attributes: @@ -30,19 +24,15 @@ classes: name: record_id out_type: std::array start: 0 - class_name: record - name: timestamp out_type: bitops::regulated start: 24 - class_name: record - name: offset out_type: bitops::regulated start: 32 - class_name: record - name: flags out_type: bitops::regulated - start: 40 - class_name: record \ No newline at end of file + start: 40 \ No newline at end of file