Class: SFRP::Low::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/sfrp/low/set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Set



9
10
11
12
13
14
15
16
# File 'lib/sfrp/low/set.rb', line 9

def initialize(&block)
  @typedefs = []
  @structs = []
  @functions = []
  @macros = []
  @includes = []
  block.call(self) if block
end

Instance Attribute Details

#functionsObject (readonly)

Returns the value of attribute functions.



7
8
9
# File 'lib/sfrp/low/set.rb', line 7

def functions
  @functions
end

#includesObject (readonly)

Returns the value of attribute includes.



7
8
9
# File 'lib/sfrp/low/set.rb', line 7

def includes
  @includes
end

#macrosObject (readonly)

Returns the value of attribute macros.



7
8
9
# File 'lib/sfrp/low/set.rb', line 7

def macros
  @macros
end

#metaObject (readonly)

Returns the value of attribute meta.



7
8
9
# File 'lib/sfrp/low/set.rb', line 7

def meta
  @meta
end

#structsObject (readonly)

Returns the value of attribute structs.



7
8
9
# File 'lib/sfrp/low/set.rb', line 7

def structs
  @structs
end

#typedefsObject (readonly)

Returns the value of attribute typedefs.



7
8
9
# File 'lib/sfrp/low/set.rb', line 7

def typedefs
  @typedefs
end

Instance Method Details

#<<(element) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/sfrp/low/set.rb', line 24

def <<(element)
  case element
  when Typedef
    @typedefs << element
  when Structure
    @structs << element
  when Function
    @functions << element
  when Macro
    @macros << element
  when Include
    @includes << element
  else
    raise
  end
end

#to_outputObject



18
19
20
21
22
# File 'lib/sfrp/low/set.rb', line 18

def to_output
  Output::Set.new do |dest_set|
    dest_set.create_file('main', 'c', main_file_content)
  end
end