aboutsummaryrefslogtreecommitdiffstats
path: root/serd/serd.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-03 20:55:00 +0000
committerDavid Robillard <d@drobilla.net>2012-03-03 20:55:00 +0000
commit7b022006c47586dc00ed8bca85fcb0bdf5f9465d (patch)
treea8aa0a2be9ee7341ff02730130b3291ab2dcaace /serd/serd.h
parent5d73ff3a0b529954e5192f892c21a4ad068905c9 (diff)
downloadserd-7b022006c47586dc00ed8bca85fcb0bdf5f9465d.tar.gz
serd-7b022006c47586dc00ed8bca85fcb0bdf5f9465d.tar.bz2
serd-7b022006c47586dc00ed8bca85fcb0bdf5f9465d.zip
Add serd_chunk_sink for easy writing to a string.
git-svn-id: http://svn.drobilla.net/serd/trunk@329 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'serd/serd.h')
-rw-r--r--serd/serd.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/serd/serd.h b/serd/serd.h
index 8cca4a3f..ba4e6fb5 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -696,13 +696,35 @@ serd_writer_free(SerdWriter* writer);
A convenience sink function for writing to a FILE*.
This function can be used as a SerdSink when writing to a FILE*. The
- associated @c stream parameter must be a FILE* opened for writing.
+ @c stream parameter must be a FILE* opened for writing.
*/
SERD_API
size_t
serd_file_sink(const void* buf, size_t len, void* stream);
/**
+ A convenience sink function for writing to a string.
+
+ This function can be used as a SerdSink to write to a SerdChunk which is
+ resized as necessary with realloc(). The @c stream parameter must point to
+ an initialized SerdChunk. When the write is finished, the string should be
+ retrieved with serd_chunk_sink_finish().
+*/
+SERD_API
+size_t
+serd_chunk_sink(const void* buf, size_t len, void* stream);
+
+/**
+ Finish a serialisation to a chunk with serd_chunk_sink().
+
+ The returned string is the result of the serialisation, which is NULL
+ terminated (by this function) and owned by the caller.
+*/
+SERD_API
+uint8_t*
+serd_chunk_sink_finish(SerdChunk* stream);
+
+/**
Set a prefix to be removed from matching blank node identifiers.
*/
SERD_API