diff options
Diffstat (limited to 'include/serd/sink.h')
-rw-r--r-- | include/serd/sink.h | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/include/serd/sink.h b/include/serd/sink.h index 95979b50..09fa7858 100644 --- a/include/serd/sink.h +++ b/include/serd/sink.h @@ -5,6 +5,7 @@ #define SERD_SINK_H #include "serd/attributes.h" +#include "serd/event.h" #include "serd/node.h" #include "serd/statement.h" #include "serd/status.h" @@ -63,39 +64,23 @@ typedef void (*SerdFreeFunc)(void* SERD_NULLABLE ptr); /** Create a new sink. - Initially, the sink has no set functions and will do nothing. Use the - serd_sink_set_*_func functions to set handlers for various events. - @param handle Opaque handle that will be passed to sink functions. + @param event_func Function that will be called for every event. @param free_handle Free function to call on handle in serd_sink_free(). */ SERD_API SerdSink* SERD_ALLOCATED -serd_sink_new(void* SERD_NULLABLE handle, - SerdFreeFunc SERD_NULLABLE free_handle); +serd_sink_new(void* SERD_NULLABLE handle, + SerdEventFunc SERD_NULLABLE event_func, + SerdFreeFunc SERD_NULLABLE free_handle); /// Free `sink` SERD_API void serd_sink_free(SerdSink* SERD_NULLABLE sink); -/// Set a function to be called when the base URI changes -SERD_API SerdStatus -serd_sink_set_base_func(SerdSink* SERD_NONNULL sink, - SerdBaseFunc SERD_NULLABLE base_func); - -/// Set a function to be called when a namespace prefix is defined -SERD_API SerdStatus -serd_sink_set_prefix_func(SerdSink* SERD_NONNULL sink, - SerdPrefixFunc SERD_NULLABLE prefix_func); - -/// Set a function to be called when a statement is emitted -SERD_API SerdStatus -serd_sink_set_statement_func(SerdSink* SERD_NONNULL sink, - SerdStatementFunc SERD_NULLABLE statement_func); - -/// Set a function to be called when an anonymous node ends +/// Send an event to the sink SERD_API SerdStatus -serd_sink_set_end_func(SerdSink* SERD_NONNULL sink, - SerdEndFunc SERD_NULLABLE end_func); +serd_sink_write_event(const SerdSink* SERD_NONNULL sink, + const SerdEvent* SERD_NONNULL event); /// Set the base URI SERD_API SerdStatus |