Sha256: 8f59d78d595093f6def320c021c0a045817f55f8ea9a80552b3ae863e2f2b53d

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

GLib.load_class :ByteArray

module GLib
  # Overrides for GByteArray, GLib's automatically growing array of bytes.
  class ByteArray
    def to_string
      GirFFI::ArgHelper.ptr_to_utf8_length @struct[:data], @struct[:len]
    end

    def append(data)
      bytes = GirFFI::InPointer.from :utf8, data
      len = data.bytesize
      self.class.wrap(Lib.g_byte_array_append to_ptr, bytes, len)
    end

    class << self; undef :new; end

    def self.new
      wrap(Lib.g_byte_array_new)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.8.1 lib/ffi-glib/byte_array.rb
gir_ffi-0.8.0 lib/ffi-glib/byte_array.rb