Class: GL::Registry::Argument

Inherits:
Token
  • Object
show all
Defined in:
lib/opengl/registry/argument.rb

Overview

Describes an individual argument of an OpenGL function.

Instance Attribute Summary collapse

Attributes inherited from Token

#comment

Instance Method Summary collapse

Methods inherited from Token

#to_s

Constructor Details

#initialize(node) ⇒ Argument

Creates a new instance of the GL::Registry::Argument class.

Parameters:

  • node (Ox::Element)

    The XML element defining the instance.



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

#lengthString? (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,.

Returns:

  • (String?)

    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

#nameString (readonly)

Returns the name of the argument.

Returns:

  • (String)

    the name of the argument



10
11
12
# File 'lib/opengl/registry/argument.rb', line 10

def name
  @name
end

#typeNativeType (readonly)

Returns the type of the argument.

Returns:



14
15
16
# File 'lib/opengl/registry/argument.rb', line 14

def type
  @type
end