aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-03-31 20:32:26 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit0db18e483f11ac2f9518d96e137d217040ed1339 (patch)
tree8c1c77bdae31d55f311c89356483e873be81bb90 /include
parenta1b677851274b7e5295962658e723cab007f9b85 (diff)
downloadserd-0db18e483f11ac2f9518d96e137d217040ed1339.tar.gz
serd-0db18e483f11ac2f9518d96e137d217040ed1339.tar.bz2
serd-0db18e483f11ac2f9518d96e137d217040ed1339.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/writer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/serd/writer.h b/include/serd/writer.h
index 5e8f5e6e..73f6fb0b 100644
--- a/include/serd/writer.h
+++ b/include/serd/writer.h
@@ -87,6 +87,15 @@ typedef enum {
This disables the special "a" syntax in Turtle and TriG.
*/
SERD_WRITE_LONGHAND = 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