From 904d3d9b0bcdbb1507adccdde831db0d5f7ae251 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 29 Dec 2018 17:36:15 -0500 Subject: 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. --- serd/serd.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'serd') diff --git a/serd/serd.h b/serd/serd.h index 0346d32e..c0b22504 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1025,10 +1025,11 @@ serd_env_send_prefixes(const SerdEnv* env, 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`. @@ -1037,6 +1038,13 @@ SERD_API void serd_sink_free(SerdSink* sink); +/** + Return the env used by `writer`. +*/ +SERD_API +SerdEnv* +serd_sink_get_env(SerdSink* sink); + /** Set a function to be called when the base URI changes. */ -- cgit v1.2.1