gir_ffi 0.15.7 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +44 -18
  3. data/README.md +8 -23
  4. data/lib/ffi-glib/bytes.rb +0 -12
  5. data/lib/ffi-glib/hash_table.rb +1 -1
  6. data/lib/ffi-glib/main_loop.rb +1 -1
  7. data/lib/ffi-glib/ptr_array.rb +24 -15
  8. data/lib/ffi-glib/variant.rb +4 -6
  9. data/lib/ffi-gobject/object.rb +30 -60
  10. data/lib/ffi-gobject/object_class.rb +2 -10
  11. data/lib/ffi-gobject/value.rb +26 -26
  12. data/lib/ffi-gobject.rb +4 -18
  13. data/lib/ffi-gobject_introspection/i_base_info.rb +1 -1
  14. data/lib/ffi-gobject_introspection/i_constant_info.rb +10 -10
  15. data/lib/ffi-gobject_introspection/lib.rb +11 -11
  16. data/lib/ffi-gobject_introspection.rb +19 -19
  17. data/lib/gir_ffi/builder.rb +1 -1
  18. data/lib/gir_ffi/builders/argument_builder_collection.rb +24 -8
  19. data/lib/gir_ffi/builders/base_argument_builder.rb +2 -2
  20. data/lib/gir_ffi/builders/base_method_builder.rb +23 -23
  21. data/lib/gir_ffi/builders/constructor_builder.rb +1 -1
  22. data/lib/gir_ffi/builders/mapping_method_builder.rb +1 -1
  23. data/lib/gir_ffi/builders/marshalling_method_builder.rb +2 -2
  24. data/lib/gir_ffi/builders/module_builder.rb +1 -1
  25. data/lib/gir_ffi/builders/object_builder.rb +10 -12
  26. data/lib/gir_ffi/builders/struct_builder.rb +1 -1
  27. data/lib/gir_ffi/builders/type_builder.rb +9 -9
  28. data/lib/gir_ffi/builders/user_defined_builder.rb +24 -26
  29. data/lib/gir_ffi/class_base.rb +1 -3
  30. data/lib/gir_ffi/core.rb +0 -5
  31. data/lib/gir_ffi/in_pointer.rb +6 -6
  32. data/lib/gir_ffi/info_ext/full_type_name.rb +3 -2
  33. data/lib/gir_ffi/info_ext/i_function_info.rb +10 -0
  34. data/lib/gir_ffi/info_ext/i_signal_info.rb +8 -6
  35. data/lib/gir_ffi/info_ext/i_type_info.rb +21 -26
  36. data/lib/gir_ffi/info_ext/i_vfunc_info.rb +4 -0
  37. data/lib/gir_ffi/instance_method_setup.rb +3 -1
  38. data/lib/gir_ffi/object_base.rb +5 -5
  39. data/lib/gir_ffi/struct_like_base.rb +0 -1
  40. data/lib/gir_ffi/type_map.rb +30 -30
  41. data/lib/gir_ffi/unintrospectable_type_info.rb +2 -2
  42. data/lib/gir_ffi/user_defined_object_info.rb +0 -3
  43. data/lib/gir_ffi/user_defined_property_info.rb +33 -33
  44. data/lib/gir_ffi/version.rb +1 -1
  45. data/lib/gir_ffi/zero_terminated.rb +1 -1
  46. data/lib/gir_ffi-base/gobject.rb +1 -1
  47. metadata +33 -12
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GirFFI
4
- # Methods for setting up instance methods
4
+ # Methods for setting up instance methods.
5
+ #
6
+ # Depends on .gir_ffi_builder being defined in the extending class.
5
7
  module InstanceMethodSetup
6
8
  def setup_instance_method(name)
7
9
  gir_ffi_builder.setup_instance_method name
@@ -7,8 +7,8 @@ module GirFFI
7
7
  class ObjectBase < ClassBase
8
8
  extend FFI::DataConverter
9
9
 
10
- def object_class
11
- self.class.object_class
10
+ def class_struct
11
+ self.class.class_struct
12
12
  end
13
13
 
14
14
  def self.native_type
@@ -64,11 +64,11 @@ module GirFFI
64
64
  raise GirFFI::SignalNotFoundError.new(name, self)
65
65
  end
66
66
 
67
- def self.object_class
68
- @object_class ||=
67
+ def self.class_struct
68
+ @class_struct ||=
69
69
  begin
70
70
  ptr = GObject::Lib.g_type_class_ref(gtype)
71
- gir_ffi_builder.object_class_struct.wrap ptr
71
+ gir_ffi_builder.class_struct_class.wrap ptr
72
72
  end
73
73
  end
74
74
 
@@ -22,7 +22,6 @@ module GirFFI
22
22
  self
23
23
  end
24
24
 
25
- # NOTE: Needed for JRuby's FFI
26
25
  def to_native(value, _context)
27
26
  value.struct
28
27
  end
@@ -10,38 +10,38 @@ module GirFFI
10
10
  gsize_type = "uint#{sz}".to_sym
11
11
 
12
12
  TAG_TYPE_MAP = {
13
- enum: :int32,
14
- flags: :int32,
15
- ghash: :pointer,
16
- glist: :pointer,
17
- gslist: :pointer,
18
- strv: :pointer,
13
+ enum: :int32,
14
+ flags: :int32,
15
+ ghash: :pointer,
16
+ glist: :pointer,
17
+ gslist: :pointer,
18
+ strv: :pointer,
19
19
  interface: :pointer,
20
- error: :pointer,
20
+ error: :pointer,
21
21
  ptr_array: :pointer,
22
- array: :pointer,
23
- c: GirFFI::SizedArray,
24
- utf8: :pointer,
25
- filename: :pointer,
26
- GType: gsize_type,
27
- gboolean: GirFFI::Boolean,
28
- gunichar: :uint32,
29
- gint8: :int8,
30
- guint8: :uint8,
31
- gint16: :int16,
32
- guint16: :uint16,
33
- gint: :int,
34
- guint: :uint,
35
- gint32: :int32,
36
- guint32: :uint32,
37
- gint64: :int64,
38
- guint64: :uint64,
39
- glong: :long,
40
- gulong: :ulong,
41
- gsize: gsize_type,
42
- gfloat: :float,
43
- gdouble: :double,
44
- void: :void
22
+ array: :pointer,
23
+ c: GirFFI::SizedArray,
24
+ utf8: :pointer,
25
+ filename: :pointer,
26
+ GType: gsize_type,
27
+ gboolean: GirFFI::Boolean,
28
+ gunichar: :uint32,
29
+ gint8: :int8,
30
+ guint8: :uint8,
31
+ gint16: :int16,
32
+ guint16: :uint16,
33
+ gint: :int,
34
+ guint: :uint,
35
+ gint32: :int32,
36
+ guint32: :uint32,
37
+ gint64: :int64,
38
+ guint64: :uint64,
39
+ glong: :long,
40
+ gulong: :ulong,
41
+ gsize: gsize_type,
42
+ gfloat: :float,
43
+ gdouble: :double,
44
+ void: :void
45
45
  }.freeze
46
46
 
47
47
  def self.map_basic_type(type)
@@ -37,9 +37,9 @@ module GirFFI
37
37
  end
38
38
 
39
39
  def interfaces
40
- @gobject.type_interfaces(@g_type).map do |gtype|
40
+ @gobject.type_interfaces(@g_type).filter_map do |gtype|
41
41
  @gir.find_by_gtype gtype
42
- end.compact
42
+ end
43
43
  end
44
44
 
45
45
  def fields
@@ -13,9 +13,6 @@ module GirFFI
13
13
  @klass = klass
14
14
  @properties = []
15
15
  @vfunc_implementations = []
16
-
17
- # FIXME: Limit access to only install_property and install_vfunc_implementation.
18
- yield self if block_given?
19
16
  end
20
17
 
21
18
  def described_class
@@ -15,21 +15,21 @@ module GirFFI
15
15
  # TODO: Unify with InfoExt::ITypeInfo.flattened_tag_to_gtype_map
16
16
  G_TYPE_TAG_MAP = {
17
17
  GObject::TYPE_BOOLEAN => :gboolean,
18
- GObject::TYPE_CHAR => :gint8,
19
- GObject::TYPE_UCHAR => :guint8,
20
- GObject::TYPE_FLOAT => :gfloat,
21
- GObject::TYPE_DOUBLE => :gdouble,
22
- GObject::TYPE_INT => :gint,
23
- GObject::TYPE_UINT => :guint,
24
- GObject::TYPE_LONG => :glong,
25
- GObject::TYPE_ULONG => :gulong,
26
- GObject::TYPE_INT64 => :gint64,
27
- GObject::TYPE_UINT64 => :guint64,
28
- GObject::TYPE_ENUM => :interface,
29
- GObject::TYPE_FLAGS => :interface,
30
- GObject::TYPE_STRING => :utf8,
31
- GObject::TYPE_BOXED => :interface,
32
- GObject::TYPE_OBJECT => :interface
18
+ GObject::TYPE_CHAR => :gint8,
19
+ GObject::TYPE_UCHAR => :guint8,
20
+ GObject::TYPE_FLOAT => :gfloat,
21
+ GObject::TYPE_DOUBLE => :gdouble,
22
+ GObject::TYPE_INT => :gint,
23
+ GObject::TYPE_UINT => :guint,
24
+ GObject::TYPE_LONG => :glong,
25
+ GObject::TYPE_ULONG => :gulong,
26
+ GObject::TYPE_INT64 => :gint64,
27
+ GObject::TYPE_UINT64 => :guint64,
28
+ GObject::TYPE_ENUM => :interface,
29
+ GObject::TYPE_FLAGS => :interface,
30
+ GObject::TYPE_STRING => :utf8,
31
+ GObject::TYPE_BOXED => :interface,
32
+ GObject::TYPE_OBJECT => :interface
33
33
  }.freeze
34
34
 
35
35
  def tag
@@ -39,21 +39,21 @@ module GirFFI
39
39
  # TODO: Unify with InfoExt::ITypeInfo.flattened_tag_to_gtype_map
40
40
  G_TYPE_POINTER_MAP = {
41
41
  GObject::TYPE_BOOLEAN => false,
42
- GObject::TYPE_CHAR => false,
43
- GObject::TYPE_UCHAR => false,
44
- GObject::TYPE_FLOAT => false,
45
- GObject::TYPE_DOUBLE => false,
46
- GObject::TYPE_INT => false,
47
- GObject::TYPE_UINT => false,
48
- GObject::TYPE_LONG => false,
49
- GObject::TYPE_ULONG => false,
50
- GObject::TYPE_INT64 => false,
51
- GObject::TYPE_UINT64 => false,
52
- GObject::TYPE_ENUM => false,
53
- GObject::TYPE_FLAGS => false,
54
- GObject::TYPE_STRING => true,
55
- GObject::TYPE_BOXED => true,
56
- GObject::TYPE_OBJECT => true
42
+ GObject::TYPE_CHAR => false,
43
+ GObject::TYPE_UCHAR => false,
44
+ GObject::TYPE_FLOAT => false,
45
+ GObject::TYPE_DOUBLE => false,
46
+ GObject::TYPE_INT => false,
47
+ GObject::TYPE_UINT => false,
48
+ GObject::TYPE_LONG => false,
49
+ GObject::TYPE_ULONG => false,
50
+ GObject::TYPE_INT64 => false,
51
+ GObject::TYPE_UINT64 => false,
52
+ GObject::TYPE_ENUM => false,
53
+ GObject::TYPE_FLAGS => false,
54
+ GObject::TYPE_STRING => true,
55
+ GObject::TYPE_BOXED => true,
56
+ GObject::TYPE_OBJECT => true
57
57
  }.freeze
58
58
 
59
59
  def pointer?
@@ -61,9 +61,9 @@ module GirFFI
61
61
  end
62
62
 
63
63
  G_TYPE_INTERFACE_TAG_MAP = {
64
- GObject::TYPE_ENUM => :enum,
65
- GObject::TYPE_FLAGS => :flags,
66
- GObject::TYPE_BOXED => :struct,
64
+ GObject::TYPE_ENUM => :enum,
65
+ GObject::TYPE_FLAGS => :flags,
66
+ GObject::TYPE_BOXED => :struct,
67
67
  GObject::TYPE_OBJECT => :object
68
68
  }.freeze
69
69
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Current GirFFI version
4
4
  module GirFFI
5
- VERSION = "0.15.7"
5
+ VERSION = "0.16.0"
6
6
  end
@@ -85,7 +85,7 @@ module GirFFI
85
85
  :pointer
86
86
  elsif ffi_type.is_a? Symbol
87
87
  :numeric
88
- elsif ffi_type < GirFFI::ClassBase
88
+ elsif ffi_type < GirFFI::ClassBase # rubocop:disable Lint/DuplicateBranch
89
89
  :pointer
90
90
  elsif ffi_type.singleton_class.include? GirFFI::EnumBase
91
91
  :enum
@@ -7,7 +7,7 @@ require "gir_ffi-base/gobject/lib"
7
7
 
8
8
  # The part of the GObject namespace that is needed by GirFFI.
9
9
  #
10
- # :reek:TooManyConstants: because it needs to hold the type constants.
10
+ # :reek:TooManyConstants because it needs to hold the type constants.
11
11
  module GObject
12
12
  def self.type_from_name(name)
13
13
  Lib.g_type_from_name name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.7
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-15 00:00:00.000000000 Z
11
+ date: 2022-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,26 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-focus
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 1.3.1
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '1.3'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.3.1
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: rake
71
91
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +148,28 @@ dependencies:
128
148
  requirements:
129
149
  - - "~>"
130
150
  - !ruby/object:Gem::Version
131
- version: 1.8.0
151
+ version: '1.25'
132
152
  type: :development
133
153
  prerelease: false
134
154
  version_requirements: !ruby/object:Gem::Requirement
135
155
  requirements:
136
156
  - - "~>"
137
157
  - !ruby/object:Gem::Version
138
- version: 1.8.0
158
+ version: '1.25'
139
159
  - !ruby/object:Gem::Dependency
140
160
  name: rubocop-minitest
141
161
  requirement: !ruby/object:Gem::Requirement
142
162
  requirements:
143
163
  - - "~>"
144
164
  - !ruby/object:Gem::Version
145
- version: 0.10.1
165
+ version: 0.19.0
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
149
169
  requirements:
150
170
  - - "~>"
151
171
  - !ruby/object:Gem::Version
152
- version: 0.10.1
172
+ version: 0.19.0
153
173
  - !ruby/object:Gem::Dependency
154
174
  name: rubocop-packaging
155
175
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +190,14 @@ dependencies:
170
190
  requirements:
171
191
  - - "~>"
172
192
  - !ruby/object:Gem::Version
173
- version: 1.9.0
193
+ version: '1.13'
174
194
  type: :development
175
195
  prerelease: false
176
196
  version_requirements: !ruby/object:Gem::Requirement
177
197
  requirements:
178
198
  - - "~>"
179
199
  - !ruby/object:Gem::Version
180
- version: 1.9.0
200
+ version: '1.13'
181
201
  - !ruby/object:Gem::Dependency
182
202
  name: simplecov
183
203
  requirement: !ruby/object:Gem::Requirement
@@ -396,6 +416,7 @@ metadata:
396
416
  homepage_uri: http://www.github.com/mvz/ruby-gir-ffi
397
417
  source_code_uri: https://github.com/mvz/gir_ffi
398
418
  changelog_uri: https://github.com/mvz/gir_ffi/blob/master/Changelog.md
419
+ rubygems_mfa_required: 'true'
399
420
  post_install_message:
400
421
  rdoc_options:
401
422
  - "--main"
@@ -406,14 +427,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
406
427
  requirements:
407
428
  - - ">="
408
429
  - !ruby/object:Gem::Version
409
- version: 2.5.0
430
+ version: 2.7.0
410
431
  required_rubygems_version: !ruby/object:Gem::Requirement
411
432
  requirements:
412
433
  - - ">="
413
434
  - !ruby/object:Gem::Version
414
435
  version: '0'
415
436
  requirements: []
416
- rubygems_version: 3.2.3
437
+ rubygems_version: 3.3.7
417
438
  signing_key:
418
439
  specification_version: 4
419
440
  summary: FFI-based GObject binding using the GObject Introspection Repository