Class: CGenerator::Structure
- Inherits:
-
CFragment
- Object
- Accumulator
- Template
- CFragment
- CGenerator::Structure
- Defined in:
- lib/cgen/cgen.rb
Overview
A Structure instance keeps track of data members added to a struct.
declare :x => "int x"
Adds the specified string to define a structure member.
Defined Under Namespace
Classes: InheritAccumulator
Instance Attribute Summary
Attributes inherited from Accumulator
Instance Method Summary collapse
-
#initialize(name, parent, attribute = nil) ⇒ Structure
constructor
A new instance of Structure.
- #separator ⇒ Object
Methods inherited from Template
Methods inherited from Accumulator
#accept?, #add, #add_one, #add_one_really, #inspect, #inspect_one, #output, #output_one, #to_s
Constructor Details
#initialize(name, parent, attribute = nil) ⇒ Structure
Returns a new instance of Structure.
1979 1980 1981 1982 1983 1984 1985 1986 1987 |
# File 'lib/cgen/cgen.rb', line 1979 def initialize name, parent, attribute = nil super(name, parent) if attribute add "typedef struct #{name}", block!, "#{attribute} #{name}" else add "typedef struct #{name}", block!, name end block inherit!, declare! end |
Instance Method Details
#separator ⇒ Object
1989 |
# File 'lib/cgen/cgen.rb', line 1989 def separator; " "; end |