class GL::Registry::Function
Describes an OpenGL function.
Attributes
alias_name[R]
@return [String?] an alternative name associated with this function.
arguments[R]
@return [Array<Argument>] an array of arguments for this function.
name[R]
@return [String] the name of the function.
type[R]
@return [NativeType] the return type of function.
vec_equiv[R]
@return [String?] a “vector equivalent” version of this function that does not use separate parameters.
Public Class Methods
new(node)
click to toggle source
Creates a new instance of the {Function} class.
@param node [Ox::Element] The XML element defining the instance.
Calls superclass method
# File lib/opengl/registry/function.rb, line 32 def initialize(node) super(node) @arguments = [] node.nodes.each do |child| case child.name when Words::PROTO parse_prototype(child) when Words::PARAM @arguments << Argument.new(child) when Words::ALIAS @alias_name = child[Words::NAME] when Words::VECTOR_EQUIVALENT @vec_equiv = child[Words::NAME] else next end end end
Private Instance Methods
parse_prototype(node)
click to toggle source
# File lib/opengl/registry/function.rb, line 55 def parse_prototype(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 group = node[Words::GROUP] @type = NativeType.new(buffer, base, group) end