Class: RMasm::Struct::Field
Overview
Field inside a struct
Instance Attribute Summary collapse
-
#array_size ⇒ Object
readonly
Returns the value of attribute array_size.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, name, array_size = nil) ⇒ Field
constructor
A new instance of Field.
- #sizeof ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type, name, array_size = nil) ⇒ Field
Returns a new instance of Field.
153 154 155 156 157 158 |
# File 'lib/rmasm/struct.rb', line 153 def initialize(type, name, array_size = nil) @type = type @array_size = array_size @name = name @offset = 0 end |
Instance Attribute Details
#array_size ⇒ Object (readonly)
Returns the value of attribute array_size.
151 152 153 |
# File 'lib/rmasm/struct.rb', line 151 def array_size @array_size end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
151 152 153 |
# File 'lib/rmasm/struct.rb', line 151 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
150 151 152 |
# File 'lib/rmasm/struct.rb', line 150 def offset @offset end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
151 152 153 |
# File 'lib/rmasm/struct.rb', line 151 def type @type end |
Instance Method Details
#sizeof ⇒ Object
160 161 162 163 |
# File 'lib/rmasm/struct.rb', line 160 def sizeof() return (@array_size * @type.sizeof) if !@array_size.nil? @type.sizeof end |
#to_s ⇒ Object
165 166 167 |
# File 'lib/rmasm/struct.rb', line 165 def to_s() "Field type=[#{@type}] name=#{@name} size_of_field=#{sizeof} offset=#{@offset} array=#{@array_size}" end |