diff options
author | David Robillard <d@drobilla.net> | 2021-07-17 13:19:27 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-14 19:37:51 -0500 |
commit | 21f17ad27b3e805003e50b0f5fcbe606bfef0f3b (patch) | |
tree | 7ccce960e8862e7cf5d2a62296c2d1f67221a01b /include | |
parent | 07b716c38625dd954be279e3476164b5bb1d6293 (diff) | |
download | serd-21f17ad27b3e805003e50b0f5fcbe606bfef0f3b.tar.gz serd-21f17ad27b3e805003e50b0f5fcbe606bfef0f3b.tar.bz2 serd-21f17ad27b3e805003e50b0f5fcbe606bfef0f3b.zip |
Factor out serd_write_file_uri()
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 @{ |