Class: GL::Registry::Feature

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

Overview

Note:

This is a reference for the item only, and is only used to look up the corresponding item's definition.

Describes a single definition of a item to add/remove from an OpenGL API.

Instance Attribute Summary collapse

Attributes inherited from Token

#comment

Instance Method Summary collapse

Methods inherited from Token

#to_s

Constructor Details

#initialize(node, api, profile) ⇒ Feature

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

Parameters:

  • node (Ox::Element)

    The XML element defining the instance.

  • api (Symbol?)

    The OpenGL API this item is associated with.

  • profile (Symbol?)

    The OpenGL profile this item is associated with.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/opengl/registry/feature.rb', line 32

def initialize(node, api, profile)
  super(node)

  @name = node[Words::NAME]
  @api = api || :none
  @profile = profile || :none

  @type = case node.name
  when Words::ENUM then :enum
  when Words::COMMAND then :function
  when Words::TYPE then :type
  else :unknown
  end
end

Instance Attribute Details

#apiSymbol (readonly)

Returns the OpenGL API this item is associated with.

Returns:

  • (Symbol)

    the OpenGL API this item is associated with.



16
17
18
# File 'lib/opengl/registry/feature.rb', line 16

def api
  @api
end

#nameString (readonly)

Returns the name of the entity.

Returns:

  • (String)

    the name of the entity.



12
13
14
# File 'lib/opengl/registry/feature.rb', line 12

def name
  @name
end

#profileSymbol (readonly)

Returns the OpenGL profile this item is associated with.

Returns:

  • (Symbol)

    the OpenGL profile this item is associated with.



20
21
22
# File 'lib/opengl/registry/feature.rb', line 20

def profile
  @profile
end

#type:enum, ... (readonly)

Returns a symbol specifying the feature type.

Returns:

  • (:enum, :function, :type)

    a symbol specifying the feature type.



24
25
26
# File 'lib/opengl/registry/feature.rb', line 24

def type
  @type
end