class CZMQ::FFI::Zarmour
armoured text encoding and decoding @note This class is 100% generated using zproject.
Constants
- MODE_BASE16
Standard base 16
- MODE_BASE32_HEX
Extended hex base 32
- MODE_BASE32_STD
Standard base 32
- MODE_BASE64_STD
Standard base 64
- MODE_BASE64_URL
URL and filename friendly base 64
- MODE_Z85
Z85 from ZeroMQ RFC 32
Public Class Methods
@param ptr [::FFI::Pointer] @return [Proc]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 53 def self.create_finalizer_for(ptr) Proc.new do ptr_ptr = ::FFI::MemoryPointer.new :pointer ptr_ptr.write_pointer ptr ::CZMQ::FFI.zarmour_destroy ptr_ptr end end
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary. @param ptr [::FFI::Pointer] @param finalize [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 42 def initialize(ptr, finalize = true) @ptr = ptr if @ptr.null? @ptr = nil # Remove null pointers so we don't have to test for them. elsif finalize @finalizer = self.class.create_finalizer_for @ptr ObjectSpace.define_finalizer self, @finalizer end end
Create a new zarmour @return [CZMQ::Zarmour]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 96 def self.new() ptr = ::CZMQ::FFI.zarmour_new() __new ptr end
Self test of this class.
@param verbose [Boolean] @return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 274 def self.test(verbose) verbose = !(0==verbose||!verbose) # boolean result = ::CZMQ::FFI.zarmour_test(verbose) result end
Public Instance Methods
Return internal pointer @return [::FFI::Pointer]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 66 def __ptr raise DestroyedError unless @ptr @ptr end
Nullify internal pointer and return pointer pointer. @note This detaches the current instance from the native object
and thus makes it unusable.
@return [::FFI::MemoryPointer] the pointer pointing to a pointer
pointing to the native object
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 77 def __ptr_give_ref raise DestroyedError unless @ptr ptr_ptr = ::FFI::MemoryPointer.new :pointer ptr_ptr.write_pointer @ptr __undef_finalizer if @finalizer @ptr = nil ptr_ptr end
Undefines the finalizer for this object. @note Only use this if you need to and can guarantee that the native
object will be freed by other means.
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 89 def __undef_finalizer ObjectSpace.undefine_finalizer self @finalizer = nil end
Decode an armoured string into a chunk. The decoded output is null-terminated, so it may be treated as a string, if that's what it was prior to encoding.
@param data [String, to_s, nil] @return [Zchunk]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 133 def decode(data) raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_decode(self_p, data) result = Zchunk.__new result, true result end
Destroy the zarmour
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 104 def destroy() return unless @ptr self_p = __ptr_give_ref result = ::CZMQ::FFI.zarmour_destroy(self_p) result end
Encode a stream of bytes into an armoured string. Returns the armoured string, or NULL if there was insufficient memory available to allocate a new string.
@param data [::FFI::Pointer, to_ptr
] @param size [Integer, to_int, to_i] @return [::FFI::AutoPointer]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 118 def encode(data, size) raise DestroyedError unless @ptr self_p = @ptr size = Integer(size) result = ::CZMQ::FFI.zarmour_encode(self_p, data, size) result = ::FFI::AutoPointer.new(result, LibC.method(:free)) result end
Return if splitting output into lines is turned on. Default is off.
@return [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 219 def line_breaks() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_line_breaks(self_p) result end
Get the line length used for splitting lines.
@return [Integer]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 241 def line_length() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_line_length(self_p) result end
Get the mode property.
@return [Integer]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 144 def mode() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_mode(self_p) result end
Get printable string for mode.
@return [String]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 154 def mode_str() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_mode_str(self_p) result end
@return [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 61 def null? !@ptr or @ptr.null? end
Return true if padding is turned on.
@return [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 176 def pad() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_pad(self_p) result end
Get the padding character.
@return [::FFI::Pointer]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 198 def pad_char() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_pad_char(self_p) result end
Print properties of object
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 263 def print() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.zarmour_print(self_p) result end
Turn splitting output into lines on or off.
@param line_breaks
[Boolean] @return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 230 def set_line_breaks(line_breaks) raise DestroyedError unless @ptr self_p = @ptr line_breaks = !(0==line_breaks||!line_breaks) # boolean result = ::CZMQ::FFI.zarmour_set_line_breaks(self_p, line_breaks) result end
Set the line length used for splitting lines.
@param line_length
[Integer, to_int, to_i] @return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 252 def set_line_length(line_length) raise DestroyedError unless @ptr self_p = @ptr line_length = Integer(line_length) result = ::CZMQ::FFI.zarmour_set_line_length(self_p, line_length) result end
Set the mode property.
@param mode [Integer, to_int, to_i] @return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 165 def set_mode(mode) raise DestroyedError unless @ptr self_p = @ptr mode = Integer(mode) result = ::CZMQ::FFI.zarmour_set_mode(self_p, mode) result end
Turn padding on or off. Default is on.
@param pad [Boolean] @return [void]
# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 187 def set_pad(pad) raise DestroyedError unless @ptr self_p = @ptr pad = !(0==pad||!pad) # boolean result = ::CZMQ::FFI.zarmour_set_pad(self_p, pad) result end