class GL::Registry::Group

Describes a logical grouping of enumerated values.

Attributes

members[R]

@return [Array<Enum>] an array of enum values that are associated with this group.

name[R]

@return [String?] the name of this grouping. @note Not all groups are named, and this value may be `nil`.

namespace[R]

@return [String] the namespace this group belongs within.

range[R]

@return [Range?] an end-inclusive range of values this group covers.

vendor[R]

@return [String?] the name of the vendor that defines this value.

Public Class Methods

new(node) click to toggle source

Creates a new instance of the {Group} class.

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

Calls superclass method
# File lib/opengl/registry/group.rb, line 33
def initialize(node)
  super(node)

  @namespace = node[Words::NAMESPACE]
  @name = node[Words::GROUP]
  type = node[Words::TYPE]
  @bitmask = type && type == Words::BITMASK
  @vendor = node[Words::VENDOR]

  first = node[Words::RANGE_START]
  if first
    last = node[Words::RANGE_END]
    @range = Range.new(first.hex, last.hex, false) if last
  end

  @members = []
  node.locate('enum').each do |enum|
    next unless enum.is_a?(Ox::Element)
    @members << Enum.new(enum)
  end
end

Public Instance Methods

bitmask?() click to toggle source

@return [Boolean] `true` if group members are flags that can be bitwise OR'ed together, otherwise `false`.

# File lib/opengl/registry/group.rb, line 57
def bitmask?
  @bitmask
end