aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-02-20 10:11:33 -0500
committerDavid Robillard <d@drobilla.net>2021-03-08 23:36:35 -0500
commitc579186c5dd4e11bffddd353cef8978a66ef9c10 (patch)
treeb89f1059d161872ded394a5c620a3b4f156f7972 /include
parentc7a827b07898551611d43f92cf4e2fa53595957a (diff)
downloadserd-c579186c5dd4e11bffddd353cef8978a66ef9c10.tar.gz
serd-c579186c5dd4e11bffddd353cef8978a66ef9c10.tar.bz2
serd-c579186c5dd4e11bffddd353cef8978a66ef9c10.zip
WIP: Simplify node construction
Diffstat (limited to 'include')
-rw-r--r--include/serd/serd.h30
1 files changed, 11 insertions, 19 deletions
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
@@ -387,17 +386,6 @@ 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.
This function can be used to deserialise a blob node created with
@@ -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