Selaa lähdekoodia

Made more stuff nilable

master
Ludovic 'Archivist' Lagouardette 5 vuotta sitten
vanhempi
commit
124f0f8f7b
3 muutettua tiedostoa jossa 18 lisäystä ja 16 poistoa
  1. +16
    -4
      src/andrew.cr
  2. +1
    -1
      src/views/class.ecr
  3. +1
    -11
      tests/record.yml

+ 16
- 4
src/andrew.cr Näytä tiedosto

@ -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,

+ 1
- 1
src/views/class.ecr Näytä tiedosto

@ -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 -%>

+ 1
- 11
tests/record.yml Näytä tiedosto

@ -9,20 +9,14 @@ classes:
name: uuid
out_type: std::array<unsigned char, 16>
start: 0
class_name: record_identifier
-
name: x
out_type: bitops::regulated<uint32_t>
start: 16
class_name: record_identifier
-
name: y
out_type: bitops::regulated<uint32_t>
start: 20
class_name: record_identifier
bitfields: []
repeats: []
attributeafters: []
-
name: record
attributes:
@ -30,19 +24,15 @@ classes:
name: record_id
out_type: std::array<unsigned char, 24>
start: 0
class_name: record
-
name: timestamp
out_type: bitops::regulated<uint64_t>
start: 24
class_name: record
-
name: offset
out_type: bitops::regulated<uint64_t>
start: 32
class_name: record
-
name: flags
out_type: bitops::regulated<uint32_t>
start: 40
class_name: record
start: 40

Ladataan…
Peruuta
Tallenna