From 29f0cefc019e8e93e8ae9bb016c8dc93711173a0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 13 Jun 2018 15:18:27 -0400 Subject: Shorten node constructor names --- serd/serd.h | 54 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'serd') diff --git a/serd/serd.h b/serd/serd.h index 4ad187b0..7b295f7b 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -352,7 +352,7 @@ serd_strtod(const char* str, size_t* end); /** Decode a base64 string. This function can be used to deserialise a blob node created with - serd_node_new_blob(). + serd_new_blob(). @param str Base64 string to decode. @param len The length of `str`. @@ -526,33 +526,42 @@ serd_uri_serialise_relative(const SerdURI* uri, */ SERD_API SerdNode* -serd_node_new_string(const char* str); +serd_new_string(const char* str); /** - Create a new literal node from `str`. + Create a new plain literal node from `str`. - Either `datatype` or `lang` can be given, but not both, unless `datatype` is - rdf:langString in which case it is ignored. + A plain literal has no datatype, but may have a language tag. The `lang` + may be NULL, in which case this is equivalent to `serd_new_string()`. */ SERD_API SerdNode* -serd_node_new_literal(const char* str, - const SerdNode* datatype, - const char* lang); +serd_new_plain_literal(const char* str, const char* lang); + +/** + Create a new typed literal node from `str`. + + A typed literal has no language tag, but may have a datatype. The + `datatype` may be NULL, in which case this is equivalent to + `serd_new_string()`. +*/ +SERD_API +SerdNode* +serd_new_typed_literal(const char* str, const SerdNode* datatype); /** Create a new blank node. */ SERD_API SerdNode* -serd_node_new_blank(const char* str); +serd_new_blank(const char* str); /** Create a new CURIE node. */ SERD_API SerdNode* -serd_node_new_curie(const char* str); +serd_new_curie(const char* str); /** Return a deep copy of `node`. @@ -573,14 +582,14 @@ serd_node_equals(const SerdNode* a, const SerdNode* b); */ SERD_API SerdNode* -serd_node_new_uri(const char* str); +serd_new_uri(const char* str); /** Create a new URI from a string, resolved against a base URI. */ SERD_API SerdNode* -serd_node_new_resolved_uri(const char* str, const SerdNode* base); +serd_new_resolved_uri(const char* str, const SerdNode* base); /** Resolve `node` against `base`. @@ -603,7 +612,7 @@ serd_node_resolve(const SerdNode* node, const SerdNode* base); */ SERD_API SerdNode* -serd_node_new_file_uri(const char* path, const char* hostname, bool escape); +serd_new_file_uri(const char* path, const char* hostname, bool escape); /** Create a new URI from a string, relative to a base URI. @@ -620,9 +629,9 @@ serd_node_new_file_uri(const char* path, const char* hostname, bool escape); */ SERD_API SerdNode* -serd_node_new_relative_uri(const char* str, - const SerdNode* base, - const SerdNode* root); +serd_new_relative_uri(const char* str, + const SerdNode* base, + const SerdNode* root); /** Create a new node by serialising `d` into an xsd:decimal string. @@ -645,7 +654,7 @@ serd_node_new_relative_uri(const char* str, */ SERD_API SerdNode* -serd_node_new_decimal(double d, unsigned frac_digits, const SerdNode* datatype); +serd_new_decimal(double d, unsigned frac_digits, const SerdNode* datatype); /** Create a new node by serialising `i` into an xsd:integer string. @@ -657,7 +666,7 @@ serd_node_new_decimal(double d, unsigned frac_digits, const SerdNode* datatype); */ SERD_API SerdNode* -serd_node_new_integer(int64_t i, const SerdNode* datatype); +serd_new_integer(int64_t i, const SerdNode* datatype); /** Create a node by serialising `buf` into an xsd:base64Binary string. @@ -674,10 +683,11 @@ serd_node_new_integer(int64_t i, const SerdNode* datatype); type xsd:base64Binary. */ SERD_API -SerdNode* serd_node_new_blob(const void* buf, - size_t size, - bool wrap_lines, - const SerdNode* datatype); +SerdNode* +serd_new_blob(const void* buf, + size_t size, + bool wrap_lines, + const SerdNode* datatype); /** Return the type of a node (SERD_URI, SERD_BLANK, or SERD_LITERAL). -- cgit v1.2.1