aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/serd/node.h20
-rw-r--r--src/node.c24
2 files changed, 44 insertions, 0 deletions
diff --git a/include/serd/node.h b/include/serd/node.h
index 91550312..73be120e 100644
--- a/include/serd/node.h
+++ b/include/serd/node.h
@@ -223,6 +223,26 @@ serd_new_blob(const void* SERD_NONNULL buf, size_t size, bool wrap_lines);
SERD_API SerdNode
serd_node_copy(const SerdNode* SERD_NULLABLE node);
+/// Return the type of a node
+SERD_PURE_API
+SerdNodeType
+serd_node_type(const SerdNode* SERD_NONNULL node);
+
+/// Return the length of a node's string in bytes, excluding the terminator
+SERD_PURE_API
+size_t
+serd_node_length(const SerdNode* SERD_NONNULL node);
+
+/// Return the additional flags of a node
+SERD_PURE_API
+SerdNodeFlags
+serd_node_flags(const SerdNode* SERD_NONNULL node);
+
+/// Return the string contents of a node
+SERD_PURE_API
+const char* SERD_NONNULL
+serd_node_string(const SerdNode* SERD_NONNULL node);
+
/// Return true iff `a` is equal to `b`
SERD_PURE_API
bool
diff --git a/src/node.c b/src/node.c
index db814233..63e4b486 100644
--- a/src/node.c
+++ b/src/node.c
@@ -379,6 +379,30 @@ serd_new_blob(const void* const buf, const size_t size, const bool wrap_lines)
return node;
}
+SerdNodeType
+serd_node_type(const SerdNode* const node)
+{
+ return node->type;
+}
+
+const char*
+serd_node_string(const SerdNode* const node)
+{
+ return node->buf;
+}
+
+size_t
+serd_node_length(const SerdNode* const node)
+{
+ return node->n_bytes;
+}
+
+SerdNodeFlags
+serd_node_flags(const SerdNode* const node)
+{
+ return node->flags;
+}
+
void
serd_node_free(SerdNode* const node)
{