diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/serd/serd.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index cec77649..9ffb16fe 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -521,8 +521,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 - `serd_uri_string_length(uri)` on error. + @return The length of the written URI string (not including a null + terminator), which may be less than `serd_uri_string_length(uri)` on error. */ SERD_API size_t @@ -531,6 +531,29 @@ serd_write_uri(SerdURIView uri, void* SERD_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). +*/ +SERD_API +size_t +serd_write_file_uri(SerdStringView path, + SerdStringView hostname, + SerdWriteFunc SERD_NONNULL sink, + void* SERD_NONNULL stream); + +/** @} @defgroup serd_node Node @{ |