Class: Rbind::RDataType
- Inherits:
-
RBase
- Object
- RBase
- Rbind::RDataType
show all
- Defined in:
- lib/rbind/core/rdata_type.rb
Instance Attribute Summary collapse
Attributes inherited from RBase
#alias, #csignature, #flags, #name, #namespace, #owner, #signature, #version
Instance Method Summary
collapse
Methods inherited from RBase
#add_flag, basename, #binding, #full_name, #ignore?, #map_to_namespace, namespace, #namespace?, normalize, #pretty_print, to_cname, #valid_flags, #validate_flags
Constructor Details
#initialize(name, *flags) ⇒ RDataType
Returns a new instance of RDataType.
10
11
12
13
14
|
# File 'lib/rbind/core/rdata_type.rb', line 10
def initialize(name,*flags)
super
@invalid_value = 0
@type_check = true
end
|
Instance Attribute Details
#cdelete_method ⇒ Object
Returns the value of attribute cdelete_method.
7
8
9
|
# File 'lib/rbind/core/rdata_type.rb', line 7
def cdelete_method
@cdelete_method
end
|
#check_type ⇒ Object
Returns the value of attribute check_type.
8
9
10
|
# File 'lib/rbind/core/rdata_type.rb', line 8
def check_type
@check_type
end
|
#invalid_value ⇒ Object
Returns the value of attribute invalid_value.
6
7
8
|
# File 'lib/rbind/core/rdata_type.rb', line 6
def invalid_value
@invalid_value
end
|
#ptr ⇒ Object
Returns the value of attribute ptr.
4
5
6
|
# File 'lib/rbind/core/rdata_type.rb', line 4
def ptr
@ptr
end
|
#ref ⇒ Object
Returns the value of attribute ref.
4
5
6
|
# File 'lib/rbind/core/rdata_type.rb', line 4
def ref
@ref
end
|
#typedef(value = nil) ⇒ Object
Returns the value of attribute typedef.
5
6
7
|
# File 'lib/rbind/core/rdata_type.rb', line 5
def typedef
@typedef
end
|
Instance Method Details
#==(other) ⇒ Object
16
17
18
|
# File 'lib/rbind/core/rdata_type.rb', line 16
def ==(other)
other.name == name && other.ptr == ptr
end
|
#basic_type? ⇒ Boolean
57
58
59
|
# File 'lib/rbind/core/rdata_type.rb', line 57
def basic_type?
true
end
|
#check_type? ⇒ Boolean
30
31
32
|
# File 'lib/rbind/core/rdata_type.rb', line 30
def check_type?
@check_type
end
|
#cname(value = nil) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/rbind/core/rdata_type.rb', line 34
def cname(value=nil)
if !value
if basic_type? && !@cname
name
else
super
end
else
super
self
end
end
|
#container? ⇒ Boolean
61
62
63
|
# File 'lib/rbind/core/rdata_type.rb', line 61
def container?
false
end
|
#delete! ⇒ Object
77
78
79
80
81
82
83
|
# File 'lib/rbind/core/rdata_type.rb', line 77
def delete!
if @owner
@owner.delete_type self.name
else
raise "#{self} has no owner."
end
end
|
#generate_signatures ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/rbind/core/rdata_type.rb', line 20
def generate_signatures
if ref?
["#{full_name} &","#{cname} &"]
elsif ptr?
["#{full_name} *","#{cname} *"]
else
super
end
end
|
#ptr? ⇒ Boolean
85
86
87
|
# File 'lib/rbind/core/rdata_type.rb', line 85
def ptr?
!!ptr
end
|
#ref? ⇒ Boolean
89
90
91
|
# File 'lib/rbind/core/rdata_type.rb', line 89
def ref?
!!ref
end
|
#to_ptr ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/rbind/core/rdata_type.rb', line 69
def to_ptr
return self if ptr? && !ref?
t = self.dup
t.ref = false
t.ptr = true
t
end
|
#to_value ⇒ Object
65
66
67
|
# File 'lib/rbind/core/rdata_type.rb', line 65
def to_value
owner.type(name)
end
|
#typedef? ⇒ Boolean
53
54
55
|
# File 'lib/rbind/core/rdata_type.rb', line 53
def typedef?
!!@typedef
end
|