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

__new()
Alias for: new
create_finalizer_for(ptr) click to toggle source

@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
new(ptr, finalize = true) click to toggle source

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
new() click to toggle source

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
Also aliased as: __new
test(verbose) click to toggle source

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

__ptr() click to toggle source

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
Also aliased as: to_ptr
__ptr_give_ref() click to toggle source

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
__undef_finalizer() click to toggle source

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(data) click to toggle source

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() click to toggle source

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(data, size) click to toggle source

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
line_breaks() click to toggle source

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
line_length() click to toggle source

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
mode() click to toggle source

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
mode_str() click to toggle source

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
null?() click to toggle source

@return [Boolean]

# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 61
def null?
  !@ptr or @ptr.null?
end
pad() click to toggle source

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
pad_char() click to toggle source

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() click to toggle source

Print properties of object

@return [void]

set_line_breaks(line_breaks) click to toggle source

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_line_length(line_length) click to toggle source

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_mode(mode) click to toggle source

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
set_pad(pad) click to toggle source

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
set_pad_char(pad_char) click to toggle source

Set the padding character.

@param pad_char [::FFI::Pointer, to_ptr] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zarmour.rb, line 209
def set_pad_char(pad_char)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zarmour_set_pad_char(self_p, pad_char)
  result
end
to_ptr()

So external Libraries can just pass the Object to a FFI function which expects a :pointer

Alias for: __ptr