From 2ba09e4b41b01cbd8f8756eb0e3b7e33136e06b3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 15 Feb 2017 22:41:18 +0100 Subject: Move static path stuff to its own header --- src/server/events/Connect.cpp | 4 ++-- src/server/events/Copy.cpp | 12 ++++++------ src/server/events/CreateBlock.cpp | 4 ++-- src/server/events/CreateGraph.cpp | 4 ++-- src/server/events/CreatePort.cpp | 2 +- src/server/events/Delete.cpp | 4 ++-- src/server/events/Delta.cpp | 10 +++++----- src/server/events/Get.cpp | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/server/events') 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 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 dst_parent; boost::optional 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()); // 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( - 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( - _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( 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 lock(_engine.store()->mutex()); _object = is_graph_object - ? static_cast(_engine.store()->get(Node::uri_to_path(_subject))) + ? static_cast(_engine.store()->get(uri_to_path(_subject))) : static_cast(_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; -- cgit v1.2.1