diff options
author | David Robillard <d@drobilla.net> | 2011-01-20 19:44:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-01-20 19:44:06 +0000 |
commit | 3433e155c739f6a081209ea7422b9fdc7f87a555 (patch) | |
tree | 1d193a947ecbac65c3aefc38e00b4d73f5d01146 /serd | |
parent | 57683c8352e4a545171f28047617df88a6d4c917 (diff) | |
download | serd-3433e155c739f6a081209ea7422b9fdc7f87a555.tar.gz serd-3433e155c739f6a081209ea7422b9fdc7f87a555.tar.bz2 serd-3433e155c739f6a081209ea7422b9fdc7f87a555.zip |
Add writer API.
git-svn-id: http://svn.drobilla.net/serd/trunk@14 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/serd/serd.h b/serd/serd.h index d59e3002..1dd49c65 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -55,6 +55,7 @@ extern "C" { typedef struct SerdNamespacesImpl* SerdNamespaces; ///< Set of namespaces typedef struct SerdReaderImpl* SerdReader; ///< RDF reader +typedef struct SerdWriterImpl* SerdWriter; ///< RDF writer /** RDF syntax */ typedef enum { @@ -182,10 +183,10 @@ serd_namespaces_add(SerdNamespaces ns, /** Expand @a qname. */ SERD_API bool -serd_namespaces_expand(SerdNamespaces ns, - const SerdString* qname, - SerdChunk* uri_prefix, - SerdChunk* uri_suffix); +serd_namespaces_expand(const SerdNamespaces ns, + const SerdString* qname, + SerdChunk* uri_prefix, + SerdChunk* uri_suffix); /** @} */ /** @name Reader @@ -241,16 +242,38 @@ serd_reader_free(SerdReader reader); * @{ */ -/** Write a node to @a file. */ +/** Create a new RDF writer. */ +SERD_API +SerdWriter +serd_writer_new(SerdSyntax syntax, + SerdNamespaces ns, + FILE* file, + const SerdURI* base_uri); + +/** Free @a writer. */ +SERD_API +void +serd_writer_free(SerdWriter writer); + +/** Set the base URI of writer. */ +SERD_API +void +serd_writer_set_base_uri(SerdWriter writer, + const SerdURI* uri); + +/** Write a statement. */ SERD_API bool -serd_write_node(FILE* file, - const SerdURI* base_uri, - SerdNamespaces ns, - SerdNodeType type, - const SerdString* str, - const SerdString* datatype, - const SerdString* lang); +serd_writer_write_statement(SerdWriter writer, + const SerdString* graph, + const SerdString* subject, + SerdNodeType subject_type, + const SerdString* predicate, + SerdNodeType predicate_type, + const SerdString* object, + SerdNodeType object_type, + const SerdString* object_datatype, + const SerdString* object_lang); /** @} */ |