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, #overwrite_c, #overwrite_ruby, #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.



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

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

#parse_ownershipObject

Returns the value of attribute parse_ownership.



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

def parse_ownership
  @parse_ownership
end

Instance Method Details

#basic_type?Boolean

Returns:

  • (Boolean)


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

def basic_type?
    type.basic_type?
end

#const!Object



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

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

#const?Boolean

Returns:

  • (Boolean)


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

def const?
    type.const?
end

#generate_signaturesObject



70
71
72
73
74
75
76
77
78
# File 'lib/rbind/core/rparameter.rb', line 70

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

#parse_ownership?Boolean

Returns:

  • (Boolean)


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

def parse_ownership?
    @parse_ownership != nil
end

#ref?Boolean

Returns:

  • (Boolean)


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

def ref?
    type.ref?
end

#remove_const!Object



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

def remove_const!
    @type = type.remove_const
    self
end

#to_constObject



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

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

#to_single_ptrObject



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

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