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, #auto_alias, #csignature, #flags, #ignore, #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, #validate_flags
Constructor Details
#initialize(name, *flags) ⇒ RDataType
11
12
13
14
15
|
# File 'lib/rbind/core/rdata_type.rb', line 11
def initialize(name,*flags)
super
@invalid_value = 0
@check_type = 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
|
#extern_package_name ⇒ Object
Returns the value of attribute extern_package_name.
9
10
11
|
# File 'lib/rbind/core/rdata_type.rb', line 9
def extern_package_name
@extern_package_name
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
25
26
27
|
# File 'lib/rbind/core/rdata_type.rb', line 25
def ==(other)
other.name == name && other.ptr == ptr
end
|
#basic_type? ⇒ Boolean
67
68
69
|
# File 'lib/rbind/core/rdata_type.rb', line 67
def basic_type?
true
end
|
#check_type? ⇒ Boolean
39
40
41
|
# File 'lib/rbind/core/rdata_type.rb', line 39
def check_type?
@check_type
end
|
#cname(value = nil) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/rbind/core/rdata_type.rb', line 43
def cname(value=nil)
if !value
if basic_type? && !@cname
name
else
super
end
else
super
self
end
end
|
#container? ⇒ Boolean
holds ofther operations, types or consts
72
73
74
|
# File 'lib/rbind/core/rdata_type.rb', line 72
def container?
false
end
|
#delete! ⇒ Object
88
89
90
91
92
93
94
|
# File 'lib/rbind/core/rdata_type.rb', line 88
def delete!
if @owner
@owner.delete_type self.name
else
raise "#{self} has no owner."
end
end
|
#extern? ⇒ Boolean
17
18
19
|
# File 'lib/rbind/core/rdata_type.rb', line 17
def extern?
@flags.include? :Extern
end
|
#generate_signatures ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/rbind/core/rdata_type.rb', line 29
def generate_signatures
if ref?
["#{full_name} &","#{cname} &"]
elsif ptr?
["#{full_name} *","#{cname} *"]
else
super
end
end
|
#ptr? ⇒ Boolean
96
97
98
|
# File 'lib/rbind/core/rdata_type.rb', line 96
def ptr?
!!ptr
end
|
#ref? ⇒ Boolean
100
101
102
|
# File 'lib/rbind/core/rdata_type.rb', line 100
def ref?
!!ref
end
|
#to_ptr ⇒ Object
80
81
82
83
84
85
86
|
# File 'lib/rbind/core/rdata_type.rb', line 80
def to_ptr
return self if ptr? && !ref?
t = self.dup
t.ref = false
t.ptr = true
t
end
|
#to_value ⇒ Object
76
77
78
|
# File 'lib/rbind/core/rdata_type.rb', line 76
def to_value
owner.type(name)
end
|
#typedef? ⇒ Boolean
62
63
64
|
# File 'lib/rbind/core/rdata_type.rb', line 62
def typedef?
!!@typedef
end
|
#valid_flags ⇒ Object
21
22
23
|
# File 'lib/rbind/core/rdata_type.rb', line 21
def valid_flags
super << :Extern
end
|