Class: Rbind::RDataType

Inherits:
RBase
  • Object
show all
Defined in:
lib/rbind/core/rdata_type.rb

Direct Known Subclasses

RCallback, REnum, RNamespace, RTemplateParameter

Instance Attribute Summary collapse

Attributes inherited from RBase

#alias, #auto_alias, #csignature, #doc, #extern_package_name, #ignore, #name, #namespace, #owner, #signature, #version

Instance Method Summary collapse

Methods inherited from RBase

basename, #binding, #delete!, #doc?, #extern?, #full_name, #generate_signatures, #ignore?, #map_to_namespace, namespace, #namespace?, normalize, #overwrite_c, #overwrite_ruby, #pretty_print, #rename, #specialize_ruby, split_name, to_cname, #to_s

Constructor Details

#initialize(name) ⇒ RDataType

Returns a new instance of RDataType.



9
10
11
12
13
# File 'lib/rbind/core/rdata_type.rb', line 9

def initialize(name)
    super
    @invalid_value = 0
    @check_type = true
end

Instance Attribute Details

#cdelete_methodObject

Returns the value of attribute cdelete_method.



6
7
8
# File 'lib/rbind/core/rdata_type.rb', line 6

def cdelete_method
  @cdelete_method
end

#check_typeObject

Returns the value of attribute check_type.



7
8
9
# File 'lib/rbind/core/rdata_type.rb', line 7

def check_type
  @check_type
end

#invalid_valueObject

Returns the value of attribute invalid_value.



5
6
7
# File 'lib/rbind/core/rdata_type.rb', line 5

def invalid_value
  @invalid_value
end

#typedef(value = nil) ⇒ Object

Returns the value of attribute typedef.



4
5
6
# File 'lib/rbind/core/rdata_type.rb', line 4

def typedef
  @typedef
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/rbind/core/rdata_type.rb', line 15

def ==(other)
    other.generate_signatures[0] == generate_signatures[0]
end

#basic_type?Boolean

elementar type of c

Returns:

  • (Boolean)


53
54
55
# File 'lib/rbind/core/rdata_type.rb', line 53

def basic_type?
    true
end

#check_type?Boolean

indicates of the type shall be checked before casting

Returns:

  • (Boolean)


21
22
23
# File 'lib/rbind/core/rdata_type.rb', line 21

def check_type?
    @check_type
end

#cname(value = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rbind/core/rdata_type.rb', line 25

def cname(value=nil)
    if !value
        if basic_type? && !@cname
            full_name
        else
            super
        end
    else
        super
        self
    end
end

#const?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/rbind/core/rdata_type.rb', line 115

def const?
    false
end

#container?Boolean

holds other operations, types or consts

Returns:

  • (Boolean)


58
59
60
# File 'lib/rbind/core/rdata_type.rb', line 58

def container?
    false
end

#ownership?Boolean

returns true if the type is owner of its memory

Returns:

  • (Boolean)


103
104
105
106
107
108
109
# File 'lib/rbind/core/rdata_type.rb', line 103

def ownership?
    if ref?
        false
    else
        true
    end
end

#ptr?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/rbind/core/rdata_type.rb', line 119

def ptr?
    false
end

#raw?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/rbind/core/rdata_type.rb', line 111

def raw?
    true
end

#ref?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/rbind/core/rdata_type.rb', line 123

def ref?
    false
end

#remove_constObject



86
87
88
# File 'lib/rbind/core/rdata_type.rb', line 86

def remove_const
    self
end

#remove_ownershipObject



90
91
92
# File 'lib/rbind/core/rdata_type.rb', line 90

def remove_ownership
    self
end

#remove_ptrObject



98
99
100
# File 'lib/rbind/core/rdata_type.rb', line 98

def remove_ptr
    self
end

#remove_refObject



94
95
96
# File 'lib/rbind/core/rdata_type.rb', line 94

def remove_ref
    self
end

#template?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/rbind/core/rdata_type.rb', line 48

def template?
    false
end

#to_constObject



78
79
80
# File 'lib/rbind/core/rdata_type.rb', line 78

def to_const
    RTypeAnnotation.new(self,:const => true)
end

#to_ownership(val) ⇒ Object



82
83
84
# File 'lib/rbind/core/rdata_type.rb', line 82

def to_ownership(val)
    raise "Cannot set memory owner for none pointer types!"
end

#to_ptrObject



70
71
72
# File 'lib/rbind/core/rdata_type.rb', line 70

def to_ptr
    RTypeAnnotation.new(self,:ptr => 1)
end

#to_rawObject



62
63
64
# File 'lib/rbind/core/rdata_type.rb', line 62

def to_raw
    self
end

#to_refObject



74
75
76
# File 'lib/rbind/core/rdata_type.rb', line 74

def to_ref
    RTypeAnnotation.new(self,:ref => true)
end

#to_single_ptrObject



66
67
68
# File 'lib/rbind/core/rdata_type.rb', line 66

def to_single_ptr
    self.to_ptr
end

#typedef?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/rbind/core/rdata_type.rb', line 44

def typedef?
    !!@typedef
end