Sha256: 7ade292b87e031d46b5631fc8e3e0b60d15c9bab1096c4dbbb60deae9dd86e0d

Contents?: true

Size: 993 Bytes

Versions: 6

Compression:

Stored size: 993 Bytes

Contents

module RDF::Raptor::FFI::V2
  ##
  # @see http://librdf.org/raptor/api/raptor2-section-xml-namespace.html
  class Namespace < ::FFI::Struct
    include RDF::Raptor::FFI
    # @see https://github.com/dajobe/raptor/blob/f4b2597d4279dcb283bf5c32e5435696fd28a8ec/src/raptor_internal.h#L428
    layout  :next, :pointer,
            :nstack, :pointer,
            :prefix, :string,
            :prefix_length, :int,
            :uri, :pointer,
            :depth, :int,
            :is_xml, :int,
            :is_rdf_ms, :int,
            :is_rdf_schema, :int

    def prefix
      self[:prefix].to_s
    end

    def prefix_length
      self[:prefix_length]
    end

    def uri
      RDF::URI.new(V2.raptor_uri_as_string(self[:uri]))
    end

    ##
    # Releases `libraptor` memory associated with this structure.
    #
    # @return [void]
    def free
      V2.raptor_free_namespace(self) unless ptr.null?
    end
    alias_method :release, :free
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rdf-raptor-3.1.0 lib/rdf/raptor/ffi/v2/namespace.rb
rdf-raptor-2.2.0 lib/rdf/raptor/ffi/v2/namespace.rb
rdf-raptor-2.0.0 lib/rdf/raptor/ffi/v2/namespace.rb
rdf-raptor-1.99.0 lib/rdf/raptor/ffi/v2/namespace.rb
rdf-raptor-1.2.1 lib/rdf/raptor/ffi/v2/namespace.rb
rdf-raptor-1.2.0 lib/rdf/raptor/ffi/v2/namespace.rb