aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd/env.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-11 18:44:03 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit3a4bd5f1b31cb5c1522d9e6c7222414342682467 (patch)
treef4d7f87260cdcdd39ad4051c113cadf149c4fa43 /include/serd/env.h
parent8c67f9eba47d30913749e607c440b170a5cbd804 (diff)
downloadserd-3a4bd5f1b31cb5c1522d9e6c7222414342682467.tar.gz
serd-3a4bd5f1b31cb5c1522d9e6c7222414342682467.tar.bz2
serd-3a4bd5f1b31cb5c1522d9e6c7222414342682467.zip
[WIP] Remove SERD_CURIE node datatype entirely
Diffstat (limited to 'include/serd/env.h')
-rw-r--r--include/serd/env.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/include/serd/env.h b/include/serd/env.h
index bfbda520..b4f908a9 100644
--- a/include/serd/env.h
+++ b/include/serd/env.h
@@ -61,32 +61,47 @@ serd_env_set_prefix(SerdEnv* ZIX_NONNULL env,
SerdStringView uri);
/**
- Qualify `uri` into a CURIE if possible.
+ Qualify `uri` into a prefix and suffix (like a CURIE) if possible.
- Returns null if `uri` can not be qualified (usually because no corresponding
- prefix is defined).
+ @param env Environment with prefixes to use.
+
+ @param uri URI to qualify.
+
+ @param prefix On success, pointed to a prefix string slice, which is only
+ valid until the next time `env` is mutated.
+
+ @param suffix On success, pointed to a suffix string slice, which is only
+ valid until the next time `env` is mutated.
+
+ @return #SERD_SUCCESS, or #SERD_FAILURE if `uri` can not be qualified with
+ `env`.
*/
-SERD_API SerdNode* ZIX_ALLOCATED
-serd_env_qualify(const SerdEnv* ZIX_NULLABLE env,
- const SerdNode* ZIX_NULLABLE uri);
+SERD_API SerdStatus
+serd_env_qualify(const SerdEnv* ZIX_NULLABLE env,
+ SerdStringView uri,
+ SerdStringView* ZIX_NONNULL prefix,
+ SerdStringView* ZIX_NONNULL suffix);
/**
- Expand `node`, which must be a CURIE or URI, to a full URI.
+ Expand `curie` to an absolute URI if possible.
+
+ For example, if `env` has the prefix "rdf" set to
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, then calling this with curie
+ "rdf:type" will produce <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>.
Returns null if `node` can not be expanded.
*/
SERD_API SerdNode* ZIX_ALLOCATED
-serd_env_expand(const SerdEnv* ZIX_NULLABLE env,
- const SerdNode* ZIX_NULLABLE node);
+serd_env_expand_curie(const SerdEnv* ZIX_NULLABLE env, SerdStringView curie);
/**
- Expand `node`, which must be a CURIE or URI, to a full URI.
+ Expand `node` to an absolute URI if possible.
Returns null if `node` can not be expanded.
*/
SERD_API SerdNode* ZIX_ALLOCATED
-serd_env_expand_node(const SerdEnv* ZIX_NULLABLE env,
- const SerdNode* ZIX_NONNULL node);
+serd_env_expand_node(const SerdEnv* ZIX_NULLABLE env,
+ const SerdNode* ZIX_NULLABLE node);
/// Write all prefixes in `env` to `sink`
SERD_API SerdStatus