diff options
author | David Robillard <d@drobilla.net> | 2012-05-08 23:51:51 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-08 23:51:51 +0000 |
commit | 4de86fdfb643dbe7113e261998c5e159f940b7d4 (patch) | |
tree | 0d6b86614f29b68bab7e662b779e474d2654d453 /serd/serd.h | |
parent | b05e48f333d27e434b82587d248824b98f47bcd5 (diff) | |
download | serd-4de86fdfb643dbe7113e261998c5e159f940b7d4.tar.gz serd-4de86fdfb643dbe7113e261998c5e159f940b7d4.tar.bz2 serd-4de86fdfb643dbe7113e261998c5e159f940b7d4.zip |
Add incremental read interface suitable for reading from infinite streams.
git-svn-id: http://svn.drobilla.net/serd/trunk@350 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'serd/serd.h')
-rw-r--r-- | serd/serd.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/serd/serd.h b/serd/serd.h index 807664dd..cc2365f4 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -705,6 +705,40 @@ serd_reader_read_file(SerdReader* reader, const uint8_t* uri); /** + Start an incremental read from a file handle. + + Iff @p bulk is true, @p file will be read a page at a time. This is more + efficient, but uses a page of memory and means that an entire page of input + must be ready before any callbacks will fire. To react as soon as input + arrives, set @p bulk to false. +*/ +SERD_API +SerdStatus +serd_reader_start_stream(SerdReader* me, + FILE* file, + const uint8_t* name, + bool bulk); + +/** + Read a single "chunk" of data during an incremental read. + + This function will read a single top level description, and return. This + may be a directive, statement, or several statements; essentially it reads + until a '.' is encountered. This is particularly useful for reading + directly from a pipe or socket. +*/ +SERD_API +SerdStatus +serd_reader_read_chunk(SerdReader* me); + +/** + Finish an incremental read from a file handle. +*/ +SERD_API +SerdStatus +serd_reader_end_stream(SerdReader* me); + +/** Read @c file. */ SERD_API |