Class: GirFFI::UserDefinedPropertyInfo

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

Overview

Represents a property of a user defined type.

Constant Summary collapse

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_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_INTERFACE_TAG_MAP =
{
  GObject::TYPE_ENUM => :enum,
  GObject::TYPE_FLAGS => :flags,
  GObject::TYPE_BOXED => :struct,
  GObject::TYPE_OBJECT => :object
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param_spec) ⇒ UserDefinedPropertyInfo

Returns a new instance of UserDefinedPropertyInfo.



6
7
8
# File 'lib/gir_ffi/user_defined_property_info.rb', line 6

def initialize(param_spec)
  @param_spec = param_spec
end

Instance Attribute Details

#param_specObject (readonly)

Returns the value of attribute param_spec.



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

def param_spec
  @param_spec
end

Instance Method Details

#accessor_nameObject



16
17
18
# File 'lib/gir_ffi/user_defined_property_info.rb', line 16

def accessor_name
  @param_spec.accessor_name
end

#ffi_typeObject



91
92
93
# File 'lib/gir_ffi/user_defined_property_info.rb', line 91

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

#fundamental_value_typeObject



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

def fundamental_value_type
  @fundamental_value_type ||= GObject.type_fundamental value_type
end

#interface_type_tagObject



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

def interface_type_tag
  G_TYPE_INTERFACE_TAG_MAP.fetch(fundamental_value_type)
end

#nameObject



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

def name
  @param_spec.get_name
end

#pointer_type?Boolean

Returns:



48
49
50
# File 'lib/gir_ffi/user_defined_property_info.rb', line 48

def pointer_type?
  G_TYPE_POINTER_MAP.fetch(fundamental_value_type)
end

#type_tagObject



72
73
74
# File 'lib/gir_ffi/user_defined_property_info.rb', line 72

def type_tag
  G_TYPE_TAG_MAP.fetch(fundamental_value_type)
end

#value_typeObject



24
25
26
# File 'lib/gir_ffi/user_defined_property_info.rb', line 24

def value_type
  @param_spec.value_type
end

#writable?Boolean

Returns:



20
21
22
# File 'lib/gir_ffi/user_defined_property_info.rb', line 20

def writable?
  @param_spec.flags[:writable]
end