aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-09-04 15:03:11 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commit1fb84760a8230637a806e8e83410fc7fb6d446d2 (patch)
tree47ec80aef823da8d5c840cd053e4189dcabc8258 /include
parentb3892cb6e4963e1bbeb346a8124101b7c3cf379b (diff)
downloadserd-1fb84760a8230637a806e8e83410fc7fb6d446d2.tar.gz
serd-1fb84760a8230637a806e8e83410fc7fb6d446d2.tar.bz2
serd-1fb84760a8230637a806e8e83410fc7fb6d446d2.zip
Add "contextual" output option
This is mainly for developer or power-user cases, where one wants to look at some data for investigation or debugging. In such cases, it's common for the set of prefixes to be implicitly known (because they are baked in to the application, for example), so printing them just produces a large amount of redundant noise. That said, it can also be useful programmatically, because it allows several snippets to be written independently and ultimately concatenated (with a header to define the prefixes) without redundancy.
Diffstat (limited to 'include')
-rw-r--r--include/serd/serd.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 6324c06e..9eb84a6a 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -2589,7 +2589,16 @@ typedef enum {
This disables the special "a" syntax in Turtle and TriG.
*/
- SERD_WRITE_RDF_TYPE = 1u << 5u
+ SERD_WRITE_RDF_TYPE = 1u << 5u,
+
+ /**
+ Suppress writing directives that describe the context.
+
+ This writes data as usual, but suppresses writing `prefix` directives in
+ Turtle and TriG. The resulting output is a fragment of a document with
+ implicit context, so it will only be readable in a suitable enviromnent.
+ */
+ SERD_WRITE_CONTEXTUAL = 1u << 6u
} SerdWriterFlag;
/// Bitwise OR of SerdWriterFlag values