diff options
-rw-r--r-- | serd/serd.h | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/serd/serd.h b/serd/serd.h index a5a3f882..f3d83515 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -324,6 +324,43 @@ serd_base64_decode(const uint8_t* str, size_t len, size_t* size); /** @} + @name Byte Streams + @{ +*/ + +/** + Function to detect I/O stream errors. + + Identical semantics to `ferror`. + + @return Non-zero if `stream` has encountered an error. +*/ +typedef int (*SerdStreamErrorFunc)(void* stream); + +/** + Source function for raw string input. + + Identical semantics to `fread`, but may set errno for more informative error + reporting than supported by SerdStreamErrorFunc. + + @param buf Output buffer. + @param size Size of a single element of data in bytes (always 1). + @param nmemb Number of elements to read. + @param stream Stream to read from (FILE* for fread). + @return Number of elements (bytes) read. +*/ +typedef size_t (*SerdSource)(void* buf, + size_t size, + size_t nmemb, + void* stream); + +/** + Sink function for raw string output. +*/ +typedef size_t (*SerdSink)(const void* buf, size_t len, void* stream); + +/** + @} @name URI @{ */ @@ -379,37 +416,6 @@ void serd_uri_resolve(const SerdURI* r, const SerdURI* base, SerdURI* t); /** - Function to detect I/O stream errors. - - Identical semantics to `ferror`. - - @return Non-zero if `stream` has encountered an error. -*/ -typedef int (*SerdStreamErrorFunc)(void* stream); - -/** - Source function for raw string input. - - Identical semantics to `fread`, but may set errno for more informative error - reporting than supported by SerdStreamErrorFunc. - - @param buf Output buffer. - @param size Size of a single element of data in bytes (always 1). - @param nmemb Number of elements to read. - @param stream Stream to read from (FILE* for fread). - @return Number of elements (bytes) read. -*/ -typedef size_t (*SerdSource)(void* buf, - size_t size, - size_t nmemb, - void* stream); - -/** - Sink function for raw string output. -*/ -typedef size_t (*SerdSink)(const void* buf, size_t len, void* stream); - -/** Serialise `uri` with a series of calls to `sink`. */ SERD_API |