aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd/uri.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/serd/uri.h')
-rw-r--r--include/serd/uri.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/serd/uri.h b/include/serd/uri.h
index bee9fe78..7a63f183 100644
--- a/include/serd/uri.h
+++ b/include/serd/uri.h
@@ -7,9 +7,7 @@
#include "serd/attributes.h"
#include "serd/stream.h"
#include "serd/string_view.h"
-#include "zix/allocator.h"
#include "zix/attributes.h"
-#include "zix/string_view.h"
#include <stdbool.h>
#include <stddef.h>
@@ -145,7 +143,8 @@ serd_uri_string_length(SerdURIView uri);
@param sink Sink to write string output to.
@param stream Opaque user argument to pass to `sink`.
- @return The number of bytes written, which is less than
+ @return The length of the written URI string (not including a null
+ terminator, which is not written), which may be less than
`serd_uri_string_length(uri)` on error.
*/
SERD_API size_t
@@ -154,6 +153,28 @@ serd_write_uri(SerdURIView uri,
void* ZIX_NONNULL stream);
/**
+ Write a file URI to `sink` from a path and optional hostname.
+
+ Backslashes in Windows paths will be converted, and other characters will be
+ percent encoded as necessary.
+
+ If `path` is relative, `hostname` is ignored.
+
+ @param path File system path.
+ @param hostname Optional hostname.
+ @param sink Sink to write string output to.
+ @param stream Opaque user argument to pass to `sink`.
+
+ @return The length of the written URI string (not including a null
+ terminator, which is not written)
+*/
+SERD_API size_t
+serd_write_file_uri(SerdStringView path,
+ SerdStringView hostname,
+ SerdWriteFunc ZIX_NONNULL sink,
+ void* ZIX_NONNULL stream);
+
+/**
@}
*/