diff options
author | David Robillard <d@drobilla.net> | 2015-04-03 06:11:55 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-04-03 06:11:55 +0000 |
commit | 5ecd4d401e50eb3f86461eb48e41a01c1d40da55 (patch) | |
tree | f8ee587eb08a96dc9e1bbc81ce6169e0a5661b4d /src/server | |
parent | 85aaff2bf3420e7c4a1d4db3c093c589b0c25e78 (diff) | |
download | ingen-5ecd4d401e50eb3f86461eb48e41a01c1d40da55.tar.gz ingen-5ecd4d401e50eb3f86461eb48e41a01c1d40da55.tar.bz2 ingen-5ecd4d401e50eb3f86461eb48e41a01c1d40da55.zip |
Fix loading graphs with explicit/non-file URIs.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5650 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/ingen_lv2.cpp | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 6aa7bfc4..9e4b76fa 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -59,12 +59,10 @@ namespace Ingen { /** Record of a graph in this bundle. */ -struct LV2Graph { - LV2Graph(const std::string& u, const std::string& f); +struct LV2Graph : public Parser::ResourceRecord { + LV2Graph(const Parser::ResourceRecord& record); - const std::string uri; - const std::string filename; - LV2_Descriptor descriptor; + LV2_Descriptor descriptor; }; /** Ingen LV2 library. */ @@ -455,33 +453,19 @@ struct IngenPlugin { static Lib::Graphs find_graphs(const std::string& manifest_uri) { - Sord::World world; - const Sord::URI base(world, manifest_uri); - const Sord::Node nil; - const Sord::URI ingen_Graph (world, INGEN__Graph); - const Sord::URI rdf_type (world, NS_RDF "type"); - const Sord::URI rdfs_seeAlso(world, NS_RDFS "seeAlso"); + Sord::World world; + Parser parser; - SerdEnv* env = serd_env_new(sord_node_to_serd_node(base.c_obj())); - Sord::Model model(world, manifest_uri); - model.load_file(env, SERD_TURTLE, manifest_uri); + const std::set<Parser::ResourceRecord> resources = parser.find_resources( + world, + manifest_uri, + Raul::URI(INGEN__Graph)); Lib::Graphs graphs; - for (Sord::Iter i = model.find(nil, rdf_type, ingen_Graph); !i.end(); ++i) { - const Sord::Node graph = i.get_subject(); - Sord::Iter f = model.find(graph, rdfs_seeAlso, nil); - const std::string graph_uri = graph.to_c_string(); - if (!f.end()) { - const uint8_t* file_uri = f.get_object().to_u_string(); - uint8_t* file_path = serd_file_uri_parse(file_uri, NULL); - graphs.push_back( - SPtr<const LV2Graph>( - new LV2Graph(graph_uri, (const char*)file_path))); - free(file_path); - } + for (const auto& r : resources) { + graphs.push_back(SPtr<const LV2Graph>(new LV2Graph(r))); } - serd_env_free(env); return graphs; } @@ -805,9 +789,8 @@ ingen_extension_data(const char* uri) return NULL; } -LV2Graph::LV2Graph(const std::string& u, const std::string& f) - : uri(u) - , filename(f) +LV2Graph::LV2Graph(const Parser::ResourceRecord& record) + : Parser::ResourceRecord(record) { descriptor.URI = uri.c_str(); descriptor.instantiate = ingen_instantiate; |