diff options
Diffstat (limited to 'include/serd/sink.h')
-rw-r--r-- | include/serd/sink.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/include/serd/sink.h b/include/serd/sink.h new file mode 100644 index 00000000..97b47a2f --- /dev/null +++ b/include/serd/sink.h @@ -0,0 +1,68 @@ +// Copyright 2011-2021 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#ifndef SERD_SINK_H +#define SERD_SINK_H + +#include "serd/attributes.h" +#include "serd/node.h" +#include "serd/statement.h" +#include "serd/status.h" + +SERD_BEGIN_DECLS + +/** + @defgroup serd_sink Sink + @ingroup serd_streaming + @{ +*/ + +/** + Sink function for base URI changes. + + Called whenever the base URI of the serialisation changes. +*/ +typedef SerdStatus (*SerdBaseFunc)(void* SERD_NULLABLE handle, + const SerdNode* SERD_NONNULL uri); + +/** + Sink function for namespace definitions. + + Called whenever a prefix is defined in the serialisation. +*/ +typedef SerdStatus (*SerdPrefixFunc)(void* SERD_NULLABLE handle, + const SerdNode* SERD_NONNULL name, + const SerdNode* SERD_NONNULL uri); + +/** + Sink function for statements. + + Called for every RDF statement in the serialisation. +*/ +typedef SerdStatus (*SerdStatementFunc)( + void* SERD_NULLABLE handle, + SerdStatementFlags flags, + const SerdNode* SERD_NULLABLE graph, + const SerdNode* SERD_NONNULL subject, + const SerdNode* SERD_NONNULL predicate, + const SerdNode* SERD_NONNULL object, + const SerdNode* SERD_NULLABLE object_datatype, + const SerdNode* SERD_NULLABLE object_lang); + +/** + Sink function for anonymous node end markers. + + This is called to indicate that the anonymous node with the given `value` + will no longer be referred to by any future statements (so the anonymous + node is finished). +*/ +typedef SerdStatus (*SerdEndFunc)(void* SERD_NULLABLE handle, + const SerdNode* SERD_NONNULL node); + +/** + @} +*/ + +SERD_END_DECLS + +#endif // SERD_SINK_H |