summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-27 22:26:55 +0000
committerDavid Robillard <d@drobilla.net>2011-09-27 22:26:55 +0000
commit84ad1bf1317992127aac405feedbfd68c7be6697 (patch)
tree63884c6150f4b06c3faf2cdc086136fa2fde76da
parent5ea6caf8ec6e06b71f14e4a8ac33b29ada7a1518 (diff)
downloadsord-84ad1bf1317992127aac405feedbfd68c7be6697.tar.gz
sord-84ad1bf1317992127aac405feedbfd68c7be6697.tar.bz2
sord-84ad1bf1317992127aac405feedbfd68c7be6697.zip
Add function sord_write_iter for writing a queried range.
git-svn-id: http://svn.drobilla.net/sord/trunk@162 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r--ChangeLog1
-rw-r--r--sord/sord.h10
-rw-r--r--src/syntax.c12
-rw-r--r--wscript2
4 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 719aad5..932ffb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
sord (UNRELEASED) unstable; urgency=low
* Add function sord_contains for checking for a triple pattern
+ * Add function sord_write_iter for writing a queried range
* Fix Sord::Namespaces::qualify to no longer chop prefixes
* Add ability to build static library
diff --git a/sord/sord.h b/sord/sord.h
index f76bc0e..d380da2 100644
--- a/sord/sord.h
+++ b/sord/sord.h
@@ -462,6 +462,16 @@ sord_write(SordModel* model,
SordNode* graph);
/**
+ Write a range to a writer.
+
+ This increments @c iter to its end, then frees it.
+*/
+SORD_API
+bool
+sord_write_iter(SordIter* iter,
+ SerdWriter* writer);
+
+/**
@}
@}
*/
diff --git a/src/syntax.c b/src/syntax.c
index 93e1331..ac87ad4 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -181,6 +181,18 @@ sord_write(SordModel* model,
{
SordQuad pat = { 0, 0, 0, graph };
SordIter* iter = sord_find(model, pat);
+ return sord_write_iter(iter, writer);
+}
+
+bool
+sord_write_iter(SordIter* iter,
+ SerdWriter* writer)
+{
+ if (!iter) {
+ return false;
+ }
+
+ SordModel* model = (SordModel*)sord_iter_get_model(iter);
for (; !sord_iter_end(iter); sord_iter_next(iter)) {
SordQuad tup;
sord_iter_get(iter, tup);
diff --git a/wscript b/wscript
index ca5608b..7a1188d 100644
--- a/wscript
+++ b/wscript
@@ -6,7 +6,7 @@ from waflib.extras import autowaf as autowaf
import waflib.Logs as Logs, waflib.Options as Options
# Version of this package (even if built as a child)
-SORD_VERSION = '0.4.3'
+SORD_VERSION = '0.5.0'
SORD_MAJOR_VERSION = '0'
# Library version (UNIX style major, minor, micro)