diff options
author | David Robillard <d@drobilla.net> | 2011-05-06 16:09:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-06 16:09:58 +0000 |
commit | 246aa2aca72b5580ceae29487c80a2dee567bde2 (patch) | |
tree | 72be9600b8687c8208eeb687cd79c53aaa7e6d88 /serd | |
parent | 6bd8d39e12801d21fbf59da2da08602aab9eff32 (diff) | |
download | serd-246aa2aca72b5580ceae29487c80a2dee567bde2.tar.gz serd-246aa2aca72b5580ceae29487c80a2dee567bde2.tar.bz2 serd-246aa2aca72b5580ceae29487c80a2dee567bde2.zip |
Merge SerdEnv and SerdReadState.
git-svn-id: http://svn.drobilla.net/serd/trunk@163 490d8e77-9747-427b-9fa3-0b8f29cee8a0
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 @{ |