Class: Depix::U8Field

Inherits:
Field
  • Object
show all
Defined in:
lib/depix/dict.rb

Constant Summary collapse

BLANK =
0xFF

Instance Attribute Summary

Attributes inherited from Field

#desc, #name, #req

Instance Method Summary collapse

Methods inherited from Field

#consume!, emit_char, emit_r32, emit_u16, emit_u32, emit_u8, #explain, #initialize, #pack

Constructor Details

This class inherits a constructor from Depix::Field

Instance Method Details

#clean(v) ⇒ Object



145
146
147
# File 'lib/depix/dict.rb', line 145

def clean(v)
  (v == BLANK || v == -1) ? nil : v
end

#lengthObject



137
138
139
# File 'lib/depix/dict.rb', line 137

def length
  1
end

#patternObject



133
134
135
# File 'lib/depix/dict.rb', line 133

def pattern
  "c"
end

#rtypeObject



141
142
143
# File 'lib/depix/dict.rb', line 141

def rtype
  Integer
end

#validate!(value) ⇒ Object



149
150
151
152
# File 'lib/depix/dict.rb', line 149

def validate!(value)
  super(value)
  raise "#{name} value #{value} out of bounds for 8 bit unsigned int".lstrip if (!value.nil? && (value < 0 || value >= BLANK))
end