aboutsummaryrefslogtreecommitdiffstats
path: root/src/node.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-12 20:49:54 +0200
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commitdd63c46261f36de5c6dbd951ae1c535128f5cf8c (patch)
tree507f379857b2bf90a968bc34a2f10ec4d5736ae5 /src/node.c
parent768c05325077776124cabbc01c54f2a511865ebc (diff)
downloadserd-dd63c46261f36de5c6dbd951ae1c535128f5cf8c.tar.gz
serd-dd63c46261f36de5c6dbd951ae1c535128f5cf8c.tar.bz2
serd-dd63c46261f36de5c6dbd951ae1c535128f5cf8c.zip
Make it possible to allocate nodes with CURIE datatypes
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/node.c b/src/node.c
index 8323e036..566e8839 100644
--- a/src/node.c
+++ b/src/node.c
@@ -238,6 +238,7 @@ serd_new_plain_literal_i(const SerdStringView str,
SerdNode*
serd_new_typed_literal_expanded(const SerdStringView str,
const SerdNodeFlags flags,
+ const SerdNodeType datatype_type,
const SerdStringView datatype_prefix,
const SerdStringView datatype_suffix)
{
@@ -255,7 +256,7 @@ serd_new_typed_literal_expanded(const SerdStringView str,
char* const datatype_buf = serd_node_buffer(datatype_node);
datatype_node->n_bytes = datatype_uri_len;
- datatype_node->type = SERD_URI;
+ datatype_node->type = datatype_type;
memcpy(datatype_buf, datatype_prefix.buf, datatype_prefix.len);
memcpy(datatype_buf + datatype_prefix.len,
datatype_suffix.buf,
@@ -300,14 +301,15 @@ serd_new_typed_literal_uri(const SerdStringView str,
static SerdNode*
serd_new_typed_literal_i(const SerdStringView str,
SerdNodeFlags flags,
- const SerdStringView datatype_uri)
+ SerdNodeType datatype_type,
+ const SerdStringView datatype)
{
assert(str.len);
- assert(datatype_uri.len);
- assert(strcmp(datatype_uri.buf, NS_RDF "langString"));
+ assert(datatype.len);
+ assert(strcmp(datatype.buf, NS_RDF "langString"));
return serd_new_typed_literal_expanded(
- str, flags, datatype_uri, SERD_EMPTY_STRING());
+ str, flags, datatype_type, datatype, SERD_EMPTY_STRING());
}
SerdNode*
@@ -338,7 +340,7 @@ serd_new_typed_literal(const SerdStringView str,
SerdNodeFlags flags = 0;
serd_strlen(str.buf, &flags);
- return serd_new_typed_literal_i(str, flags, datatype_uri);
+ return serd_new_typed_literal_i(str, flags, SERD_URI, datatype_uri);
}
SerdNode*