Class: WinFFI::WideInlineString
- Inherits:
-
Object
- Object
- WinFFI::WideInlineString
- Includes:
- FFI::DataConverter
- Defined in:
- lib/win-ffi/core/wide_inline_string.rb
Instance Attribute Summary collapse
-
#native_type ⇒ Object
readonly
Returns the value of attribute native_type.
-
#size ⇒ Object
(also: #length)
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #from_native(value, _context) ⇒ Object
-
#initialize(size) ⇒ WideInlineString
constructor
A new instance of WideInlineString.
- #to_native(value, _context) ⇒ Object
Constructor Details
#initialize(size) ⇒ WideInlineString
Returns a new instance of WideInlineString.
12 13 14 15 |
# File 'lib/win-ffi/core/wide_inline_string.rb', line 12 def initialize(size) @size = size @native_type = FFI::ArrayType.new(WinFFI.find_type(:tchar), size) end |
Instance Attribute Details
#native_type ⇒ Object (readonly)
Returns the value of attribute native_type.
10 11 12 |
# File 'lib/win-ffi/core/wide_inline_string.rb', line 10 def native_type @native_type end |
#size ⇒ Object (readonly) Also known as: length
Returns the value of attribute size.
10 11 12 |
# File 'lib/win-ffi/core/wide_inline_string.rb', line 10 def size @size end |
Instance Method Details
#from_native(value, _context) ⇒ Object
22 23 24 |
# File 'lib/win-ffi/core/wide_inline_string.rb', line 22 def from_native(value, _context) String.from_byte_array(value.to_a) end |
#to_native(value, _context) ⇒ Object
18 19 20 |
# File 'lib/win-ffi/core/wide_inline_string.rb', line 18 def to_native(value, _context) value.to_byte_array end |