Class: Rbind::RParameter

Inherits:
RAttribute show all
Defined in:
lib/rbind/core/rparameter.rb

Instance Attribute Summary collapse

Attributes inherited from RAttribute

#type

Attributes inherited from RBase

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

Instance Method Summary collapse

Methods inherited from RAttribute

#==, #readable!, #readable?, #writeable!, #writeable?

Methods inherited from RBase

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

Constructor Details

#initialize(name, type, default_value = nil) ⇒ RParameter

Returns a new instance of RParameter.



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

def initialize(name,type,default_value=nil)
    super(name,type)
    self.default_value = default_value
end

Instance Attribute Details

#default_value(val = nil) ⇒ Object

Returns the value of attribute default_value.



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

def default_value
  @default_value
end

Instance Method Details

#basic_type?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/rbind/core/rparameter.rb', line 61

def basic_type?
    type.basic_type?
end

#const!Object



40
41
42
43
44
# File 'lib/rbind/core/rparameter.rb', line 40

def const!
    return self if const?
    @type = type.to_const
    self
end

#const?Boolean

Returns:

  • (Boolean)


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

def const?
    type.const?
end

#generate_signaturesObject



65
66
67
68
69
70
71
72
73
# File 'lib/rbind/core/rparameter.rb', line 65

def generate_signatures
    if default_value
        sigs = super
        sigs[0] += " = #{default_value}"
        sigs
    else
        super
    end
end

#ref?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/rbind/core/rparameter.rb', line 57

def ref?
    type.ref?
end

#remove_const!Object



35
36
37
38
# File 'lib/rbind/core/rparameter.rb', line 35

def remove_const!
    @type = type.remove_const
    self
end

#to_constObject



46
47
48
49
50
51
# File 'lib/rbind/core/rparameter.rb', line 46

def to_const
    return self if const?
    para = self.dup
    para.type = type.to_const
    self
end

#to_single_ptrObject



29
30
31
32
33
# File 'lib/rbind/core/rparameter.rb', line 29

def to_single_ptr
    t = self.clone
    t.type = type.to_single_ptr
    t
end