module RDF::Raptor::FFI::V1

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

@see librdf.org/raptor/libraptor.html

Constants

RAPTOR_IDENTIFIER_TYPE_ANONYMOUS
RAPTOR_IDENTIFIER_TYPE_LITERAL
RAPTOR_IDENTIFIER_TYPE_RESOURCE
RAPTOR_IDENTIFIER_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)`

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/v1.rb, line 123
def raptor_new_string(str)
  ptr = V1.raptor_alloc_memory(str.bytesize + 1)
  ptr.put_string(0, str)
  ptr
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/v1.rb, line 123
def raptor_new_string(str)
  ptr = V1.raptor_alloc_memory(str.bytesize + 1)
  ptr.put_string(0, str)
  ptr
end