From 290be9610e32bb427dd0456e4b1e26526c479004 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Feb 2021 13:53:52 -0500 Subject: Add serd_node_string_view() --- include/serd/node.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/serd/node.h') diff --git a/include/serd/node.h b/include/serd/node.h index eb4f8c9e..75725516 100644 --- a/include/serd/node.h +++ b/include/serd/node.h @@ -5,6 +5,7 @@ #define SERD_NODE_H #include "serd/attributes.h" +#include "serd/string_view.h" #include "serd/uri.h" #include @@ -240,6 +241,15 @@ serd_node_flags(const SerdNode* SERD_NONNULL node); SERD_CONST_API const char* SERD_NONNULL serd_node_string(const SerdNode* SERD_NONNULL node); +/** + Return a view of the string in a node. + + This is a convenience wrapper for serd_node_string() and serd_node_length() + that can be used to get both in a single call. +*/ +SERD_PURE_API SerdStringView +serd_node_string_view(const SerdNode* SERD_NONNULL node); + /** @} @defgroup serd_node_operators Operators -- cgit v1.2.1