diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/Loader.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp index a899fce..c50258c 100644 --- a/src/engine/Loader.cpp +++ b/src/engine/Loader.cpp @@ -50,6 +50,7 @@ SharedPtr<Machine> Loader::load(const Glib::ustring& uri) { using Redland::Query; + using Redland::QueryResults; using Glib::ustring; SharedPtr<Machine> machine; @@ -90,12 +91,13 @@ Loader::load(const Glib::ustring& uri) "?node :duration ?duration .\n" "}\n"); - Query::Results results = query.run(_rdf_world, model); + SharedPtr<QueryResults> results = query.run(_rdf_world, model); - for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - const char* node_id = (*i)["node"]; - SharedPtr<Node> node(new Node( - TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), (*i)["duration"].to_float()), + for (; !results->finished(); results->next()) { + const char* node_id = results->get("node"); + SharedPtr<Node> node( + new Node( + TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), results->get("duration").to_float()), true)); machine->add_node(node); created[node_id] = node; @@ -111,12 +113,12 @@ Loader::load(const Glib::ustring& uri) "}\n"); results = query.run(_rdf_world, model); - - for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - const char* node_id = (*i)["node"]; + + for (; !results->finished(); results->next()) { + const char* node_id = results->get("node"); if (created.find(node_id) == created.end()) { SharedPtr<Node> node(new Node( - TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), (*i)["duration"].to_float()), + TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), results->get("duration").to_float()), false)); machine->add_node(node); created[node_id] = node; @@ -134,8 +136,8 @@ Loader::load(const Glib::ustring& uri) results = query.run(_rdf_world, model); - for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - const char* node_id = (*i)["node"]; + for (; !results->finished(); results->next()) { + const char* node_id = results->get("node"); Created::iterator n = created.find(node_id); if (n != created.end()) n->second->set_selector(true); @@ -153,12 +155,11 @@ Loader::load(const Glib::ustring& uri) "}\n")); results = query.run(_rdf_world, model); - - for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - Created::iterator node_i = created.find((const char*)(*i)["node"]); + for (; !results->finished(); results->next()) { + Created::iterator node_i = created.find((const char*)results->get("node")); if (node_i != created.end()) { SharedPtr<Node> node = node_i->second; - const int note_num = (*i)["note"].to_int(); + const int note_num = results->get("note").to_int(); if (note_num >= 0 && note_num <= 127) { node->set_enter_action(ActionFactory::note_on((unsigned char)note_num)); node->set_exit_action(ActionFactory::note_off((unsigned char)note_num)); @@ -182,10 +183,10 @@ Loader::load(const Glib::ustring& uri) results = query.run(_rdf_world, model); - for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) { - const char* src_uri = (*i)["src"]; - const char* dst_uri = (*i)["dst"]; - float prob = (*i)["prob"].to_float(); + for (; !results->finished(); results->next()) { + const char* src_uri = results->get("src"); + const char* dst_uri = results->get("dst"); + float prob = results->get("prob").to_float(); Created::iterator src_i = created.find(src_uri); Created::iterator dst_i = created.find(dst_uri); |