aboutsummaryrefslogtreecommitdiffstats
path: root/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-04-01 20:33:33 +0200
committerDavid Robillard <d@drobilla.net>2019-12-19 20:52:21 -0500
commit401f7d696556c505cd2fad103fa724141e872743 (patch)
treec3a56bbe4d874e10e1dbe745b69ac6ebe80419f6 /serd
parentecaf0fc72f53a8d42909aa8d8d8be873500a0bc0 (diff)
downloadserd-401f7d696556c505cd2fad103fa724141e872743.tar.gz
serd-401f7d696556c505cd2fad103fa724141e872743.tar.bz2
serd-401f7d696556c505cd2fad103fa724141e872743.zip
Merge datatype and/or language into node
This moves closer to the sord API, and is more convenient in most cases.
Diffstat (limited to 'serd')
-rw-r--r--serd/serd.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/serd/serd.h b/serd/serd.h
index 89bce9cf..5c871453 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -194,8 +194,10 @@ typedef enum {
Flags indicating certain string properties relevant to serialisation.
*/
typedef enum {
- SERD_HAS_NEWLINE = 1, /**< Contains line breaks ('\\n' or '\\r') */
- SERD_HAS_QUOTE = 1 << 1 /**< Contains quotes ('"') */
+ SERD_HAS_NEWLINE = 1, /**< Contains line breaks ('\\n' or '\\r') */
+ SERD_HAS_QUOTE = 1 << 1, /**< Contains quotes ('"') */
+ SERD_HAS_DATATYPE = 1 << 2, /**< Literal node has datatype */
+ SERD_HAS_LANGUAGE = 1 << 3 /**< Literal node has language */
} SerdNodeFlag;
/**
@@ -453,6 +455,16 @@ SerdNode*
serd_node_new_substring(SerdType type, const char* str, size_t len);
/**
+ Create a new literal node from `str`.
+
+ Either `datatype` or `lang` can be given, but not both, unless `datatype` is
+ rdf:langString in which case it is ignored.
+*/
+SERD_API
+SerdNode*
+serd_node_new_literal(const char* str, const char* datatype, const char* lang);
+
+/**
Return a deep copy of `node`.
*/
SERD_API
@@ -595,6 +607,20 @@ size_t
serd_node_get_length(const SerdNode* node);
/**
+ Return the datatype of a literal node, or NULL.
+*/
+SERD_API
+const SerdNode*
+serd_node_get_datatype(const SerdNode* node);
+
+/**
+ Return the language tag of a literal node, or NULL.
+*/
+SERD_API
+const SerdNode*
+serd_node_get_language(const SerdNode* node);
+
+/**
Return the flags (string properties) of a node.
*/
SERD_API
@@ -653,9 +679,7 @@ typedef SerdStatus (*SerdStatementSink)(void* handle,
const SerdNode* graph,
const SerdNode* subject,
const SerdNode* predicate,
- const SerdNode* object,
- const SerdNode* object_datatype,
- const SerdNode* object_lang);
+ const SerdNode* object);
/**
Sink (callback) for anonymous node end markers.
@@ -1044,9 +1068,7 @@ serd_writer_write_statement(SerdWriter* writer,
const SerdNode* graph,
const SerdNode* subject,
const SerdNode* predicate,
- const SerdNode* object,
- const SerdNode* datatype,
- const SerdNode* lang);
+ const SerdNode* object);
/**
Mark the end of an anonymous node's description.