diff options
author | David Robillard <d@drobilla.net> | 2011-12-12 05:10:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-12 05:10:49 +0000 |
commit | 22ac239266b01f067ece83eb6addcdc9f825780e (patch) | |
tree | 918516d71f7303d6e05699f8b60d20a6f6372409 /serd/serd.h | |
parent | e731c88e809459ef4adb4988e433d6be7b043aa6 (diff) | |
download | serd-22ac239266b01f067ece83eb6addcdc9f825780e.tar.gz serd-22ac239266b01f067ece83eb6addcdc9f825780e.tar.bz2 serd-22ac239266b01f067ece83eb6addcdc9f825780e.zip |
Make bulk writer internal and inlinable to avoid function call overhead in the writer.
git-svn-id: http://svn.drobilla.net/serd/trunk@254 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'serd/serd.h')
-rw-r--r-- | serd/serd.h | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/serd/serd.h b/serd/serd.h index 94499a4d..b20dacf2 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -239,7 +239,8 @@ typedef enum { SERD_STYLE_ABBREVIATED = 1, /**< Abbreviate triples when possible. */ SERD_STYLE_ASCII = 1 << 1, /**< Escape all non-ASCII characters. */ SERD_STYLE_RESOLVED = 1 << 2, /**< Resolve URIs against base URI. */ - SERD_STYLE_CURIED = 1 << 3 /**< Shorten URIs into CURIEs. */ + SERD_STYLE_CURIED = 1 << 3, /**< Shorten URIs into CURIEs. */ + SERD_STYLE_BULK = 1 << 4, /**< Write output in pages. */ } SerdStyle; /** @@ -267,55 +268,10 @@ serd_strlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags); /** @} - @name Sink - @{ -*/ - -/** - Sink function for raw string output. -*/ -typedef size_t (*SerdSink)(const void* buf, size_t len, void* stream); - -/** - Sink adapter that writes blocks to the target sink. - - This is itself a SerdSink which can be used with any SerdSink as a target to - transparently write chunked I/O to the output sink. This can significantly - improve write performance when the target is a file or similar resource. -*/ -typedef struct SerdBulkSinkImpl SerdBulkSink; - -/** - Create a new bulk sink adapter. - @param sink Target sink where completed blocks will be written. - @param stream Stream parameter for target sink. - @param block_size Size of blocks to write, and internal buffer size. -*/ -SERD_API -SerdBulkSink* -serd_bulk_sink_new(SerdSink sink, void* stream, size_t block_size); - -/** - Free a bulk sink adapter. -*/ -SERD_API -void -serd_bulk_sink_free(SerdBulkSink* bsink); - -/** - Write data to a bulk sink adapter. - - This function may safely be cast to SerdSink. -*/ -SERD_API -size_t -serd_bulk_sink_write(const void* buf, size_t len, SerdBulkSink* bsink); - -/** - @} @name URI @{ */ + static const SerdURI SERD_URI_NULL = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; /** @@ -347,6 +303,11 @@ void serd_uri_resolve(const SerdURI* uri, const SerdURI* base, SerdURI* out); /** + Sink function for raw string output. +*/ +typedef size_t (*SerdSink)(const void* buf, size_t len, void* stream); + +/** Serialise @c uri with a series of calls to @c sink. */ SERD_API |