class Fiddle::Pointer

Attributes

bcc_size[W]
bcc_value_type[RW]

Public Instance Methods

_bcc_value() click to toggle source
# File lib/rbbcc/fiddle_ext.rb, line 10
def _bcc_value
  if self.bcc_value_type.is_a?(Class)
    return self.bcc_value_type.new(self)
  end

  case self.bcc_size
  when Fiddle::Importer.sizeof("int")
    self[0, self.size].unpack("i!").first
  when Fiddle::Importer.sizeof("long")
    self[0, self.size].unpack("l!").first
  else
    self[0, self.size].unpack("Z*").first
  end
end
bcc_size() click to toggle source
# File lib/rbbcc/fiddle_ext.rb, line 44
def bcc_size
  @bcc_size || self.size
end
bcc_value() click to toggle source
# File lib/rbbcc/fiddle_ext.rb, line 5
def bcc_value
  @bcc_value ||= _bcc_value
end
Also aliased as: to_bcc_value
method_missing(name, *a) click to toggle source
Calls superclass method
# File lib/rbbcc/fiddle_ext.rb, line 25
def method_missing(name, *a)
  fields = \
    if self.respond_to?(:bcc_value_type) && \
       self.bcc_value_type.respond_to?(:fields)
      self.bcc_value_type.fields.map{|v| v.split.last.to_sym }
    else
      nil
    end
  return super unless fields

  if fields.include?(name) && bcc_value.respond_to?(name)
    bcc_value.send(name)
  else
    super
  end
end
to_bcc_value()
Alias for: bcc_value
to_extracted_char_ptr() click to toggle source
# File lib/rbbcc/clib.rb, line 181
def to_extracted_char_ptr
  RbBCC::Clib.__extract_char(self)
end