Class: GirFFI::UserDefinedPropertyInfo::UserDefinedTypeInfo

Inherits:
Object
  • Object
show all
Includes:
InfoExt::ITypeInfo
Defined in:
lib/gir_ffi/user_defined_property_info.rb

Overview

Type info for user-defined property

Constant Summary collapse

G_TYPE_TAG_MAP =

TODO: Unify with InfoExt::ITypeInfo.flattened_tag_to_gtype_map

{
  GObject::TYPE_BOOLEAN => :gboolean,
  GObject::TYPE_CHAR => :gint8,
  GObject::TYPE_UCHAR => :guint8,
  GObject::TYPE_FLOAT => :gfloat,
  GObject::TYPE_DOUBLE => :gdouble,
  GObject::TYPE_INT => :gint,
  GObject::TYPE_UINT => :guint,
  GObject::TYPE_LONG => :glong,
  GObject::TYPE_ULONG => :gulong,
  GObject::TYPE_INT64 => :gint64,
  GObject::TYPE_UINT64 => :guint64,
  GObject::TYPE_ENUM => :interface,
  GObject::TYPE_FLAGS => :interface,
  GObject::TYPE_STRING => :utf8,
  GObject::TYPE_BOXED => :interface,
  GObject::TYPE_OBJECT => :interface
}.freeze
G_TYPE_POINTER_MAP =

TODO: Unify with InfoExt::ITypeInfo.flattened_tag_to_gtype_map

{
  GObject::TYPE_BOOLEAN => false,
  GObject::TYPE_CHAR => false,
  GObject::TYPE_UCHAR => false,
  GObject::TYPE_FLOAT => false,
  GObject::TYPE_DOUBLE => false,
  GObject::TYPE_INT => false,
  GObject::TYPE_UINT => false,
  GObject::TYPE_LONG => false,
  GObject::TYPE_ULONG => false,
  GObject::TYPE_INT64 => false,
  GObject::TYPE_UINT64 => false,
  GObject::TYPE_ENUM => false,
  GObject::TYPE_FLAGS => false,
  GObject::TYPE_STRING => true,
  GObject::TYPE_BOXED => true,
  GObject::TYPE_OBJECT => true
}.freeze
G_TYPE_INTERFACE_TAG_MAP =
{
  GObject::TYPE_ENUM => :enum,
  GObject::TYPE_FLAGS => :flags,
  GObject::TYPE_BOXED => :struct,
  GObject::TYPE_OBJECT => :object
}.freeze

Constants included from InfoExt::ITypeInfo

InfoExt::ITypeInfo::FLATTENED_TAG_POINTER_TO_GTYPE_MAP, InfoExt::ITypeInfo::FLATTENED_TAG_TO_GTYPE_MAP, InfoExt::ITypeInfo::GOBJECT_VALUE_NAME, InfoExt::ITypeInfo::TAGS_NEEDING_C_TO_RUBY_CONVERSION, InfoExt::ITypeInfo::TAGS_NEEDING_RUBY_TO_C_CONVERSION, InfoExt::ITypeInfo::TAG_TO_WRAPPER_CLASS_MAP

Instance Method Summary collapse

Methods included from InfoExt::ITypeInfo

#argument_class_name, #element_type, #extra_conversion_arguments, #flattened_tag, #gtype, #gvalue?, #make_g_value, #needs_c_to_ruby_conversion_for_callbacks?, #needs_c_to_ruby_conversion_for_closures?, #needs_c_to_ruby_conversion_for_functions?, #needs_c_to_ruby_conversion_for_properties?, #needs_ruby_to_c_conversion_for_callbacks?, #needs_ruby_to_c_conversion_for_closures?, #needs_ruby_to_c_conversion_for_functions?, #needs_ruby_to_c_conversion_for_properties?, #tag_or_class, #to_callback_ffi_type, #to_ffi_type

Constructor Details

#initialize(param_spec) ⇒ UserDefinedTypeInfo

Returns a new instance of UserDefinedTypeInfo.



11
12
13
# File 'lib/gir_ffi/user_defined_property_info.rb', line 11

def initialize(param_spec)
  @param_spec = param_spec
end

Instance Method Details

#ffi_typeObject



86
87
88
# File 'lib/gir_ffi/user_defined_property_info.rb', line 86

def ffi_type
  GirFFI::TypeMap.map_basic_type(tag)
end

#hidden_struct_type?Boolean

Returns:



74
75
76
# File 'lib/gir_ffi/user_defined_property_info.rb', line 74

def hidden_struct_type?
  false
end

#interface_classObject



78
79
80
# File 'lib/gir_ffi/user_defined_property_info.rb', line 78

def interface_class
  @interface_class ||= Builder.build_by_gtype(value_type) if interface?
end

#interface_class_nameObject



82
83
84
# File 'lib/gir_ffi/user_defined_property_info.rb', line 82

def interface_class_name
  interface_class.name if interface?
end

#interface_typeObject



70
71
72
# File 'lib/gir_ffi/user_defined_property_info.rb', line 70

def interface_type
  G_TYPE_INTERFACE_TAG_MAP.fetch(fundamental_value_type) if interface?
end

#pointer?Boolean

Returns:



59
60
61
# File 'lib/gir_ffi/user_defined_property_info.rb', line 59

def pointer?
  G_TYPE_POINTER_MAP.fetch(fundamental_value_type)
end

#tagObject



35
36
37
# File 'lib/gir_ffi/user_defined_property_info.rb', line 35

def tag
  @tag ||= G_TYPE_TAG_MAP.fetch(fundamental_value_type)
end