Sha256: 14df2dc204e892162d6385a2e7e8617825cc23f547318e2ca093f43b5701401f

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

module RDF::Raptor::FFI::V2
  ##
  # @see https://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

1 entries across 1 versions & 1 rubygems

Version Path
rdf-raptor-3.2.0 lib/rdf/raptor/ffi/v2/namespace.rb