Class: FFI::StructLayout::CharArray
- Inherits:
-
FFI::Struct::InlineArray
- Object
- FFI::Struct::InlineArray
- FFI::StructLayout::CharArray
- Defined in:
- ext/ffi_c/Struct.c
Instance Method Summary collapse
-
#to_s ⇒ String
(also: #to_str)
Convert
self
to a string.
Methods inherited from FFI::Struct::InlineArray
#[], #[]=, #each, #initialize, #size, #to_a, #to_ptr
Constructor Details
This class inherits a constructor from FFI::Struct::InlineArray
Instance Method Details
#to_s ⇒ String Also known as: to_str
Convert self
to a string.
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'ext/ffi_c/Struct.c', line 777
static VALUE
inline_array_to_s(VALUE self)
{
InlineArray* array;
VALUE argv[2];
TypedData_Get_Struct(self, InlineArray, &inline_array_data_type, array);
if (array->componentType->nativeType != NATIVE_INT8 && array->componentType->nativeType != NATIVE_UINT8) {
VALUE dummy = Qnil;
return rb_call_super(0, &dummy);
}
argv[0] = UINT2NUM(array->field->offset);
argv[1] = UINT2NUM(array->length);
return rb_funcall2(array->rbMemory, rb_intern("get_string"), 2, argv);
}
|