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, #pretty_print, #rename, #specialize_ruby, split_name, to_cname, #to_s

Constructor Details

#initialize(name) ⇒ RDataType

Returns a new instance of RDataType.



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

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

Instance Attribute Details

#cdelete_methodObject

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_typeObject

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_valueObject

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

#ptrObject

Returns the value of attribute ptr.



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

def ptr
  @ptr
end

#refObject

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.generate_signatures[0] == generate_signatures[0]
end

#basic_type?Boolean

elementar type of c

Returns:

  • (Boolean)


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

def basic_type?
    true
end

#check_type?Boolean

indicates of the type shall be checked before casting

Returns:

  • (Boolean)


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

def check_type?
    @check_type
end

#cname(value = nil) ⇒ Object



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

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

#const?Boolean

Returns:

  • (Boolean)


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

def const?
    false
end

#container?Boolean

holds other operations, types or consts

Returns:

  • (Boolean)


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

def container?
    false
end

#ptr?Boolean

Returns:

  • (Boolean)


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

def ptr?
    false
end

#raw?Boolean

Returns:

  • (Boolean)


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

def raw?
    true
end

#ref?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/rbind/core/rdata_type.rb', line 101

def ref?
    false
end

#remove_constObject



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

def remove_const
    self
end

#template?Boolean

Returns:

  • (Boolean)


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

def template?
    false
end

#to_constObject



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

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

#to_ptrObject



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

def to_ptr
    RPointer.new(self)
end

#to_rawObject



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

def to_raw
    self
end

#to_refObject



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

def to_ref
    RReference.new(self)
end

#to_single_ptrObject



67
68
69
70
71
# File 'lib/rbind/core/rdata_type.rb', line 67

def to_single_ptr
    t = to_raw
    t = t.to_const if const?
    t.to_ptr
end

#typedef?Boolean

Returns:

  • (Boolean)


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

def typedef?
    !!@typedef
end