Class: CType::Struct

Inherits:
StructUnion show all
Defined in:
lib/caphir/ctype.rb

Overview

StructUnion

Constant Summary collapse

@@structs =
{}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StructUnion

#add, #evaluate, get, #get_members, #keyword, #lookup, #to_def, #to_init_s, #to_s

Constructor Details

#initialize(name = nil) ⇒ Struct

Returns a new instance of Struct.



158
159
160
# File 'lib/caphir/ctype.rb', line 158

def initialize(name = nil)
	super
end

Class Method Details

.[](val = nil) ⇒ Object

factory method



144
145
146
147
148
149
150
151
152
153
# File 'lib/caphir/ctype.rb', line 144

def Struct.[](val = nil)
	# for unnamed structures
	return Struct.send(:new) unless val

	result = @@structs[val]
	unless result
		result = @@structs[val] = Struct.send(:new, val)
	end
	result
end