diff options
author | David Robillard <d@drobilla.net> | 2022-07-15 11:25:21 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:07 -0500 |
commit | 1ce0154639ea329d0a085713e8e21b85aa8526d0 (patch) | |
tree | badc24e17cb45132edec317b84f9afdf385ed107 /include | |
parent | b7cce4a24dbc544129a9fabc44cb22025767f10b (diff) | |
download | serd-1ce0154639ea329d0a085713e8e21b85aa8526d0.tar.gz serd-1ce0154639ea329d0a085713e8e21b85aa8526d0.tar.bz2 serd-1ce0154639ea329d0a085713e8e21b85aa8526d0.zip |
Simplify SerdEnv API
Diffstat (limited to 'include')
-rw-r--r-- | include/serd/env.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/include/serd/env.h b/include/serd/env.h index ca02523b..2b2982f3 100644 --- a/include/serd/env.h +++ b/include/serd/env.h @@ -10,8 +10,6 @@ #include "serd/status.h" #include "serd/string_view.h" -#include <stdbool.h> - SERD_BEGIN_DECLS /** @@ -51,24 +49,24 @@ serd_env_set_prefix(SerdEnv* SERD_NONNULL env, SerdStringView name, SerdStringView uri); -/// Qualify `uri` into a CURIE if possible -SERD_API bool -serd_env_qualify(const SerdEnv* SERD_NULLABLE env, - const SerdNode* SERD_NONNULL uri, - const SerdNode* SERD_NULLABLE* SERD_NONNULL prefix, - SerdStringView* SERD_NONNULL suffix); +/** + Qualify `uri` into a CURIE if possible. + + Returns null if `uri` can not be qualified (usually because no corresponding + prefix is defined). +*/ +SERD_API SerdNode* SERD_ALLOCATED +serd_env_qualify(const SerdEnv* SERD_NULLABLE env, + const SerdNode* SERD_NULLABLE uri); /** - Expand `curie`. + Expand `node`, which must be a CURIE or URI, to a full URI. - Errors: SERD_BAD_ARG if `curie` is not valid, or SERD_BAD_CURIE if prefix is - not defined in `env`. + Returns null if `node` can not be expanded. */ -SERD_API SerdStatus +SERD_API SerdNode* SERD_ALLOCATED serd_env_expand(const SerdEnv* SERD_NULLABLE env, - const SerdNode* SERD_NULLABLE curie, - SerdStringView* SERD_NONNULL uri_prefix, - SerdStringView* SERD_NONNULL uri_suffix); + const SerdNode* SERD_NULLABLE node); /** Expand `node`, which must be a CURIE or URI, to a full URI. |