diff options
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 97 |
1 files changed, 30 insertions, 67 deletions
diff --git a/serd/serd.h b/serd/serd.h index 3fbe99e4..de090cf4 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -71,16 +71,6 @@ typedef struct SerdEnvImpl SerdEnv; typedef struct SerdReaderImpl SerdReader; /** - Read state. - - This maintains the state necessary to fully resolve URIs during a read - (e.g. the base URI and prefixes). It is implemented separately from - SerdReader to avoid overhead in situations where this is unnecessary - (e.g. streaming re-serialisation). -*/ -typedef struct SerdReadStateImpl SerdReadState; - -/** RDF writer. Provides a number of functions to allow writing RDF syntax out to some @@ -426,16 +416,32 @@ void serd_env_free(SerdEnv* env); /** - Add namespace @a uri to @a ns using prefix @a name. + Get the current base URI. */ SERD_API -void -serd_env_add(SerdEnv* env, - const SerdNode* name, - const SerdNode* uri); +const SerdNode* +serd_env_get_base_uri(SerdEnv* state, + SerdURI* out); + +/** + Set the current base URI. +*/ +SERD_API +SerdStatus +serd_env_set_base_uri(SerdEnv* state, + const SerdNode* uri_node); + +/** + Set a namespace prefix. +*/ +SERD_API +SerdStatus +serd_env_set_prefix(SerdEnv* env, + const SerdNode* name, + const SerdNode* uri); /** - Qualify @a into a CURIE if possible. + Qualify @a uri into a CURIE if possible. */ SERD_API bool @@ -455,6 +461,14 @@ serd_env_expand(const SerdEnv* env, SerdChunk* uri_suffix); /** + Expand @a node, which must be a CURIE or URI, to a full URI. +*/ +SERD_API +SerdNode +serd_env_expand_node(SerdEnv* env, + const SerdNode* node); + +/** Call @a func for each prefix defined in @a env. */ SERD_API @@ -519,57 +533,6 @@ void serd_reader_free(SerdReader* reader); /** - Create a new read state with the given initial base URI and environment. - - A reference to @a env will be kept, and @a env will be modified as the - state is modified. -*/ -SERD_API -SerdReadState* -serd_read_state_new(SerdEnv* env, - const uint8_t* base_uri_str); - -/** - Free @a state. -*/ -SERD_API -void -serd_read_state_free(SerdReadState* state); - -/** - Expand @a node, which must be a CURIE or URI, to a full URI. -*/ -SERD_API -SerdNode -serd_read_state_expand(SerdReadState* state, - const SerdNode* node); - -/** - Get the current base URI. -*/ -SERD_API -const SerdNode* -serd_read_state_get_base_uri(SerdReadState* state, - SerdURI* out); - -/** - Set the current base URI. -*/ -SERD_API -SerdStatus -serd_read_state_set_base_uri(SerdReadState* state, - const SerdNode* uri_node); - -/** - Set a namespace prefix. -*/ -SERD_API -SerdStatus -serd_read_state_set_prefix(SerdReadState* state, - const SerdNode* name, - const SerdNode* uri_node); - -/** @} @name Writer @{ |