module RDF::Raptor::FFI::V2

A foreign-function interface (FFI) to ‘libraptor` 2.x.

@see librdf.org/raptor/libraptor.html

Constants

RAPTOR_TERM_TYPE_BLANK
RAPTOR_TERM_TYPE_LITERAL
RAPTOR_TERM_TYPE_UNKNOWN

TODO: Ideally this would be an enum, but the JRuby FFI (as of version 1.4.0) has problems with enums as part of structs:

`Unknown field type: #<FFI::Enum> (ArgumentError)`
RAPTOR_TERM_TYPE_URI

Public Class Methods

raptor_new_string(str) click to toggle source

Allocates memory for the string ‘str` inside `libraptor`, copying the string into the newly-allocated buffer.

The buffer should later be deallocated using ‘raptor_free_string`.

@return [FFI::Pointer]

# File lib/rdf/raptor/ffi/v2.rb, line 152
def raptor_new_string(str)
  ptr = V2.raptor_alloc_memory(str.bytesize + 1)
  ptr.put_string(0, str)
  ptr
end
world() click to toggle source
# File lib/rdf/raptor/ffi/v2.rb, line 141
def self.world
  @world ||= World.new
end

Private Instance Methods

raptor_new_string(str) click to toggle source

Allocates memory for the string ‘str` inside `libraptor`, copying the string into the newly-allocated buffer.

The buffer should later be deallocated using ‘raptor_free_string`.

@return [FFI::Pointer]

# File lib/rdf/raptor/ffi/v2.rb, line 152
def raptor_new_string(str)
  ptr = V2.raptor_alloc_memory(str.bytesize + 1)
  ptr.put_string(0, str)
  ptr
end