From 393ab317429b211a7f14f0595c77a90268ab43e5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 18 Aug 2022 01:24:09 -0400 Subject: Clean up path construction --- src/ClashAvoider.cpp | 5 +++-- src/Parser.cpp | 4 +--- src/Store.cpp | 2 +- src/gui/PortMenu.cpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index cd1c10bd..428dd8ba 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -78,8 +78,9 @@ ClashAvoider::map_path(const raul::Path& in) do { auto p = _symbol_map.find(parent); if (p != _symbol_map.end()) { - const raul::Path mapped = raul::Path( - p->second.base() + in.substr(parent.base().length())); + const auto mapped = raul::Path{p->second.base() + + in.substr(parent.base().length())}; + auto i = _symbol_map.emplace(in, mapped); return i.first->second; } diff --git a/src/Parser.cpp b/src/Parser.cpp index a1661625..dec0e28c 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -338,13 +338,11 @@ parse_graph(ingen::World& world, const Sord::Node nil; // Build graph path and symbol - raul::Path graph_path; + raul::Path graph_path{"/"}; if (parent && symbol) { graph_path = parent->child(*symbol); } else if (parent) { graph_path = *parent; - } else { - graph_path = raul::Path("/"); } // Create graph diff --git a/src/Store.cpp b/src/Store.cpp index 363ffb41..d85d5932 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -110,7 +110,7 @@ Store::rename(const iterator top, const raul::Path& new_path) // Rename all the removed objects for (const auto& r : removed) { - const raul::Path path = (r.first == old_path) + const auto path = (r.first == old_path) ? new_path : new_path.child( raul::Path(r.first.substr(old_path.base().length() - 1))); diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 500c48d1..96b0788a 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -168,7 +168,7 @@ PortMenu::on_menu_expose() auto block = std::dynamic_pointer_cast(port->parent()); const std::string label = block->label() + " " + block->port_label(port); - const raul::Path path = raul::Path(block->path() + raul::Symbol("_" + port->symbol())); + const auto path = raul::Path{block->path() + raul::Symbol("_" + port->symbol())}; ingen::Resource r(*_object); r.remove_property(uris.lv2_index, uris.patch_wildcard); -- cgit v1.2.1