class GL::Registry::Argument

Describes an individual argument of an OpenGL function.

Attributes

length[R]

@return [String?] a hint for any length constraints of an argument, such as a C-style array, @note This may be a numerical value, reference to another “count” argument, etc.

name[R]

@return [String] the name of the argument

type[R]

@return [NativeType] the type of the argument.

Public Class Methods

new(node) click to toggle source

Creates a new instance of the {Argument} class.

@param node [Ox::Element] The XML element defining the instance.

Calls superclass method
# 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