class Ronin::Support::Binary::CTypes::StringType
Represents a C string type.
@api private
@since 1.0.0
Public Class Methods
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 37 def initialize super(pack_string: 'Z*') end
Initializes the string type.
Calls superclass method
Public Instance Methods
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 57 def alignment 1 end
The alignment for the string type
@return [1]
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 135 def dequeue_value(values) values.shift end
Dequeues a string from the flat list of values.
@param [Array] values
The flat array of values.
@return [String]
The dequeued string.
@api private
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 120 def enqueue_value(values,value) values.push(value) end
Enqueues a string onto the flat list of values.
@param [Array] values
The flat array of values.
@param [String, nil] value
The string to enqueue.
@api private
Source
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 66 def signed? true end
Indicates that the String
contains signed characters.
@return [true]
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 46 def size Float::INFINITY end
Indicates that Strings can have arbitrary size.
@return [Float::INFINITY]
Also aliased as: length
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 105 def unpack(data) data.unpack1(@pack_string) end
Unpacks a null-terminated C String
.
@param [String] data
The binary data to unpack.
@return [String, nil]
The unpacked String.
@api public
Source
# File lib/ronin/support/binary/ctypes/string_type.rb, line 75 def unsigned? false end
Indicates that the String
does not contains unsigned characters.
@return [false]