From d14a7d113628578b6ed065b08db6c92536f550bd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 10 Mar 2012 22:24:09 +0000 Subject: Add serd_writer_set_root_uri(), root parameter to serd_uri_serialise_relative(), and -r option to serdi, to enable writing URIs with up references (../) within a parent namespace. Resolve dot segments in serd_uri_resolve() instead of at write time. git-svn-id: http://svn.drobilla.net/serd/trunk@336 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- serd/serd.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'serd/serd.h') diff --git a/serd/serd.h b/serd/serd.h index 94679a46..40e47499 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -362,11 +362,16 @@ serd_uri_serialise(const SerdURI* uri, SerdSink sink, void* stream); /** Serialise @c uri relative to @c base with a series of calls to @c sink. + + The @c uri is written as a relative URI iff if it a child of @c base and @c + root. The optional @c root parameter must be a prefix of @c base and can be + used keep up-references ("../") within a certain namespace. */ SERD_API size_t serd_uri_serialise_relative(const SerdURI* uri, const SerdURI* base, + const SerdURI* root, SerdSink sink, void* stream); @@ -792,6 +797,21 @@ SerdStatus serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri); +/** + Set the current root URI. + + The root URI should be a prefix of the base URI. The path of the root URI + is the highest path any relative up-reference can refer to. For example, + with root and base , + will be written as <../>, but will be + written non-relatively as . If the root is not explicitly set, + it defaults to the base URI, so no up-references will be created at all. +*/ +SERD_API +SerdStatus +serd_writer_set_root_uri(SerdWriter* writer, + const SerdNode* uri); + /** Set a namespace prefix (and emit directive if applicable). -- cgit v1.2.1