diff options
author | David Robillard <d@drobilla.net> | 2020-08-12 20:49:54 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:06 -0500 |
commit | dd63c46261f36de5c6dbd951ae1c535128f5cf8c (patch) | |
tree | 507f379857b2bf90a968bc34a2f10ec4d5736ae5 | |
parent | 768c05325077776124cabbc01c54f2a511865ebc (diff) | |
download | serd-dd63c46261f36de5c6dbd951ae1c535128f5cf8c.tar.gz serd-dd63c46261f36de5c6dbd951ae1c535128f5cf8c.tar.bz2 serd-dd63c46261f36de5c6dbd951ae1c535128f5cf8c.zip |
Make it possible to allocate nodes with CURIE datatypes
-rw-r--r-- | src/env.c | 2 | ||||
-rw-r--r-- | src/node.c | 14 | ||||
-rw-r--r-- | src/node.h | 1 |
3 files changed, 10 insertions, 7 deletions
@@ -283,7 +283,7 @@ expand_literal(const SerdEnv* env, const SerdNode* node) SerdStringView suffix; if (!serd_env_expand_in_place(env, datatype, &prefix, &suffix)) { return serd_new_typed_literal_expanded( - serd_node_string_view(node), serd_node_flags(node), prefix, suffix); + serd_node_string_view(node), serd_node_flags(node), SERD_URI, prefix, suffix); } } else if (datatype && serd_node_type(datatype) == SERD_URI) { @@ -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* @@ -61,6 +61,7 @@ serd_new_resolved_uri(SerdStringView string, SerdURIView base_uri); SerdNode* SERD_ALLOCATED serd_new_typed_literal_expanded(SerdStringView str, SerdNodeFlags flags, + SerdNodeType datatype_type, SerdStringView datatype_prefix, SerdStringView datatype_suffix); |