Module: RDF::Raptor::FFI::V2

Extended by:
FFI::Library
Defined in:
lib/rdf/raptor/ffi/v2.rb,
lib/rdf/raptor/ffi/v2/uri.rb,
lib/rdf/raptor/ffi/v2/term.rb,
lib/rdf/raptor/ffi/v2/world.rb,
lib/rdf/raptor/ffi/v2/parser.rb,
lib/rdf/raptor/ffi/v2/iostream.rb,
lib/rdf/raptor/ffi/v2/namespace.rb,
lib/rdf/raptor/ffi/v2/statement.rb,
lib/rdf/raptor/ffi/v2/serializer.rb,
lib/rdf/raptor/ffi/v2/iostream_handler.rb

Overview

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

Defined Under Namespace

Classes: IOStream, IOStreamHandler, Namespace, Parser, Serializer, Statement, Term, URI, World

Constant Summary collapse

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)

0
RAPTOR_TERM_TYPE_URI =
1
RAPTOR_TERM_TYPE_LITERAL =
2
RAPTOR_TERM_TYPE_BLANK =
4

Class Method Summary collapse

Class Method Details

.raptor_free_stringObject



159
# File 'lib/rdf/raptor/ffi/v2.rb', line 159

alias_method :raptor_free_string, :raptor_free_memory

.raptor_new_string(str) ⇒ FFI::Pointer

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.

Returns:

  • (FFI::Pointer)


152
153
154
155
156
# 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

.worldObject



141
142
143
# File 'lib/rdf/raptor/ffi/v2.rb', line 141

def self.world
  @world ||= World.new
end