From 8de05b1e2f7849e47c8ac82452a2e038664e510e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 26 Dec 2018 11:54:21 -0500 Subject: Add serd_new_boolean() --- src/node.c | 8 ++++++++ src/static_nodes.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/node.c b/src/node.c index c38aee39..0d6eb19a 100644 --- a/src/node.c +++ b/src/node.c @@ -518,6 +518,14 @@ write_variant_literal(const void* const user_data, return r.status ? 0 : r.count; } +SerdNode* +serd_new_boolean(bool b) +{ + return serd_new_typed_literal(b ? SERD_STATIC_STRING("true") + : SERD_STATIC_STRING("false"), + serd_node_string_view(&serd_xsd_boolean.node)); +} + SerdNode* serd_new_decimal(const double d, const SerdNode* const datatype) { diff --git a/src/static_nodes.h b/src/static_nodes.h index 18950444..952c0634 100644 --- a/src/static_nodes.h +++ b/src/static_nodes.h @@ -32,6 +32,7 @@ typedef struct StaticNode { {sizeof(NS_XSD #name) - 1, 0, SERD_URI}, NS_XSD #name}; DEFINE_XSD_NODE(base64Binary) +DEFINE_XSD_NODE(boolean) DEFINE_XSD_NODE(decimal) DEFINE_XSD_NODE(integer) -- cgit v1.2.1