diff options
author | David Robillard <d@drobilla.net> | 2018-12-29 17:36:15 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-06-21 18:12:04 +0200 |
commit | 87a0f519dce09e60bb378d278dff5ee7082d70f1 (patch) | |
tree | 273be45faf2dfca6d70e70b9e5afd437c08aa1b3 /serd | |
parent | 6344b9ffe89cd3662bef9b6eca3ad4cc56bb608c (diff) | |
download | serd-87a0f519dce09e60bb378d278dff5ee7082d70f1.tar.gz serd-87a0f519dce09e60bb378d278dff5ee7082d70f1.tar.bz2 serd-87a0f519dce09e60bb378d278dff5ee7082d70f1.zip |
Add Env to Sink
This isn't technically necessary for any sink, but is a pattern common to every
sink implementation in serd, so having it here reduces boilerplate and
parameters in user code.
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/serd/serd.h b/serd/serd.h index cb3d0707..f067bd08 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1089,10 +1089,11 @@ serd_env_write_prefixes(const SerdEnv* env, const SerdSink* sink); serd_sink_set_*_func functions to set handlers for various events. @param handle Opaque handle that will be passed to sink functions. + @param env Environment for sink, updated as base uri or prefixes change. */ SERD_API SerdSink* -serd_sink_new(void* handle); +serd_sink_new(void* handle, SerdEnv* env); /** Free `sink`. @@ -1102,6 +1103,13 @@ void serd_sink_free(SerdSink* sink); /** + Return the env used by `writer`. +*/ +SERD_API +const SerdEnv* +serd_sink_get_env(const SerdSink* sink); + +/** Set a function to be called when the base URI changes. */ SERD_API @@ -1330,13 +1338,6 @@ const SerdSink* serd_writer_get_sink(SerdWriter* writer); /** - Return the env used by `writer`. -*/ -SERD_API -SerdEnv* -serd_writer_get_env(SerdWriter* writer); - -/** A convenience sink function for writing to a string. This function can be used as a SerdSink to write to a SerdBuffer which is |