aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-01-02 21:09:00 -0500
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:29 -0500
commitfd735236cca8af5364f98e5587b2984b3d798378 (patch)
tree87cf0341c2ae48abd1b03d10f6e1dca0fca9de53
parent0b6260d46e57acfbe6f65301d9951836178bde6e (diff)
downloadserd-fd735236cca8af5364f98e5587b2984b3d798378.tar.gz
serd-fd735236cca8af5364f98e5587b2984b3d798378.tar.bz2
serd-fd735236cca8af5364f98e5587b2984b3d798378.zip
Expose serd_nodes_token()
-rw-r--r--include/serd/serd.h21
-rw-r--r--src/nodes.c2
2 files changed, 22 insertions, 1 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index c09494bc..7a280b64 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -1410,6 +1410,27 @@ serd_nodes_intern(SerdNodes* SERD_NONNULL nodes,
const SerdNode* SERD_NULLABLE node);
/**
+ Make a simple "token" node.
+
+ "Token" is just a shorthand used in this API to refer to a node that is not
+ a typed or tagged literal, that is, a node that is just one string. This
+ can be used to make URIs, blank nodes, variables, and simple string
+ literals.
+
+ Note that string literals constructed with this function will have no flags
+ set, and so will be written as "short" literals (not triple-quoted). To
+ construct long literals, use the more advanced serd_nodes_literal() with the
+ #SERD_IS_LONG flag.
+
+ A new node will be added if an equivalent node is not already in the set.
+*/
+SERD_API
+const SerdNode* SERD_ALLOCATED
+serd_nodes_token(SerdNodes* SERD_NONNULL nodes,
+ SerdNodeType type,
+ SerdStringView string);
+
+/**
Make a string node.
A new node will be added if an equivalent node is not already in the set.
diff --git a/src/nodes.c b/src/nodes.c
index c048863b..d488fc71 100644
--- a/src/nodes.c
+++ b/src/nodes.c
@@ -311,7 +311,7 @@ serd_nodes_manage_entry(SerdNodes* const nodes, NodesEntry* const entry)
return &entry->node;
}
-static const SerdNode*
+const SerdNode*
serd_nodes_token(SerdNodes* const nodes,
const SerdNodeType type,
const SerdStringView string)