aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/writer.c b/src/writer.c
index 4eb2b848..5c457566 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -89,6 +89,7 @@ static const SepRule rules[] = {
};
struct SerdWriterImpl {
+ SerdSink iface;
SerdSyntax syntax;
SerdStyle style;
SerdEnv* env;
@@ -114,6 +115,11 @@ typedef enum {
WRITE_LONG_STRING
} TextContext;
+static SerdStatus
+serd_writer_set_prefix(SerdWriter* writer,
+ const SerdNode* name,
+ const SerdNode* uri);
+
static bool
write_node(SerdWriter* writer,
const SerdNode* node,
@@ -689,7 +695,7 @@ write_list_obj(SerdWriter* writer,
return false;
}
-SerdStatus
+static SerdStatus
serd_writer_write_statement(SerdWriter* writer,
SerdStatementFlags flags,
const SerdNode* graph,
@@ -822,7 +828,7 @@ serd_writer_write_statement(SerdWriter* writer,
return SERD_SUCCESS;
}
-SerdStatus
+static SerdStatus
serd_writer_end_anon(SerdWriter* writer,
const SerdNode* node)
{
@@ -885,6 +891,13 @@ serd_writer_new(SerdSyntax syntax,
writer->empty = true;
writer->byte_sink = serd_byte_sink_new(
ssink, stream, (style & SERD_STYLE_BULK) ? SERD_PAGE_SIZE : 1);
+
+ writer->iface.handle = writer;
+ writer->iface.base = (SerdBaseSink)serd_writer_set_base_uri;
+ writer->iface.prefix = (SerdPrefixSink)serd_writer_set_prefix;
+ writer->iface.statement = (SerdStatementSink)serd_writer_write_statement;
+ writer->iface.end = (SerdEndSink)serd_writer_end_anon;
+
return writer;
}
@@ -983,6 +996,12 @@ serd_writer_free(SerdWriter* writer)
free(writer);
}
+const SerdSink*
+serd_writer_get_sink(SerdWriter* writer)
+{
+ return &writer->iface;
+}
+
SerdEnv*
serd_writer_get_env(SerdWriter* writer)
{