From 94d3433dcf0e77d2c867c9a2dd6928acfea4184c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 24 Feb 2021 15:49:21 -0500 Subject: Add serd_node_uri_view() --- include/serd/node.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/serd/node.h b/include/serd/node.h index 75725516..1c64b6b9 100644 --- a/include/serd/node.h +++ b/include/serd/node.h @@ -250,6 +250,20 @@ serd_node_string(const SerdNode* SERD_NONNULL node); SERD_PURE_API SerdStringView serd_node_string_view(const SerdNode* SERD_NONNULL node); +/** + Return a parsed view of the URI in a node. + + It is best to check the node type before calling this function, though it is + safe to call on non-URI nodes. In that case, it will return a null view + with all fields zero. + + Note that this parses the URI string contained in the node, so it is a good + idea to keep the value if you will be using it several times in the same + scope. +*/ +SERD_API SerdURIView +serd_node_uri_view(const SerdNode* SERD_NONNULL node); + /** @} @defgroup serd_node_operators Operators -- cgit v1.2.1