aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-30 12:23:07 -0400
committerDavid Robillard <d@drobilla.net>2022-01-14 19:37:51 -0500
commit89612ec05f596d135640413e093251fb9691ca14 (patch)
tree9c3e3d4491e6eb694aa0d429ba52ad80b0a5dc17 /include/serd
parentcab9b5621b4db600376090f28fdc76c7ac6bd728 (diff)
downloadserd-89612ec05f596d135640413e093251fb9691ca14.tar.gz
serd-89612ec05f596d135640413e093251fb9691ca14.tar.bz2
serd-89612ec05f596d135640413e093251fb9691ca14.zip
Add support for converting literals to canonical form
Diffstat (limited to 'include/serd')
-rw-r--r--include/serd/serd.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index efa48543..fad9d070 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -217,6 +217,7 @@ typedef enum {
SERD_ERR_BAD_CALL, ///< Invalid call
SERD_ERR_BAD_URI, ///< Invalid or unresolved URI
SERD_ERR_BAD_INDEX, ///< No optimal model index available
+ SERD_ERR_INVALID, ///< Invalid data
} SerdStatus;
/**
@@ -1939,6 +1940,32 @@ serd_sink_write_end(const SerdSink* SERD_NONNULL sink,
/**
@}
+ @defgroup serd_canon Canon
+ @{
+*/
+
+/// Flags that control canonical node transformation
+typedef enum {
+ SERD_CANON_LAX = 1u << 0u, ///< Tolerate and pass through invalid input
+} SerdCanonFlag;
+
+/// Bitwise OR of SerdCanonFlag values
+typedef uint32_t SerdCanonFlags;
+
+/**
+ Return a new sink that transforms literals to canonical form where possible.
+
+ The returned sink acts like `target` in all respects, except literal nodes
+ in statements may be modified from the original.
+*/
+SERD_API
+SerdSink* SERD_ALLOCATED
+serd_canon_new(const SerdWorld* SERD_NULLABLE world,
+ const SerdSink* SERD_NONNULL target,
+ SerdCanonFlags flags);
+
+/**
+ @}
@defgroup serd_env Environment
@{
*/