diff options
author | David Robillard <d@drobilla.net> | 2018-02-04 18:35:41 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-12-19 10:18:59 -0500 |
commit | d56310496ba0999e1f80b39d7c1fb7ea707d60c6 (patch) | |
tree | 99c53ddb20058a728df356bc2c991dbc42db2b1a /serd | |
parent | 745d214ba0a1c0cdbfece6bd52a96f08a1c74b52 (diff) | |
download | serd-d56310496ba0999e1f80b39d7c1fb7ea707d60c6.tar.gz serd-d56310496ba0999e1f80b39d7c1fb7ea707d60c6.tar.bz2 serd-d56310496ba0999e1f80b39d7c1fb7ea707d60c6.zip |
Make nodes opaque
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/serd/serd.h b/serd/serd.h index 0909dcc7..91903c7e 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -213,12 +213,7 @@ typedef uint32_t SerdNodeFlags; /** A syntactic RDF node. */ -typedef struct { - const char* buf; /**< Value string */ - size_t n_bytes; /**< Size in bytes (not including null) */ - SerdNodeFlags flags; /**< Node flags (e.g. string properties) */ - SerdType type; /**< Node type */ -} SerdNode; +typedef struct SerdNodeImpl SerdNode; /** An unterminated immutable slice of a string. @@ -461,34 +456,25 @@ serd_uri_serialise_relative(const SerdURI* uri, @{ */ -static const SerdNode SERD_NODE_NULL = { NULL, 0, 0, SERD_NOTHING }; - /** - Make a (shallow) node from `str`. - - This measures, but does not copy, `str`. No memory is allocated. + Create a new node from `str`. */ SERD_API -SerdNode -serd_node_from_string(SerdType type, const char* str); +SerdNode* +serd_node_new_string(SerdType type, const char* str); /** - Make a (shallow) node from a prefix of `str`. - - This measures, but does not copy, `str`. No memory is allocated. - Note that the returned node may not be null terminated. + Create a new node from a prefix of `str`. */ SERD_API -SerdNode -serd_node_from_substring(SerdType type, const char* str, size_t len); +SerdNode* +serd_node_new_substring(SerdType type, const char* str, size_t len); /** - Make a deep copy of `node`. - - @return a node that the caller must free with serd_node_free(). + Return a deep copy of `node`. */ SERD_API -SerdNode +SerdNode* serd_node_copy(const SerdNode* node); /** @@ -502,7 +488,7 @@ serd_node_equals(const SerdNode* a, const SerdNode* b); Simple wrapper for serd_node_new_uri() to resolve a URI node. */ SERD_API -SerdNode +SerdNode* serd_node_new_uri_from_node(const SerdNode* uri_node, const SerdURI* base, SerdURI* out); @@ -511,7 +497,7 @@ serd_node_new_uri_from_node(const SerdNode* uri_node, Simple wrapper for serd_node_new_uri() to resolve a URI string. */ SERD_API -SerdNode +SerdNode* serd_node_new_uri_from_string(const char* str, const SerdURI* base, SerdURI* out); @@ -527,7 +513,7 @@ serd_node_new_uri_from_string(const char* str, If `out` is not NULL, it will be set to the parsed URI. */ SERD_API -SerdNode +SerdNode* serd_node_new_file_uri(const char* path, const char* hostname, SerdURI* out, @@ -544,7 +530,7 @@ serd_node_new_file_uri(const char* path, memory owned by the new returned node). */ SERD_API -SerdNode +SerdNode* serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out); /** @@ -560,7 +546,7 @@ serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out); memory owned by the new returned node). */ SERD_API -SerdNode +SerdNode* serd_node_new_relative_uri(const SerdURI* uri, const SerdURI* base, const SerdURI* root, @@ -582,14 +568,14 @@ serd_node_new_relative_uri(const SerdURI* uri, @param frac_digits The maximum number of digits after the decimal place. */ SERD_API -SerdNode +SerdNode* serd_node_new_decimal(double d, unsigned frac_digits); /** Create a new node by serialising `i` into an xsd:integer string. */ SERD_API -SerdNode +SerdNode* serd_node_new_integer(int64_t i); /** @@ -602,7 +588,7 @@ serd_node_new_integer(int64_t i); @param wrap_lines Wrap lines at 76 characters to conform to RFC 2045. */ SERD_API -SerdNode +SerdNode* serd_node_new_blob(const void* buf, size_t size, bool wrap_lines); /** @@ -758,10 +744,10 @@ serd_env_set_prefix_from_strings(SerdEnv* env, */ SERD_API bool -serd_env_qualify(const SerdEnv* env, - const SerdNode* uri, - SerdNode* prefix, - SerdStringView* suffix); +serd_env_qualify(const SerdEnv* env, + const SerdNode* uri, + const SerdNode** prefix, + SerdStringView* suffix); /** Expand `curie`. @@ -782,7 +768,7 @@ serd_env_expand(const SerdEnv* env, Returns null if `node` can not be expanded. */ SERD_API -SerdNode +SerdNode* serd_env_expand_node(const SerdEnv* env, const SerdNode* node); |