diff options
author | David Robillard <d@drobilla.net> | 2017-02-15 22:41:18 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-02-15 23:26:02 +0100 |
commit | 2ba09e4b41b01cbd8f8756eb0e3b7e33136e06b3 (patch) | |
tree | 3033cd084a43a9dd904b96c7efaea2ff30a8502f | |
parent | 4a7ebef865e91e6df521d61f55c5baa709e7776f (diff) | |
download | ingen-2ba09e4b41b01cbd8f8756eb0e3b7e33136e06b3.tar.gz ingen-2ba09e4b41b01cbd8f8756eb0e3b7e33136e06b3.tar.bz2 ingen-2ba09e4b41b01cbd8f8756eb0e3b7e33136e06b3.zip |
Move static path stuff to its own header
-rw-r--r-- | ingen/Node.hpp | 22 | ||||
-rw-r--r-- | ingen/paths.hpp | 51 | ||||
-rw-r--r-- | src/AtomReader.cpp | 4 | ||||
-rw-r--r-- | src/AtomWriter.cpp | 14 | ||||
-rw-r--r-- | src/ClashAvoider.cpp | 4 | ||||
-rw-r--r-- | src/Parser.cpp | 12 | ||||
-rw-r--r-- | src/client/ClientStore.cpp | 16 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 2 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/GraphCanvas.cpp | 14 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/NewSubgraphWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/PortMenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/RenameWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/ingen_gui_lv2.cpp | 4 | ||||
-rw-r--r-- | src/ingen/ingen.cpp | 10 | ||||
-rw-r--r-- | src/server/Event.hpp | 2 | ||||
-rw-r--r-- | src/server/NodeImpl.hpp | 2 | ||||
-rw-r--r-- | src/server/events/Connect.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Copy.cpp | 12 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 4 | ||||
-rw-r--r-- | src/server/events/CreateGraph.cpp | 4 | ||||
-rw-r--r-- | src/server/events/CreatePort.cpp | 2 | ||||
-rw-r--r-- | src/server/events/Delete.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 10 | ||||
-rw-r--r-- | src/server/events/Get.cpp | 4 |
26 files changed, 122 insertions, 91 deletions
diff --git a/ingen/Node.hpp b/ingen/Node.hpp index 72c0b3cb..a585d03a 100644 --- a/ingen/Node.hpp +++ b/ingen/Node.hpp @@ -19,6 +19,7 @@ #include "ingen/Resource.hpp" #include "ingen/ingen.h" +#include "ingen/paths.hpp" #include "ingen/types.hpp" #include "lilv/lilv.h" #include "raul/Path.hpp" @@ -84,27 +85,6 @@ public: return Raul::URI(uri() + '/'); } - static Raul::URI main_uri() { return Raul::URI("ingen:/main"); } - - static bool uri_is_path(const Raul::URI& uri) { - const size_t root_len = main_uri().length(); - if (uri == main_uri()) { - return true; - } else { - return uri.substr(0, root_len + 1) == main_uri() + "/"; - } - } - - static Raul::Path uri_to_path(const Raul::URI& uri) { - return (uri == main_uri()) - ? Raul::Path("/") - : Raul::Path(uri.substr(main_uri().length())); - } - - static Raul::URI path_to_uri(const Raul::Path& path) { - return Raul::URI(main_uri() + path.c_str()); - } - protected: friend class Store; virtual void set_path(const Raul::Path& p) = 0; diff --git a/ingen/paths.hpp b/ingen/paths.hpp new file mode 100644 index 00000000..4924a148 --- /dev/null +++ b/ingen/paths.hpp @@ -0,0 +1,51 @@ +/* + This file is part of Ingen. + Copyright 2007-2017 David Robillard <http://drobilla.net/> + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef INGEN_PATHS_HPP +#define INGEN_PATHS_HPP + +#include "raul/URI.hpp" +#include "raul/Path.hpp" + +namespace Ingen { + +inline Raul::URI main_uri() { return Raul::URI("ingen:/main"); } + +inline bool uri_is_path(const Raul::URI& uri) +{ + const size_t root_len = main_uri().length(); + if (uri == main_uri()) { + return true; + } else { + return uri.substr(0, root_len + 1) == main_uri() + "/"; + } +} + +inline Raul::Path uri_to_path(const Raul::URI& uri) +{ + return (uri == main_uri()) + ? Raul::Path("/") + : Raul::Path(uri.substr(main_uri().length())); +} + +inline Raul::URI path_to_uri(const Raul::Path& path) +{ + return Raul::URI(main_uri() + path.c_str()); +} + +} // namespace Ingen + +#endif // INGEN_PATHS_HPP diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 4d112327..90f0ac9f 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -100,8 +100,8 @@ boost::optional<Raul::Path> AtomReader::atom_to_path(const LV2_Atom* atom) { boost::optional<Raul::URI> uri = atom_to_uri(atom); - if (uri && Node::uri_is_path(*uri)) { - return Node::uri_to_path(*uri); + if (uri && uri_is_path(*uri)) { + return uri_to_path(*uri); } return boost::optional<Raul::Path>(); } diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index 4f342edf..d8fde03f 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -148,9 +148,9 @@ AtomWriter::forge_arc(const Raul::Path& tail, const Raul::Path& head) LV2_Atom_Forge_Frame arc; lv2_atom_forge_object(&_forge, &arc, 0, _uris.ingen_Arc); lv2_atom_forge_key(&_forge, _uris.ingen_tail); - forge_uri(Node::path_to_uri(tail)); + forge_uri(path_to_uri(tail)); lv2_atom_forge_key(&_forge, _uris.ingen_head); - forge_uri(Node::path_to_uri(head)); + forge_uri(path_to_uri(head)); lv2_atom_forge_pop(&_forge, &arc); } @@ -321,9 +321,9 @@ AtomWriter::move(const Raul::Path& old_path, LV2_Atom_Forge_Frame msg; forge_request(&msg, _uris.patch_Move); lv2_atom_forge_key(&_forge, _uris.patch_subject); - forge_uri(Node::path_to_uri(old_path)); + forge_uri(path_to_uri(old_path)); lv2_atom_forge_key(&_forge, _uris.patch_destination); - forge_uri(Node::path_to_uri(new_path)); + forge_uri(path_to_uri(new_path)); lv2_atom_forge_pop(&_forge, &msg); finish_msg(); } @@ -479,7 +479,7 @@ AtomWriter::connect(const Raul::Path& tail, LV2_Atom_Forge_Frame msg; forge_request(&msg, _uris.patch_Put); lv2_atom_forge_key(&_forge, _uris.patch_subject); - forge_uri(Node::path_to_uri(Raul::Path::lca(tail, head))); + forge_uri(path_to_uri(Raul::Path::lca(tail, head))); lv2_atom_forge_key(&_forge, _uris.patch_body); forge_arc(tail, head); lv2_atom_forge_pop(&_forge, &msg); @@ -540,13 +540,13 @@ AtomWriter::disconnect_all(const Raul::Path& graph, forge_request(&msg, _uris.patch_Delete); lv2_atom_forge_key(&_forge, _uris.patch_subject); - forge_uri(Node::path_to_uri(graph)); + forge_uri(path_to_uri(graph)); lv2_atom_forge_key(&_forge, _uris.patch_body); LV2_Atom_Forge_Frame arc; lv2_atom_forge_object(&_forge, &arc, 0, _uris.ingen_Arc); lv2_atom_forge_key(&_forge, _uris.ingen_incidentTo); - forge_uri(Node::path_to_uri(path)); + forge_uri(path_to_uri(path)); lv2_atom_forge_pop(&_forge, &arc); lv2_atom_forge_pop(&_forge, &msg); diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index 92dc551a..3c7ea827 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -33,8 +33,8 @@ ClashAvoider::ClashAvoider(const Store& store) const Raul::URI ClashAvoider::map_uri(const Raul::URI& in) { - if (Node::uri_is_path(in)) { - return Node::path_to_uri(map_path(Node::uri_to_path(in))); + if (uri_is_path(in)) { + return path_to_uri(map_path(uri_to_path(in))); } else { return in; } diff --git a/src/Parser.cpp b/src/Parser.cpp index 0e3a031e..145f7fc5 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -333,7 +333,7 @@ parse_block(Ingen::World* world, world, model, subject, Resource::Graph::DEFAULT); props.insert(make_pair(uris.rdf_type, uris.forge.make_urid(uris.ingen_Block))); - target->put(Node::path_to_uri(path), props); + target->put(path_to_uri(path), props); } return path; } @@ -381,7 +381,7 @@ parse_graph(Ingen::World* world, // Create graph Raul::Path graph_path(graph_path_str); Resource::Properties props = get_properties(world, model, subject_node, ctx); - target->put(Node::path_to_uri(graph_path), props, ctx); + target->put(path_to_uri(graph_path), props, ctx); // For each port on this graph typedef std::map<uint32_t, PortRecord> PortRecords; @@ -409,7 +409,7 @@ parse_graph(Ingen::World* world, // Create ports in order by index for (const auto& p : ports) { - target->put(Node::path_to_uri(p.second.first), + target->put(path_to_uri(p.second.first), p.second.second, ctx); } @@ -448,7 +448,7 @@ parse_graph(Ingen::World* world, } // Create port and/or set all port properties - target->put(Node::path_to_uri(port_record->first), + target->put(path_to_uri(port_record->first), port_record->second, subctx); } @@ -615,7 +615,7 @@ parse(Ingen::World* world, types.find(out_port_class) != types.end()) { parse_properties(world, target, model, s, Resource::Graph::DEFAULT, - Node::path_to_uri(path), data); + path_to_uri(path), data); ret = path; } else if (types.find(arc_class) != types.end()) { Raul::Path parent_path(parent ? parent.get() : Raul::Path("/")); @@ -711,7 +711,7 @@ Parser::parse_file(Ingen::World* world, subject, parent, symbol, data); if (parsed_path) { - target->set_property(Node::path_to_uri(*parsed_path), + target->set_property(path_to_uri(*parsed_path), Raul::URI(INGEN__file), world->forge().alloc_uri(uri)); return true; diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index d69992fe..9948fd7b 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -179,8 +179,8 @@ ClientStore::object(const Raul::Path& path) const SPtr<Resource> ClientStore::_resource(const Raul::URI& uri) { - if (Node::uri_is_path(uri)) { - return _object(Node::uri_to_path(uri)); + if (uri_is_path(uri)) { + return _object(uri_to_path(uri)); } else { return _plugin(uri); } @@ -209,8 +209,8 @@ ClientStore::add_plugin(SPtr<PluginModel> pm) void ClientStore::del(const Raul::URI& uri) { - if (Node::uri_is_path(uri)) { - remove_object(Node::uri_to_path(uri)); + if (uri_is_path(uri)) { + remove_object(uri_to_path(uri)); } else { Plugins::iterator p = _plugins->find(uri); if (p != _plugins->end()) { @@ -277,13 +277,13 @@ ClientStore::put(const Raul::URI& uri, } } - if (!Node::uri_is_path(uri)) { + if (!uri_is_path(uri)) { _log.error(fmt("Put for unknown subject <%1%>\n") % uri.c_str()); return; } - const Raul::Path path(Node::uri_to_path(uri)); + const Raul::Path path(uri_to_path(uri)); SPtr<ObjectModel> obj = dynamic_ptr_cast<ObjectModel>(_object(path)); if (obj) { @@ -352,13 +352,13 @@ ClientStore::delta(const Raul::URI& uri, return; } - if (!Node::uri_is_path(uri)) { + if (!uri_is_path(uri)) { _log.error(fmt("Delta for unknown subject <%1%>\n") % uri.c_str()); return; } - const Raul::Path path(Node::uri_to_path(uri)); + const Raul::Path path(uri_to_path(uri)); SPtr<ObjectModel> obj = _object(path); if (obj) { diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 98f54cbe..79c6c67b 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -96,7 +96,7 @@ ObjectModel::set_path(const Raul::Path& p) { _path = p; _symbol = Raul::Symbol(p.is_root() ? "root" : p.symbol()); - set_uri(Node::path_to_uri(p)); + set_uri(path_to_uri(p)); _signal_moved.emit(); } diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 1968a264..1aea8b26 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -505,7 +505,7 @@ ConnectWindow::gtk_callback() } } } else if (_connect_stage == 3) { - _app->interface()->get(Raul::URI(Node::main_uri() + "/")); + _app->interface()->get(Raul::URI(main_uri() + "/")); next_stage(); } else if (_connect_stage == 4) { if (_app->store()->size() > 0) { diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 565f607e..5b1111d7 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -673,12 +673,12 @@ GraphCanvas::paste() // Make a client store to serve as clipboard ClientStore clipboard(_app.world()->uris(), _app.log()); clipboard.set_plugins(_app.store()->plugins()); - clipboard.put(Node::main_uri(), + clipboard.put(main_uri(), {{uris.rdf_type, Resource::Property(uris.ingen_Graph)}}); // Parse clipboard text into clipboard store boost::optional<Raul::URI> base_uri = parser->parse_string( - _app.world(), &clipboard, str, Node::main_uri()); + _app.world(), &clipboard, str, main_uri()); // Figure out the copy graph base path Raul::Path copy_root("/"); @@ -687,7 +687,7 @@ GraphCanvas::paste() if (base[base.size() - 1] == '/') { base = base.substr(0, base.size() - 1); } - copy_root = Node::uri_to_path(Raul::URI(base)); + copy_root = uri_to_path(Raul::URI(base)); } // Find the minimum x and y coordinate of objects to be pasted @@ -724,7 +724,7 @@ GraphCanvas::paste() const SPtr<Node> node = c.second; const Raul::Path& old_path = copy_root.child(node->path()); - const Raul::URI& old_uri = Node::path_to_uri(old_path); + const Raul::URI& old_uri = path_to_uri(old_path); const Raul::Path& new_path = avoider.map_path(parent.child(node->path())); Node::Properties props{{uris.lv2_prototype, @@ -748,7 +748,7 @@ GraphCanvas::paste() yi->second.context())}); } - _app.interface()->put(Node::path_to_uri(new_path), props); + _app.interface()->put(path_to_uri(new_path), props); _pastees.insert(new_path); } @@ -809,7 +809,7 @@ GraphCanvas::menu_add_port(const string& sym_base, const string& name_base, _app.forge().make(int32_t(_graph->num_ports())))); props.insert(make_pair(uris.lv2_name, _app.forge().alloc(name.c_str()))); - _app.interface()->put(Node::path_to_uri(path), props); + _app.interface()->put(path_to_uri(path), props); } void @@ -836,7 +836,7 @@ GraphCanvas::load_plugin(WPtr<PluginModel> weak_plugin) Resource::Property(uris.ingen_Block))); props.insert(make_pair(uris.lv2_prototype, uris.forge.make_urid(plugin->uri()))); - _app.interface()->put(Node::path_to_uri(path), props); + _app.interface()->put(path_to_uri(path), props); } /** Try to guess a suitable location for a new module. diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 5d66e7d6..61245b4d 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -399,7 +399,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) _app->forge().make_urid(plugin->uri()))); props.insert(make_pair(uris.ingen_polyphonic, _app->forge().make(polyphonic))); - _app->interface()->put(Node::path_to_uri(path), props); + _app->interface()->put(path_to_uri(path), props); if (_selection->get_selected_rows().size() == 1) { _name_offset = (_name_offset == 0) ? 2 : _name_offset + 1; diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index c717a55b..08382897 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -100,14 +100,14 @@ NewSubgraphWindow::ok_clicked() props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)))); props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true)))); _app->interface()->put( - Node::path_to_uri(path), props, Resource::Graph::INTERNAL); + path_to_uri(path), props, Resource::Graph::INTERNAL); // Set external (block perspective) properties props = _initial_data; props.insert(make_pair(_app->uris().rdf_type, Resource::Property(_app->uris().ingen_Graph))); _app->interface()->put( - Node::path_to_uri(path), _initial_data, Resource::Graph::EXTERNAL); + path_to_uri(path), _initial_data, Resource::Graph::EXTERNAL); hide(); } diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 7079d9c4..60ce612d 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -159,7 +159,7 @@ PortMenu::on_menu_expose() r.set_property(uris.ingen_canvasX, _app->forge().make(block_x + x_off)); r.set_property(uris.ingen_canvasY, _app->forge().make(block_y + y_off)); - _app->interface()->put(Node::path_to_uri(path), r.properties()); + _app->interface()->put(path_to_uri(path), r.properties()); if (port->is_input()) { _app->interface()->connect(path, _object->path()); diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 5020f6ef..91c524b2 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -118,7 +118,7 @@ RenameWindow::ok_clicked() if (!label.empty() && (name_atom.type() != uris.forge.String || label != name_atom.ptr<char>())) { - _app->set_property(Node::path_to_uri(path), + _app->set_property(path_to_uri(path), uris.lv2_name, _app->forge().alloc(label)); } diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 9387f742..a4aa47fb 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -147,7 +147,7 @@ instantiate(const LV2UI_Descriptor* descriptor, props.insert(std::make_pair(ui->app->uris().rdf_type, Ingen::Resource::Property( ui->app->uris().ingen_Graph))); - ui->app->store()->put(Ingen::Node::main_uri(), props); + ui->app->store()->put(Ingen::main_uri(), props); // Create a GraphBox for the root and set as the UI widget SPtr<const Ingen::Client::GraphModel> root = @@ -158,7 +158,7 @@ instantiate(const LV2UI_Descriptor* descriptor, *widget = ui->view->gobj(); // Request the actual root graph - ui->world->interface()->get(Ingen::Node::main_uri()); + ui->world->interface()->get(Ingen::main_uri()); return ui; } diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index 9ca4b276..9f939621 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -176,7 +176,7 @@ main(int argc, char** argv) const string graph = conf.option("load").ptr<char>(); engine_interface->get(Raul::URI("ingen:/plugins")); - engine_interface->get(Node::main_uri()); + engine_interface->get(main_uri()); std::lock_guard<std::mutex> lock(world->rdf_mutex()); world->parser()->parse_file( @@ -185,14 +185,14 @@ main(int argc, char** argv) const char* path = conf.option("server-load").ptr<char>(); if (serd_uri_string_has_scheme((const uint8_t*)path)) { std::cout << "Loading " << path << " (server side)" << std::endl; - engine_interface->copy(Raul::URI(path), Node::main_uri()); + engine_interface->copy(Raul::URI(path), main_uri()); } else { SerdNode uri = serd_node_new_file_uri( (const uint8_t*)path, NULL, NULL, true); std::cout << "Loading " << (const char*)uri.buf << " (server side)" << std::endl; engine_interface->copy(Raul::URI((const char*)uri.buf), - Node::main_uri()); + main_uri()); serd_node_free(&uri); } } @@ -202,12 +202,12 @@ main(int argc, char** argv) const char* path = conf.option("save").ptr<char>(); if (serd_uri_string_has_scheme((const uint8_t*)path)) { std::cout << "Saving to " << path << std::endl; - engine_interface->copy(Node::main_uri(), Raul::URI(path)); + engine_interface->copy(main_uri(), Raul::URI(path)); } else { SerdNode uri = serd_node_new_file_uri( (const uint8_t*)path, NULL, NULL, true); std::cout << "Saving to " << (const char*)uri.buf << std::endl; - engine_interface->copy(Node::main_uri(), + engine_interface->copy(main_uri(), Raul::URI((const char*)uri.buf)); serd_node_free(&uri); } diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 45231cdd..6c414fed 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -138,7 +138,7 @@ protected: } inline bool pre_process_done(Status st, const Raul::Path& subject) { - return pre_process_done(st, Node::path_to_uri(subject)); + return pre_process_done(st, path_to_uri(subject)); } /** Respond to the originating client. */ diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 26ef5925..b5b1508b 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -63,7 +63,7 @@ public: if (new_sym[0] != '\0') { _symbol = Raul::Symbol(new_sym); } - set_uri(Node::path_to_uri(new_path)); + set_uri(path_to_uri(new_path)); } const Atom& get_property(const Raul::URI& key) const; diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index e933a490..e02b19a8 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -172,11 +172,11 @@ Connect::post_process() _engine.broadcaster()->connect(_tail_path, _head_path); if (!_tail_remove.empty() || !_tail_add.empty()) { _engine.broadcaster()->delta( - Node::path_to_uri(_tail_path), _tail_remove, _tail_add); + path_to_uri(_tail_path), _tail_remove, _tail_add); } if (!_tail_remove.empty() || !_tail_add.empty()) { _engine.broadcaster()->delta( - Node::path_to_uri(_tail_path), _tail_remove, _tail_add); + path_to_uri(_tail_path), _tail_remove, _tail_add); } } } diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index 668a6fca..1f7ca708 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -51,9 +51,9 @@ Copy::pre_process(PreProcessContext& ctx) { std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); - if (Node::uri_is_path(_old_uri)) { + if (uri_is_path(_old_uri)) { // Old URI is a path within the engine - const Raul::Path old_path = Node::uri_to_path(_old_uri); + const Raul::Path old_path = uri_to_path(_old_uri); // Find the old node const Store::iterator i = _engine.store()->find(old_path); @@ -66,7 +66,7 @@ Copy::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::BAD_OBJECT_TYPE, old_path); } - if (Node::uri_is_path(_new_uri)) { + if (uri_is_path(_new_uri)) { // Copy to path within the engine return engine_to_engine(ctx); } else if (_new_uri.scheme() == "file") { @@ -76,7 +76,7 @@ Copy::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::BAD_REQUEST); } } else if (_old_uri.scheme() == "file") { - if (Node::uri_is_path(_new_uri)) { + if (uri_is_path(_new_uri)) { return filesystem_to_engine(ctx); } else { // Ingen is not your file manager @@ -91,7 +91,7 @@ bool Copy::engine_to_engine(PreProcessContext& ctx) { // Only support a single source for now - const Raul::Path new_path = Node::uri_to_path(_new_uri); + const Raul::Path new_path = uri_to_path(_new_uri); if (!Raul::Symbol::is_valid(new_path.symbol())) { return Event::pre_process_done(Status::BAD_REQUEST); } @@ -175,7 +175,7 @@ Copy::filesystem_to_engine(PreProcessContext& ctx) // Old URI is a filesystem path and new URI is a path within the engine const std::string src_path = _old_uri.substr(strlen("file://")); - const Raul::Path dst_path = Node::uri_to_path(_new_uri); + const Raul::Path dst_path = uri_to_path(_new_uri); boost::optional<Raul::Path> dst_parent; boost::optional<Raul::Symbol> dst_symbol; if (!dst_path.is_root()) { diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 255746b1..db561e1c 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -95,10 +95,10 @@ CreateBlock::pre_process(PreProcessContext& ctx) p->second.get<int32_t>()); // Find and instantiate/duplicate prototype (plugin/existing node) - if (Node::uri_is_path(prototype)) { + if (uri_is_path(prototype)) { // Prototype is an existing block BlockImpl* const ancestor = dynamic_cast<BlockImpl*>( - store->get(Node::uri_to_path(prototype))); + store->get(uri_to_path(prototype))); if (!ancestor) { return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype); } else if (!(_block = ancestor->duplicate( diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 7ebaeedc..1fff9f95 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -141,11 +141,11 @@ CreateGraph::pre_process(PreProcessContext& ctx) if (t != _properties.end() && uris.forge.is_uri(t->second) && Raul::URI::is_valid(uris.forge.str(t->second, false)) && - Node::uri_is_path(Raul::URI(uris.forge.str(t->second, false)))) { + uri_is_path(Raul::URI(uris.forge.str(t->second, false)))) { // Create a duplicate of an existing graph const Raul::URI prototype(uris.forge.str(t->second, false)); GraphImpl* ancestor = dynamic_cast<GraphImpl*>( - _engine.store()->get(Node::uri_to_path(prototype))); + _engine.store()->get(uri_to_path(prototype))); if (!ancestor) { return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype); } else if (!(_graph = dynamic_cast<GraphImpl*>( diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index b6cabbeb..63301efd 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -192,7 +192,7 @@ CreatePort::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); if (respond() == Status::SUCCESS) { - _engine.broadcaster()->put(Node::path_to_uri(_path), _update); + _engine.broadcaster()->put(path_to_uri(_path), _update); } } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 788dfa2b..3cb946b9 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -45,8 +45,8 @@ Delete::Delete(Engine& engine, , _engine_port(NULL) , _disconnect_event(NULL) { - if (Node::uri_is_path(uri)) { - _path = Node::uri_to_path(uri); + if (uri_is_path(uri)) { + _path = uri_to_path(uri); } } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 2c13f9d4..0398face 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -137,7 +137,7 @@ Delta::pre_process(PreProcessContext& ctx) { const Ingen::URIs& uris = _engine.world()->uris(); - const bool is_graph_object = Node::uri_is_path(_subject); + const bool is_graph_object = uri_is_path(_subject); const bool is_client = (_subject == "ingen:/clients/this"); const bool is_engine = (_subject == "ingen:/"); const bool is_file = (_subject.substr(0, 5) == "file:"); @@ -158,11 +158,11 @@ Delta::pre_process(PreProcessContext& ctx) } const Raul::URI prot(_engine.world()->forge().str(p->second, false)); - if (!Node::uri_is_path(prot)) { + if (!uri_is_path(prot)) { return Event::pre_process_done(Status::BAD_URI, _subject); } - Node* node = _engine.store()->get(Node::uri_to_path(prot)); + Node* node = _engine.store()->get(uri_to_path(prot)); if (!node) { return Event::pre_process_done(Status::NOT_FOUND, prot); } @@ -182,7 +182,7 @@ Delta::pre_process(PreProcessContext& ctx) std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); _object = is_graph_object - ? static_cast<Ingen::Resource*>(_engine.store()->get(Node::uri_to_path(_subject))) + ? static_cast<Ingen::Resource*>(_engine.store()->get(uri_to_path(_subject))) : static_cast<Ingen::Resource*>(_engine.block_factory()->plugin(_subject)); if (!_object && !is_client && !is_engine && @@ -191,7 +191,7 @@ Delta::pre_process(PreProcessContext& ctx) } if (is_graph_object && !_object) { - Raul::Path path(Node::uri_to_path(_subject)); + Raul::Path path(uri_to_path(_subject)); bool is_graph = false, is_block = false, is_port = false, is_output = false; Ingen::Resource::type(uris, _properties, is_graph, is_block, is_port, is_output); diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 618b8c80..baa9b16e 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -55,8 +55,8 @@ Get::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::SUCCESS); } else if (_uri == "ingen:/engine") { return Event::pre_process_done(Status::SUCCESS); - } else if (Node::uri_is_path(_uri)) { - if ((_object = _engine.store()->get(Node::uri_to_path(_uri)))) { + } else if (uri_is_path(_uri)) { + if ((_object = _engine.store()->get(uri_to_path(_uri)))) { const BlockImpl* block = NULL; const GraphImpl* graph = NULL; const PortImpl* port = NULL; |