Module: GirFFI::FlagsBase
Overview
Instance Method Summary
collapse
#gtype
Methods included from TypeBase
#gir_ffi_builder, #gir_info
Instance Method Details
#[](arg) ⇒ Object
25
26
27
|
# File 'lib/gir_ffi/flags_base.rb', line 25
def [](arg)
self::BitMask[arg]
end
|
#copy_value_to_pointer(value, pointer) ⇒ Object
37
38
39
|
# File 'lib/gir_ffi/flags_base.rb', line 37
def copy_value_to_pointer(value, pointer)
pointer.put_int32 0, to_native(value, nil)
end
|
#from(arg) ⇒ Object
33
34
35
|
# File 'lib/gir_ffi/flags_base.rb', line 33
def from(arg)
self[arg]
end
|
#from_native(*args) ⇒ Object
21
22
23
|
# File 'lib/gir_ffi/flags_base.rb', line 21
def from_native(*args)
self::BitMask.from_native(*args).select { |_k, v| v }
end
|
#get_value_from_pointer(pointer, offset) ⇒ Object
41
42
43
|
# File 'lib/gir_ffi/flags_base.rb', line 41
def get_value_from_pointer(pointer, offset)
from_native pointer.get_int32(offset), nil
end
|
#native_type ⇒ Object
9
10
11
|
# File 'lib/gir_ffi/flags_base.rb', line 9
def native_type
self::BitMask.native_type
end
|
#setup_and_call(method, arguments, &block) ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'lib/gir_ffi/flags_base.rb', line 45
def setup_and_call(method, arguments, &block)
result = setup_method method.to_s
unless result
raise "Unable to set up method #{method} in #{self}"
end
send method, *arguments, &block
end
|
#setup_method(name) ⇒ Object
59
60
61
|
# File 'lib/gir_ffi/flags_base.rb', line 59
def setup_method(name)
gir_ffi_builder.setup_method name
end
|
#to_ffi_type ⇒ Object
55
56
57
|
# File 'lib/gir_ffi/flags_base.rb', line 55
def to_ffi_type
self
end
|
#to_native(value, context) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/gir_ffi/flags_base.rb', line 13
def to_native(value, context)
case value
when Symbol
value = { value => true }
end
self::BitMask.to_native(value, context)
end
|
#wrap(arg) ⇒ Object
29
30
31
|
# File 'lib/gir_ffi/flags_base.rb', line 29
def wrap(arg)
self[arg]
end
|