Class: GL::Registry::Argument
- Defined in:
- lib/opengl/registry/argument.rb
Overview
Describes an individual argument of an OpenGL function.
Instance Attribute Summary collapse
-
#length ⇒ String?
readonly
A hint for any length constraints of an argument, such as a C-style array,.
-
#name ⇒ String
readonly
The name of the argument.
-
#type ⇒ NativeType
readonly
The type of the argument.
Attributes inherited from Token
Instance Method Summary collapse
-
#initialize(node) ⇒ Argument
constructor
Creates a new instance of the Argument class.
Methods inherited from Token
Constructor Details
#initialize(node) ⇒ Argument
Creates a new instance of the GL::Registry::Argument class.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/opengl/registry/argument.rb', line 25 def initialize(node) super(node) base = nil buffer = '' node.nodes.each do |child| # Don't care about comments next if child.is_a?(Ox::Comment) # Raw text if child.is_a?(String) buffer << child next end # Child node case child.name when Words::PTYPE base = child.text buffer << base when Words::NAME @name = child.text else next end end @length = node[Words::LENGTH] group = node[Words::GROUP] @type = NativeType.new(buffer, base, group) end |
Instance Attribute Details
#length ⇒ String? (readonly)
Note:
This may be a numerical value, reference to another "count" argument, etc.
Returns a hint for any length constraints of an argument, such as a C-style array,.
19 20 21 |
# File 'lib/opengl/registry/argument.rb', line 19 def length @length end |
#name ⇒ String (readonly)
Returns the name of the argument.
10 11 12 |
# File 'lib/opengl/registry/argument.rb', line 10 def name @name end |
#type ⇒ NativeType (readonly)
Returns the type of the argument.
14 15 16 |
# File 'lib/opengl/registry/argument.rb', line 14 def type @type end |