Class: GL::Registry::NativeType
- Inherits:
-
Object
- Object
- GL::Registry::NativeType
- Defined in:
- lib/opengl/registry/native_type.rb
Overview
Describes the native type for a return or parameter value.
Instance Attribute Summary collapse
-
#base ⇒ Symbol
readonly
The basic type, excluding any constant constraints, pointer symbols, etc.
-
#group ⇒ String?
readonly
A group that is associated with this type.
-
#type ⇒ String
readonly
The full native type, including constant constraints, pointer symbols, etc.
Instance Method Summary collapse
-
#const? ⇒ Boolean
true
if value is a C-style pointer that can not be modified, otherwisefalse
. -
#initialize(type, base, group) ⇒ NativeType
constructor
Creates a new instance fo the NativeType class.
-
#out? ⇒ Boolean
true
if value is a C-style pointer that may be modified, otherwisefalse
. -
#pointer? ⇒ Boolean
true
if this a C-style pointer type, otherwisefalse
. -
#to_s ⇒ String
The string representation of this object.
Constructor Details
#initialize(type, base, group) ⇒ NativeType
Creates a new instance fo the GL::Registry::NativeType class.
28 29 30 31 32 |
# 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 |
Instance Attribute Details
#base ⇒ Symbol (readonly)
Returns the basic type, excluding any constant constraints, pointer symbols, etc. as a Symbol.
16 17 18 |
# File 'lib/opengl/registry/native_type.rb', line 16 def base @base end |
#group ⇒ String? (readonly)
Returns a group that is associated with this type.
20 21 22 |
# File 'lib/opengl/registry/native_type.rb', line 20 def group @group end |
#type ⇒ String (readonly)
This is essentially the "raw" and fully-qualified type as it would appear in the C language.
Returns the full native type, including constant constraints, pointer symbols, etc.
12 13 14 |
# File 'lib/opengl/registry/native_type.rb', line 12 def type @type end |
Instance Method Details
#const? ⇒ Boolean
Returns true
if value is a C-style pointer that can not be modified, otherwise false
.
42 43 44 |
# File 'lib/opengl/registry/native_type.rb', line 42 def const? /^const /.match?(@type) end |
#out? ⇒ Boolean
Returns true
if value is a C-style pointer that may be modified, otherwise false
.
48 49 50 |
# File 'lib/opengl/registry/native_type.rb', line 48 def out? @type.include?('*') && !/\bconst\b/.match?(@type) end |
#pointer? ⇒ Boolean
Returns true
if this a C-style pointer type, otherwise false
.
36 37 38 |
# File 'lib/opengl/registry/native_type.rb', line 36 def pointer? @type.include?('*') end |
#to_s ⇒ String
Returns the string representation of this object.
54 55 56 |
# File 'lib/opengl/registry/native_type.rb', line 54 def to_s @type end |