class GL::Registry::NativeType

Describes the native type for a return or parameter value.

Attributes

base[R]

@return [Symbol] the basic type, excluding any constant constraints, pointer symbols, etc. as a Symbol.

group[R]

@return [String?] a group that is associated with this type.

type[R]

@return [String] the full native type, including constant constraints, pointer symbols, etc. @note This is essentially the “raw” and fully-qualified type as it would appear in the C language.

Public Class Methods

new(type, base, group) click to toggle source

Creates a new instance fo the {NativeType} class.

@param type [String] The full native type, including constant constraints, pointer symbols, etc. @param base [String?] The basic type, excluding any constant constraints, pointer symbols, etc. @param group [String?] A group that is associated with this type.

# File lib/opengl/registry/native_type.rb, line 28
def initialize(type, base, group)
  @type = type.strip
  @base = base ? base.to_sym : :GLvoid
  @group = group
end

Public Instance Methods

const?() click to toggle source

@return [Boolean] `true` if value is a C-style pointer that can not be modified, otherwise `false`.

# File lib/opengl/registry/native_type.rb, line 42
def const?
  /^const /.match?(@type)
end
out?() click to toggle source

@return [Boolean] `true` if value is a C-style pointer that may be modified, otherwise `false`.

# File lib/opengl/registry/native_type.rb, line 48
def out?
  @type.include?('*') && !/\bconst\b/.match?(@type)
end
pointer?() click to toggle source

@return [Boolean] `true` if this a C-style pointer type, otherwise `false`.

# File lib/opengl/registry/native_type.rb, line 36
def pointer?
  @type.include?('*')
end
to_s() click to toggle source

@return [String] the string representation of this object.

# File lib/opengl/registry/native_type.rb, line 54
def to_s
  @type
end