Class: GLib::ByteArray
- Inherits:
-
Object
- Object
- GLib::ByteArray
- Defined in:
- lib/ffi-glib/byte_array.rb
Overview
Overrides for GByteArray, GLib’s automatically growing array of bytes.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new ⇒ Object
18 19 20 |
# File 'lib/ffi-glib/byte_array.rb', line 18 def self.new wrap(Lib.g_byte_array_new) end |
Instance Method Details
#append(data) ⇒ Object
10 11 12 13 14 |
# File 'lib/ffi-glib/byte_array.rb', line 10 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 |
#to_string ⇒ Object
6 7 8 |
# File 'lib/ffi-glib/byte_array.rb', line 6 def to_string GirFFI::ArgHelper.ptr_to_utf8_length @struct[:data], @struct[:len] end |