Class: GL::Registry::Function

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

Overview

Describes 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) ⇒ Function

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

Parameters:

  • node (Ox::Element)

    The XML element defining the instance.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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

Instance Attribute Details

#alias_nameString? (readonly)

Returns an alternative name associated with this function.

Returns:

  • (String?)

    an alternative name associated with this function.



22
23
24
# File 'lib/opengl/registry/function.rb', line 22

def alias_name
  @alias_name
end

#argumentsArray<Argument> (readonly)

Returns an array of arguments for this function.

Returns:

  • (Array<Argument>)

    an array of arguments for this function.



18
19
20
# File 'lib/opengl/registry/function.rb', line 18

def arguments
  @arguments
end

#nameString (readonly)

Returns the name of the function.

Returns:

  • (String)

    the name of the function.



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

def name
  @name
end

#typeNativeType (readonly)

Returns the return type of function.

Returns:



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

def type
  @type
end

#vec_equivString? (readonly)

Returns a "vector equivalent" version of this function that does not use separate parameters.

Returns:

  • (String?)

    a "vector equivalent" version of this function that does not use separate parameters.



26
27
28
# File 'lib/opengl/registry/function.rb', line 26

def vec_equiv
  @vec_equiv
end