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