From c579186c5dd4e11bffddd353cef8978a66ef9c10 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Feb 2021 10:11:33 -0500 Subject: WIP: Simplify node construction --- include/serd/serd.h | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/serd/serd.h b/include/serd/serd.h index 68dec4f3..88d3178b 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -231,10 +231,9 @@ typedef enum { /// Flags indicating certain string properties relevant to serialisation typedef enum { - SERD_HAS_NEWLINE = 1u << 0u, ///< Contains line breaks ('\\n' or '\\r') - SERD_HAS_QUOTE = 1u << 1u, ///< Contains quotes ('"') - SERD_HAS_DATATYPE = 1u << 2u, ///< Literal node has datatype - SERD_HAS_LANGUAGE = 1u << 3u ///< Literal node has language + SERD_IS_LONG_LITERAL = 1u << 1u, ///< Literal node uses triple quotes + SERD_HAS_DATATYPE = 1u << 2u, ///< Literal node has datatype + SERD_HAS_LANGUAGE = 1u << 3u, ///< Literal node has language } SerdNodeFlag; /// Bitwise OR of SerdNodeFlag values @@ -386,17 +385,6 @@ SERD_CONST_API const char* SERD_NONNULL serd_strerror(SerdStatus status); -/** - Measure a UTF-8 string. - - @return Length of `str` in bytes. - @param str A null-terminated UTF-8 string. - @param flags (Output) Set to the applicable flags. -*/ -SERD_API -size_t -serd_strlen(const char* SERD_NONNULL str, SerdNodeFlags* SERD_NULLABLE flags); - /** Decode a base64 string. @@ -790,10 +778,14 @@ serd_node_to_syntax(const SerdNode* SERD_NONNULL node, SerdSyntax syntax); /** Create a new "simple" node that is just a string. - This can be used to create blank, CURIE, or URI nodes from an already - measured string or slice of a buffer, which avoids a strlen compared to the - friendly constructors. This may not be used for literals since those must - be measured to set the SERD_HAS_NEWLINE and SERD_HAS_QUOTE flags. + This can be used to create nodes from an already measured string or slice of + a buffer, which avoids measuring the string compared to the friendlier + constructors. If `type` is #SERD_LITERAL, then this creates a plain + literal with no language tag. + + @param type The type of node to create. + + @param string The string contents of the node. */ SERD_API SerdNode* SERD_ALLOCATED -- cgit v1.2.1