From 926f29ed81a34a50c9221a2d562119db84a136cb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 May 2011 22:27:18 +0000 Subject: Create SerdNodeFlags typedef for flags. Expose serd_strlen. Make serd_node_copy tolerate a NULL parameter. git-svn-id: http://svn.drobilla.net/serd/trunk@168 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- serd/serd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'serd') diff --git a/serd/serd.h b/serd/serd.h index 1e7da13c..5c802a79 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -190,6 +190,11 @@ typedef enum { SERD_HAS_QUOTE = 1 << 1 /**< Contains quotes ('"') */ } SerdNodeFlag; +/** + Bitwise OR of SerdNodeFlag values. +*/ +typedef uint32_t SerdNodeFlags; + /** A syntactic RDF node. */ @@ -197,7 +202,7 @@ typedef struct { const uint8_t* buf; /**< Value string */ size_t n_bytes; /**< Size in bytes (including null) */ size_t n_chars; /**< Length in characters */ - uint32_t flags; /**< Bitwise OR of SerdNodeFlag values */ + SerdNodeFlags flags; /**< String properties */ SerdType type; /**< Node type */ } SerdNode; @@ -240,6 +245,17 @@ typedef enum { SERD_STYLE_CURIED = 1 << 3 /**< Shorten URIs into CURIEs. */ } SerdStyle; +/** + UTF-8 strlen. + @return Length of @c str in characters. + @param str A null-terminated UTF-8 string. + @param n_bytes (Output) Set to the size of @a str in bytes (incl. NULL). + @param flags (Output) Set to the applicable flags. +*/ +SERD_API +size_t +serd_strlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags); + /** @name URI @{ -- cgit v1.2.1