Module: GirFFI::InfoExt::ITypeInfo

Includes:
BuilderHelper
Defined in:
lib/gir_ffi/info_ext/i_type_info.rb

Instance Method Summary collapse

Methods included from BuilderHelper

#const_defined_for, #optionally_define_constant

Instance Method Details

#element_typeObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/gir_ffi/info_ext/i_type_info.rb', line 42

def element_type
  case tag
  when :glist, :gslist, :array
    subtype_tag 0
  when :ghash
    [subtype_tag(0), subtype_tag(1)]
  else
    nil
  end
end

#layout_specification_typeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gir_ffi/info_ext/i_type_info.rb', line 8

def layout_specification_type
  ffitype = GirFFI::Builder.itypeinfo_to_ffitype self
  case ffitype
  when Class
    ffitype.const_get :Struct
  when :bool
    :int
  when :array
    subtype = param_type(0).layout_specification_type
    # XXX Don't use pointer directly to appease JRuby.
    if subtype == :pointer
      subtype = :"uint#{FFI.type_size(:pointer)*8}"
    end
    [subtype, array_fixed_size]
  else
    ffitype
  end
end

#subtype_tag(index) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gir_ffi/info_ext/i_type_info.rb', line 27

def subtype_tag index
  st = param_type(index)
  tag = st.tag
  case tag
  when :interface
    return :interface_pointer if st.pointer?
    return :interface
  when :void
    return :gpointer if st.pointer?
    return :void
  else
    return tag
  end
end