Sha256: 535e6f4d18ed1e6bae14d2c7edd6d8f83753dea11f01e9ce9bd0bdc3eb2aebd8

Contents?: true

Size: 1015 Bytes

Versions: 3

Compression:

Stored size: 1015 Bytes

Contents

# frozen_string_literal: true

module GObjectIntrospection
  # Wraps a GIStructInfo struct.
  # Represents a struct.
  class IStructInfo < IRegisteredTypeInfo
    def n_fields
      Lib.g_struct_info_get_n_fields self
    end

    def field(index)
      IFieldInfo.wrap Lib.g_struct_info_get_field(self, index)
    end

    ##
    build_array_method :fields
    build_finder_method :find_field

    def get_n_methods
      Lib.g_struct_info_get_n_methods self
    end

    def get_method(index)
      IFunctionInfo.wrap Lib.g_struct_info_get_method(self, index)
    end

    ##
    build_array_method :get_methods
    # There is a function g_struct_info_find_method but it causes a core dump.
    build_finder_method :find_method, :get_n_methods, :get_method

    def size
      Lib.g_struct_info_get_size self
    end

    def empty?
      size == 0
    end

    def alignment
      Lib.g_struct_info_get_alignment self
    end

    def gtype_struct?
      Lib.g_struct_info_is_gtype_struct self
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.14.1 lib/ffi-gobject_introspection/i_struct_info.rb
gir_ffi-0.14.0 lib/ffi-gobject_introspection/i_struct_info.rb
gir_ffi-0.13.1 lib/ffi-gobject_introspection/i_struct_info.rb