diff options
author | David Robillard <d@drobilla.net> | 2011-05-06 16:15:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-06 16:15:45 +0000 |
commit | a091efde0ab75c2ec2bfbb42cad083287fa891bc (patch) | |
tree | ef46a7aebe9606262abba249ffdcbce89a00a41d | |
parent | 1e636d1b28296511d7852b700c4ee9cc136fb7ec (diff) | |
download | sord-a091efde0ab75c2ec2bfbb42cad083287fa891bc.tar.gz sord-a091efde0ab75c2ec2bfbb42cad083287fa891bc.tar.bz2 sord-a091efde0ab75c2ec2bfbb42cad083287fa891bc.zip |
Update for new Serd API
git-svn-id: http://svn.drobilla.net/sord/trunk@106 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r-- | sord/sordmm.hpp | 2 | ||||
-rw-r--r-- | src/syntax.c | 29 |
2 files changed, 15 insertions, 16 deletions
diff --git a/sord/sordmm.hpp b/sord/sordmm.hpp index 8977dc1..5345b92 100644 --- a/sord/sordmm.hpp +++ b/sord/sordmm.hpp @@ -75,7 +75,7 @@ public: const std::string& uri) { const SerdNode name_node = string_to_node(SERD_LITERAL, name); const SerdNode uri_node = string_to_node(SERD_URI, uri); - serd_env_add(_c_obj, &name_node, &uri_node); + serd_env_set_prefix(_c_obj, &name_node, &uri_node); } inline std::string qualify(std::string uri) const { diff --git a/src/syntax.c b/src/syntax.c index 1c925c9..937de7d 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -26,12 +26,11 @@ #include "sord_internal.h" typedef struct { - SerdReader* reader; - SerdEnv* env; - SerdReadState* read_state; - SordNode* graph_uri_node; - SordWorld* world; - SordModel* sord; + SerdReader* reader; + SerdEnv* env; + SordNode* graph_uri_node; + SordWorld* world; + SordModel* sord; } ReadState; static uint8_t* @@ -50,7 +49,7 @@ event_base(void* handle, { ReadState* const state = (ReadState*)handle; - return serd_read_state_set_base_uri(state->read_state, uri_node); + return serd_env_set_base_uri(state->env, uri_node); } static SerdStatus @@ -60,7 +59,7 @@ event_prefix(void* handle, { ReadState* const state = (ReadState*)handle; - return serd_read_state_set_prefix(state->read_state, name, uri_node); + return serd_env_set_prefix(state->env, name, uri_node); } static inline SordNode* @@ -83,7 +82,7 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn, return ret; case SERD_URI: { SerdURI base_uri; - serd_read_state_get_base_uri(state->read_state, &base_uri); + serd_env_get_base_uri(state->env, &base_uri); SerdURI abs_uri; SerdNode abs_uri_node = serd_node_new_uri_from_node( sn, &base_uri, &abs_uri); @@ -244,9 +243,10 @@ sord_read_file_handle(SordModel* model, SerdEnv* env = serd_env_new(); - SerdReadState* read_state = serd_read_state_new(env, base_uri_str); + SerdNode base_uri_node = serd_node_from_string(SERD_URI, base_uri_str); + serd_env_set_base_uri(env, &base_uri_node); - ReadState state = { NULL, env, read_state, graph, + ReadState state = { NULL, env, graph, sord_get_world(model), model }; state.reader = serd_reader_new( @@ -260,7 +260,6 @@ sord_read_file_handle(SordModel* model, const SerdStatus ret = serd_reader_read_file(state.reader, fd, base_uri_str); serd_reader_free(state.reader); - serd_read_state_free(state.read_state); serd_env_free(env); free(base_uri_str); @@ -283,9 +282,10 @@ sord_read_string(SordModel* model, SerdEnv* env = serd_env_new(); - SerdReadState* read_state = serd_read_state_new(env, base_uri_str); + SerdNode base_uri_node = serd_node_from_string(SERD_URI, base_uri_str); + serd_env_set_base_uri(env, &base_uri_node); - ReadState state = { NULL, env, read_state, NULL, + ReadState state = { NULL, env, NULL, sord_get_world(model), model }; state.reader = serd_reader_new( @@ -295,7 +295,6 @@ sord_read_string(SordModel* model, const SerdStatus status = serd_reader_read_string(state.reader, str); serd_reader_free(state.reader); - serd_read_state_free(state.read_state); serd_env_free(env); free(base_uri_str); |