diff options
author | David Robillard <d@drobilla.net> | 2018-01-21 00:41:34 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-01-21 00:56:50 +0100 |
commit | 44f7ad5222d824d81dc743045d5887418847e74e (patch) | |
tree | 1b41535ac00b8b225a25dba2873b064cb074bfa9 /src/server | |
parent | 90fca083052880479ad90d870e556f0648e32106 (diff) | |
download | ingen-44f7ad5222d824d81dc743045d5887418847e74e.tar.gz ingen-44f7ad5222d824d81dc743045d5887418847e74e.tar.bz2 ingen-44f7ad5222d824d81dc743045d5887418847e74e.zip |
Add URI class and remove use of Raul::URI
Diffstat (limited to 'src/server')
44 files changed, 118 insertions, 129 deletions
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index a1367e12..65108483 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -99,7 +99,7 @@ BlockFactory::refresh() } PluginImpl* -BlockFactory::plugin(const Raul::URI& uri) +BlockFactory::plugin(const URI& uri) { load_plugin(uri); const Plugins::const_iterator i = _plugins.find(uri); @@ -127,7 +127,7 @@ BlockFactory::load_internal_plugins() } void -BlockFactory::load_plugin(const Raul::URI& uri) +BlockFactory::load_plugin(const URI& uri) { if (_has_loaded || _plugins.find(uri) != _plugins.end()) { return; @@ -152,7 +152,7 @@ BlockFactory::load_lv2_plugins() typedef std::vector< SPtr<LilvNode> > Types; Types types; for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) { - const Raul::URI& uri(PortType((PortType::ID)t).uri()); + const URI& uri(PortType((PortType::ID)t).uri()); types.push_back( SPtr<LilvNode>(lilv_new_uri(_world->lilv_world(), uri.c_str()), lilv_node_free)); @@ -161,7 +161,7 @@ BlockFactory::load_lv2_plugins() const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world()); LILV_FOREACH(plugins, i, plugins) { const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i); - const Raul::URI uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug))); + const URI uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug))); // Ignore plugins that require features Ingen doesn't support LilvNodes* features = lilv_plugin_get_required_features(lv2_plug); diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp index 71e72bbc..25885f75 100644 --- a/src/server/BlockFactory.hpp +++ b/src/server/BlockFactory.hpp @@ -23,7 +23,6 @@ #include "ingen/World.hpp" #include "ingen/types.hpp" #include "raul/Noncopyable.hpp" -#include "raul/URI.hpp" namespace Ingen { namespace Server { @@ -46,12 +45,12 @@ public: */ std::set<PluginImpl*> refresh(); - void load_plugin(const Raul::URI& uri); + void load_plugin(const URI& uri); - typedef std::map<Raul::URI, PluginImpl*> Plugins; + typedef std::map<URI, PluginImpl*> Plugins; const Plugins& plugins(); - PluginImpl* plugin(const Raul::URI& uri); + PluginImpl* plugin(const URI& uri); private: void load_lv2_plugins(); diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 7907b0d8..d663e319 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -102,14 +102,14 @@ public: void set_enabled(bool e) { _enabled = e; } /** Load a preset from the world for this block. */ - virtual LilvState* load_preset(const Raul::URI& uri) { return nullptr; } + virtual LilvState* load_preset(const URI& uri) { return nullptr; } /** Restore `state`. */ virtual void apply_state(const UPtr<Worker>& worker, const LilvState* state) {} /** Save current state as preset. */ virtual boost::optional<Resource> - save_preset(const Raul::URI& bundle, + save_preset(const URI& bundle, const Properties& props) { return boost::optional<Resource>(); } /** Learn the next incoming MIDI event (for internals) */ diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index b51c744c..3981b265 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -97,7 +97,7 @@ public: } } - Raul::URI uri() const override { return Raul::URI("ingen:/broadcaster"); } + URI uri() const override { return URI("ingen:/broadcaster"); } private: friend class Transfer; diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp index b65fac12..60dd02e3 100644 --- a/src/server/ClientUpdate.cpp +++ b/src/server/ClientUpdate.cpp @@ -27,7 +27,7 @@ namespace Ingen { namespace Server { void -ClientUpdate::put(const Raul::URI& uri, +ClientUpdate::put(const URI& uri, const Properties& props, Resource::Graph ctx) { @@ -106,8 +106,8 @@ ClientUpdate::put_plugin(PluginImpl* plugin) void ClientUpdate::put_preset(const URIs& uris, - const Raul::URI& plugin, - const Raul::URI& preset, + const URI& plugin, + const URI& preset, const std::string& label) { const Properties props{ @@ -118,7 +118,7 @@ ClientUpdate::put_preset(const URIs& uris, } void -ClientUpdate::del(const Raul::URI& subject) +ClientUpdate::del(const URI& subject) { dels.push_back(subject); } @@ -135,7 +135,7 @@ void ClientUpdate::send(Interface& dest) { // Send deletions - for (const Raul::URI& subject : dels) { + for (const URI& subject : dels) { dest.del(subject); } diff --git a/src/server/ClientUpdate.hpp b/src/server/ClientUpdate.hpp index 008bf2da..f1a361f7 100644 --- a/src/server/ClientUpdate.hpp +++ b/src/server/ClientUpdate.hpp @@ -22,7 +22,6 @@ #include "ingen/Resource.hpp" #include "raul/Path.hpp" -#include "raul/URI.hpp" namespace Ingen { @@ -42,7 +41,7 @@ class PluginImpl; * post_process() to avoid the need to lock. */ struct ClientUpdate { - void put(const Raul::URI& uri, + void put(const URI& uri, const Properties& props, Resource::Graph ctx = Resource::Graph::DEFAULT); @@ -51,16 +50,16 @@ struct ClientUpdate { void put_graph(const GraphImpl* graph); void put_plugin(PluginImpl* plugin); void put_preset(const URIs& uris, - const Raul::URI& plugin, - const Raul::URI& preset, + const URI& plugin, + const URI& preset, const std::string& label); - void del(const Raul::URI& subject); + void del(const URI& subject); void send(Interface& dest); struct Put { - Raul::URI uri; + URI uri; Properties properties; Resource::Graph ctx; }; @@ -70,9 +69,9 @@ struct ClientUpdate { Raul::Path head; }; - std::vector<Raul::URI> dels; - std::vector<Put> puts; - std::vector<Connect> connects; + std::vector<URI> dels; + std::vector<Put> puts; + std::vector<Connect> connects; }; } // namespace Server diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp index 219d0cb1..58b4f898 100644 --- a/src/server/DirectDriver.hpp +++ b/src/server/DirectDriver.hpp @@ -72,7 +72,7 @@ public: const Raul::Path& new_path) {} virtual void port_property(const Raul::Path& path, - const Raul::URI& uri, + const URI& uri, const Atom& value) {} virtual void register_port(EnginePort& port) {} diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp index 3014429e..9ae4b836 100644 --- a/src/server/Driver.hpp +++ b/src/server/Driver.hpp @@ -81,7 +81,7 @@ public: /** Apply a system visible port property. */ virtual void port_property(const Raul::Path& path, - const Raul::URI& uri, + const URI& uri, const Atom& value) = 0; /** Return the audio buffer size in frames */ diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 7e32e236..1b62ff38 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -121,7 +121,7 @@ DuplexPort::inherit_neighbour(const PortImpl* port, } void -DuplexPort::on_property(const Raul::URI& uri, const Atom& value) +DuplexPort::on_property(const URI& uri, const Atom& value) { _bufs.engine().driver()->port_property(_path, uri, value); } diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index e12841dd..b0066164 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -61,7 +61,7 @@ public: Properties& remove, Properties& add); - void on_property(const Raul::URI& uri, const Atom& value); + void on_property(const URI& uri, const Atom& value); uint32_t max_tail_poly(RunContext& context) const; diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index e8d4770e..a7476845 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -122,7 +122,7 @@ Engine::Engine(Ingen::World* world) _event_writer, std::make_shared<StreamWriter>(world->uri_map(), world->uris(), - Raul::URI("ingen:/engine"), + URI("ingen:/engine"), stderr, ColorContext::Color::MAGENTA)}); } @@ -327,7 +327,7 @@ Engine::main_iteration() _maid->cleanup(); if (_run_load.changed) { - _broadcaster->put(Raul::URI("ingen:/engine"), load_properties()); + _broadcaster->put(URI("ingen:/engine"), load_properties()); _run_load.changed = false; } diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 48c9580d..d9095def 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -130,7 +130,7 @@ protected: return st == Status::SUCCESS; } - inline bool pre_process_done(Status st, const Raul::URI& subject) { + inline bool pre_process_done(Status st, const URI& subject) { _err_subject = subject; return pre_process_done(st); } diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 2c7e5666..023761d6 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -40,9 +40,7 @@ class EventWriter : public Interface public: explicit EventWriter(Engine& engine); - Raul::URI uri() const override { - return Raul::URI("ingen:/clients/event_writer"); - } + URI uri() const override { return URI("ingen:/clients/event_writer"); } SPtr<Interface> respondee() const override { return _respondee; diff --git a/src/server/GraphPlugin.hpp b/src/server/GraphPlugin.hpp index 0314f9d6..308ed91a 100644 --- a/src/server/GraphPlugin.hpp +++ b/src/server/GraphPlugin.hpp @@ -33,7 +33,7 @@ class GraphPlugin : public PluginImpl { public: GraphPlugin(URIs& uris, - const Raul::URI& uri, + const URI& uri, const Raul::Symbol& symbol, const std::string& name) : PluginImpl(uris, uris.ingen_Graph.urid, uri) diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index 17f6fc70..6529b9c0 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -30,7 +30,7 @@ namespace Server { using namespace Internals; InternalPlugin::InternalPlugin(URIs& uris, - const Raul::URI& uri, + const URI& uri, const Raul::Symbol& symbol) : PluginImpl(uris, uris.ingen_Internal.urid, uri) , _symbol(symbol) diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp index d95afa1a..79309beb 100644 --- a/src/server/InternalPlugin.hpp +++ b/src/server/InternalPlugin.hpp @@ -18,7 +18,6 @@ #define INGEN_ENGINE_INTERNALPLUGIN_HPP #include "raul/Symbol.hpp" -#include "raul/URI.hpp" #include "PluginImpl.hpp" @@ -36,7 +35,7 @@ class InternalPlugin : public PluginImpl { public: InternalPlugin(URIs& uris, - const Raul::URI& uri, + const URI& uri, const Raul::Symbol& symbol); BlockImpl* instantiate(BufferFactory& bufs, diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 433ca758..d022077a 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -33,6 +33,7 @@ #include "ingen/Configuration.hpp" #include "ingen/LV2Features.hpp" #include "ingen/Log.hpp" +#include "ingen/URI.hpp" #include "ingen/URIMap.hpp" #include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" @@ -278,7 +279,7 @@ JackDriver::rename_port(const Raul::Path& old_path, void JackDriver::port_property(const Raul::Path& path, - const Raul::URI& uri, + const URI& uri, const Atom& value) { #ifdef HAVE_JACK_METADATA @@ -292,7 +293,7 @@ JackDriver::port_property(const Raul::Path& path, void JackDriver::port_property_internal(const jack_port_t* jport, - const Raul::URI& uri, + const URI& uri, const Atom& value) { #ifdef HAVE_JACK_METADATA @@ -548,7 +549,7 @@ JackDriver::_session_cb(jack_session_event_t* event) SPtr<Node> root(_engine.root_graph(), NullDeleter<Node>); serialiser->write_bundle(root, - std::string("file://") + event->session_dir); + URI(std::string("file://") + event->session_dir)); } event->command_line = (char*)malloc(cmd.size() + 1); diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index ce9af82e..678ce483 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -74,7 +74,7 @@ public: EnginePort* get_port(const Raul::Path& path); void rename_port(const Raul::Path& old_path, const Raul::Path& new_path); - void port_property(const Raul::Path& path, const Raul::URI& uri, const Atom& value); + void port_property(const Raul::Path& path, const URI& uri, const Atom& value); void add_port(RunContext& context, EnginePort* port); void remove_port(RunContext& context, EnginePort* port); void register_port(EnginePort& port); @@ -125,7 +125,7 @@ private: void post_process_port(RunContext& context, EnginePort* port); void port_property_internal(const jack_port_t* jport, - const Raul::URI& uri, + const URI& uri, const Atom& value); // Non static callbacks (methods) diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 440fb3c5..054d55ae 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -399,8 +399,8 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state) LILV_FOREACH(nodes, v, values) { const LilvNode* val = lilv_nodes_get(values, v); if (lilv_node_is_uri(val)) { - port->add_property(Raul::URI(lilv_node_as_uri(preds[p])), - forge.make_urid(Raul::URI(lilv_node_as_uri(val)))); + port->add_property(URI(lilv_node_as_uri(preds[p])), + forge.make_urid(URI(lilv_node_as_uri(val)))); } } lilv_nodes_free(values); @@ -606,7 +606,7 @@ LV2Block::post_process(RunContext& context) } LilvState* -LV2Block::load_preset(const Raul::URI& uri) +LV2Block::load_preset(const URI& uri) { World* world = _lv2_plugin->world(); LilvWorld* lworld = world->lilv_world(); @@ -678,7 +678,7 @@ get_port_value(const char* port_symbol, } boost::optional<Resource> -LV2Block::save_preset(const Raul::URI& uri, +LV2Block::save_preset(const URI& uri, const Properties& props) { World* world = parent_graph()->engine().world(); @@ -686,7 +686,7 @@ LV2Block::save_preset(const Raul::URI& uri, LV2_URID_Map* lmap = &world->uri_map().urid_map_feature()->urid_map; LV2_URID_Unmap* lunmap = &world->uri_map().urid_unmap_feature()->urid_unmap; - const std::string path = Glib::filename_from_uri(uri); + const std::string path = Glib::filename_from_uri(uri.string()); const std::string dirname = Glib::path_get_dirname(path); const std::string basename = Glib::path_get_basename(path); @@ -704,7 +704,7 @@ LV2Block::save_preset(const Raul::URI& uri, lilv_state_save(lworld, lmap, lunmap, state, nullptr, dirname.c_str(), basename.c_str()); - const Raul::URI uri(lilv_node_as_uri(lilv_state_get_uri(state))); + const URI uri(lilv_node_as_uri(lilv_state_get_uri(state))); const std::string label(lilv_state_get_label(state) ? lilv_state_get_label(state) : basename); diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index d04d2048..eec852a2 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -68,11 +68,11 @@ public: void run(RunContext& context); void post_process(RunContext& context); - LilvState* load_preset(const Raul::URI& uri); + LilvState* load_preset(const URI& uri); void apply_state(const UPtr<Worker>& worker, const LilvState* state); - boost::optional<Resource> save_preset(const Raul::URI& uri, + boost::optional<Resource> save_preset(const URI& uri, const Properties& props); void set_port_buffer(uint32_t voice, diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index d51aeda3..f56fd4d7 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -32,7 +32,7 @@ namespace Server { LV2Plugin::LV2Plugin(World* world, const LilvPlugin* lplugin) : PluginImpl(world->uris(), world->uris().lv2_Plugin.urid, - Raul::URI(lilv_node_as_uri(lilv_plugin_get_uri(lplugin)))) + URI(lilv_node_as_uri(lilv_plugin_get_uri(lplugin)))) , _world(world) , _lilv_plugin(lplugin) { @@ -122,7 +122,7 @@ LV2Plugin::load_presets() if (labels) { const LilvNode* label = lilv_nodes_get_first(labels); - _presets.emplace(Raul::URI(lilv_node_as_uri(preset)), + _presets.emplace(URI(lilv_node_as_uri(preset)), lilv_node_as_string(label)); lilv_nodes_free(labels); diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index f490bbfd..43d0fba9 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -21,7 +21,6 @@ #include "ingen/types.hpp" #include "lilv/lilv.h" -#include "raul/URI.hpp" #include "PluginImpl.hpp" @@ -57,9 +56,9 @@ public: void load_presets(); - Raul::URI bundle_uri() const { + URI bundle_uri() const { const LilvNode* bundle = lilv_plugin_get_bundle_uri(_lilv_plugin); - return Raul::URI(lilv_node_as_uri(bundle)); + return URI(lilv_node_as_uri(bundle)); } private: diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index d26fa51f..778ba15a 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -32,7 +32,7 @@ NodeImpl::NodeImpl(const Ingen::URIs& uris, } const Atom& -NodeImpl::get_property(const Raul::URI& key) const +NodeImpl::get_property(const URI& key) const { ThreadManager::assert_not_thread(THREAD_PROCESS); static const Atom null_atom; diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 81abb3ef..614801eb 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -64,7 +64,7 @@ public: set_uri(path_to_uri(new_path)); } - const Atom& get_property(const Raul::URI& key) const; + const Atom& get_property(const URI& key) const; /** The Graph this object is a child of. */ virtual GraphImpl* parent_graph() const; diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp index 869c6520..ebd4b3e5 100644 --- a/src/server/PluginImpl.hpp +++ b/src/server/PluginImpl.hpp @@ -21,7 +21,6 @@ #include "ingen/Resource.hpp" #include "raul/Symbol.hpp" -#include "raul/URI.hpp" namespace Ingen { @@ -41,14 +40,13 @@ class GraphImpl; class PluginImpl : public Resource { public: - PluginImpl(Ingen::URIs& uris, - const Atom& type, - const Raul::URI& uri) - : Resource(uris, uri) - , _type(type) - , _presets_loaded(false) - , _is_zombie(false) - {} + PluginImpl(Ingen::URIs& uris, const Atom& type, const URI& uri) + : Resource(uris, uri) + , _type(type) + , _presets_loaded(false) + , _is_zombie(false) + { + } virtual BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, @@ -64,8 +62,8 @@ public: bool is_zombie() const { return _is_zombie; } void set_is_zombie(bool t) { _is_zombie = t; } - typedef std::pair<Raul::URI, std::string> Preset; - typedef std::map<Raul::URI, std::string> Presets; + typedef std::pair<URI, std::string> Preset; + typedef std::map<URI, std::string> Presets; const Presets& presets(bool force_reload=false) { if (!_presets_loaded || force_reload) { @@ -79,7 +77,7 @@ public: virtual void load_presets() { _presets_loaded = true; } - virtual Raul::URI bundle_uri() const { return Raul::URI("ingen:/"); } + virtual URI bundle_uri() const { return URI("ingen:/"); } protected: Atom _type; diff --git a/src/server/PortAudioDriver.cpp b/src/server/PortAudioDriver.cpp index 17b5c8cf..f892c99f 100644 --- a/src/server/PortAudioDriver.cpp +++ b/src/server/PortAudioDriver.cpp @@ -204,7 +204,7 @@ PortAudioDriver::rename_port(const Raul::Path& old_path, void PortAudioDriver::port_property(const Raul::Path& path, - const Raul::URI& uri, + const URI& uri, const Atom& value) { } diff --git a/src/server/PortAudioDriver.hpp b/src/server/PortAudioDriver.hpp index 3659b4ff..11772a88 100644 --- a/src/server/PortAudioDriver.hpp +++ b/src/server/PortAudioDriver.hpp @@ -58,7 +58,7 @@ public: EnginePort* get_port(const Raul::Path& path); void rename_port(const Raul::Path& old_path, const Raul::Path& new_path); - void port_property(const Raul::Path& path, const Raul::URI& uri, const Atom& value); + void port_property(const Raul::Path& path, const URI& uri, const Atom& value); void add_port(RunContext& context, EnginePort* port); void remove_port(RunContext& context, EnginePort* port); void register_port(EnginePort& port); diff --git a/src/server/PortType.hpp b/src/server/PortType.hpp index be0426b0..0b62c5ab 100644 --- a/src/server/PortType.hpp +++ b/src/server/PortType.hpp @@ -19,8 +19,6 @@ #include <cassert> -#include "raul/URI.hpp" - #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -42,7 +40,7 @@ public: ATOM = 4 }; - explicit PortType(const Raul::URI& uri) + explicit PortType(const URI& uri) : _id(UNKNOWN) { if (uri == type_uri(AUDIO)) { @@ -58,8 +56,8 @@ public: PortType(ID id) : _id(id) {} - inline const Raul::URI& uri() const { return type_uri(_id); } - inline ID id() const { return _id; } + inline const URI& uri() const { return type_uri(_id); } + inline ID id() const { return _id; } inline bool operator==(const ID& id) const { return (_id == id); } inline bool operator!=(const ID& id) const { return (_id != id); } @@ -73,14 +71,14 @@ public: inline bool is_atom() { return _id == ATOM; } private: - static inline const Raul::URI& type_uri(unsigned id_num) { + static inline const URI& type_uri(unsigned id_num) { assert(id_num <= ATOM); - static const Raul::URI uris[] = { - Raul::URI("http://www.w3.org/2002/07/owl#Nothing"), - Raul::URI(LV2_CORE__AudioPort), - Raul::URI(LV2_CORE__ControlPort), - Raul::URI(LV2_CORE__CVPort), - Raul::URI(LV2_ATOM__AtomPort) + static const URI uris[] = { + URI("http://www.w3.org/2002/07/owl#Nothing"), + URI(LV2_CORE__AudioPort), + URI(LV2_CORE__ControlPort), + URI(LV2_CORE__CVPort), + URI(LV2_ATOM__AtomPort) }; return uris[id_num]; } diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp index d065c41f..3ab9d15c 100644 --- a/src/server/RunContext.cpp +++ b/src/server/RunContext.cpp @@ -121,12 +121,12 @@ RunContext::emit_notifications(FrameTime end) const char* key = _engine.world()->uri_map().unmap_uri(note.key); if (key) { _engine.broadcaster()->set_property( - note.port->uri(), Raul::URI(key), value); + note.port->uri(), URI(key), value); if (note.port->is_input() && (note.key == uris.ingen_value || note.key == uris.midi_binding)) { // FIXME: not thread safe - note.port->set_property(Raul::URI(key), value); + note.port->set_property(URI(key), value); } } else { _engine.log().rt_error("Error unmapping notification key URI\n"); diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp index e62b822e..eecc28d1 100644 --- a/src/server/SocketListener.cpp +++ b/src/server/SocketListener.cpp @@ -88,8 +88,8 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock) const std::string unix_path(link_path + "." + std::to_string(getpid())); // Bind UNIX socket and create PID-less symbolic link - const Raul::URI unix_uri(unix_scheme + unix_path); - bool make_link = true; + const URI unix_uri(unix_scheme + unix_path); + bool make_link = true; if (!unix_sock->bind(unix_uri) || !unix_sock->listen()) { world->log().error("Failed to create UNIX socket\n"); unix_sock->close(); @@ -127,7 +127,7 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock) const int port = world->conf().option("engine-port").get<int32_t>(); std::ostringstream ss; ss << "tcp://*:" << port; - if (!net_sock->bind(Raul::URI(ss.str())) || !net_sock->listen()) { + if (!net_sock->bind(URI(ss.str())) || !net_sock->listen()) { world->log().error("Failed to create TCP socket\n"); net_sock->close(); } else { diff --git a/src/server/SocketServer.hpp b/src/server/SocketServer.hpp index 6420020e..dbeb76ea 100644 --- a/src/server/SocketServer.hpp +++ b/src/server/SocketServer.hpp @@ -41,14 +41,14 @@ public: new Tee({SPtr<Interface>(new EventWriter(engine)), SPtr<Interface>(new StreamWriter(world.uri_map(), world.uris(), - Raul::URI("ingen:/engine"), + URI("ingen:/engine"), stderr, ColorContext::Color::CYAN))})) : SPtr<Interface>(new EventWriter(engine))) , _reader(new SocketReader(world, *_sink.get(), sock)) , _writer(new SocketWriter(world.uri_map(), world.uris(), - sock->uri(), + URI(sock->uri()), sock)) { _sink->set_respondee(_writer); diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index b1cea1db..fc9d40f7 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -150,7 +150,7 @@ Copy::engine_to_filesystem(PreProcessContext& ctx) std::lock_guard<std::mutex> lock(_engine.world()->rdf_mutex()); if (ends_with(_msg.new_uri, ".ingen") || ends_with(_msg.new_uri, ".ingen/")) { - _engine.world()->serialiser()->write_bundle(graph, _msg.new_uri); + _engine.world()->serialiser()->write_bundle(graph, URI(_msg.new_uri)); } else { _engine.world()->serialiser()->start_to_file(graph->path(), _msg.new_uri); _engine.world()->serialiser()->serialise(graph); @@ -170,7 +170,7 @@ Copy::filesystem_to_engine(PreProcessContext& ctx) std::lock_guard<std::mutex> lock(_engine.world()->rdf_mutex()); // Old URI is a filesystem path and new URI is a path within the engine - const std::string src_path = _msg.old_uri.substr(strlen("file://")); + const std::string src_path(_msg.old_uri.path()); const Raul::Path dst_path = uri_to_path(_msg.new_uri); boost::optional<Raul::Path> dst_parent; boost::optional<Raul::Symbol> dst_symbol; diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 2c7978b1..fc0c0f5e 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -82,7 +82,7 @@ CreateBlock::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::BAD_REQUEST); } - const Raul::URI prototype(uris.forge.str(t->second, false)); + const URI prototype(uris.forge.str(t->second, false)); // Find polyphony const iterator p = _properties.find(uris.ingen_polyphonic); diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 43b3bb97..390fdd9a 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -140,11 +140,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)) && - uri_is_path(Raul::URI(uris.forge.str(t->second, false)))) { + URI::is_valid(uris.forge.str(t->second, false)) && + uri_is_path(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*>( + const URI prototype(uris.forge.str(t->second, false)); + GraphImpl* ancestor = dynamic_cast<GraphImpl*>( _engine.store()->get(uri_to_path(prototype))); if (!ancestor) { return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype); diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 310579aa..e8f9582c 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -202,7 +202,7 @@ Delete::undo(Interface& target) // Adjust port indices for (const auto& c : _port_index_changes) { - if (c.first != _msg.uri) { + if (c.first != _msg.uri.path()) { target.set_property(path_to_uri(c.first), uris.lv2_index, forge.make(int32_t(c.second.first))); diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index b7cb9475..56cc22aa 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -178,7 +178,7 @@ Delta::pre_process(PreProcessContext& ctx) 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:"); + const bool is_file = (_subject.scheme() == "file"); if (_type == Type::PUT && is_file) { // Ensure type is Preset, the only supported file put @@ -195,7 +195,7 @@ Delta::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::BAD_REQUEST, _subject); } - const Raul::URI prot(_engine.world()->forge().str(p->second, false)); + const URI prot(_engine.world()->forge().str(p->second, false)); if (!uri_is_path(prot)) { return Event::pre_process_done(Status::BAD_URI, _subject); } @@ -261,8 +261,8 @@ Delta::pre_process(PreProcessContext& ctx) // Remove any properties removed in delta for (const auto& r : _remove) { - const Raul::URI& key = r.first; - const Atom& value = r.second; + const URI& key = r.first; + const Atom& value = r.second; if (key == uris.midi_binding && value == uris.patch_wildcard) { PortImpl* port = dynamic_cast<PortImpl*>(_object); if (port) { @@ -314,9 +314,9 @@ Delta::pre_process(PreProcessContext& ctx) } for (const auto& p : _properties) { - const Raul::URI& key = p.first; - const Property& value = p.second; - SpecialType op = SpecialType::NONE; + const URI& key = p.first; + const Property& value = p.second; + SpecialType op = SpecialType::NONE; if (obj) { Resource& resource = *obj; if (value != uris.patch_wildcard) { @@ -373,8 +373,8 @@ Delta::pre_process(PreProcessContext& ctx) uri_str = Glib::filename_to_uri(value.ptr<char>()); } - if (Raul::URI::is_valid(uri_str)) { - const Raul::URI uri(uri_str); + if (URI::is_valid(uri_str)) { + const URI uri(uri_str); op = SpecialType::PRESET; if ((_state = block->load_preset(uri))) { lilv_state_emit_port_values( @@ -503,8 +503,8 @@ Delta::execute(RunContext& context) std::vector<SpecialType>::const_iterator t = _types.begin(); for (const auto& p : _properties) { - const Raul::URI& key = p.first; - const Atom& value = p.second; + const URI& key = p.first; + const Atom& value = p.second; switch (*t++) { case SpecialType::ENABLE_BROADCAST: if (port) { @@ -621,7 +621,7 @@ Delta::post_process() } break; case Type::PUT: - if (_type == Type::PUT && _subject.substr(0, 5) == "file:") { + if (_type == Type::PUT && _subject.scheme() == "file") { // Preset save ClientUpdate response; response.put(_preset->uri(), _preset->properties()); diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index 47c4ab22..af337b57 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -23,8 +23,6 @@ #include "lilv/lilv.h" -#include "raul/URI.hpp" - #include "CompiledGraph.hpp" #include "ControlBindings.hpp" #include "Event.hpp" @@ -106,7 +104,7 @@ private: SetEvents _set_events; std::vector<SpecialType> _types; std::vector<SpecialType> _remove_types; - Raul::URI _subject; + URI _subject; Properties _properties; Properties _remove; ClientUpdate _update; diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 84f6f251..e53e8c41 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -99,7 +99,7 @@ Get::post_process() const Properties load_props = _engine.load_properties(); props.insert(load_props.begin(), load_props.end()); - _request_client->put(Raul::URI("ingen:/engine"), props); + _request_client->put(URI("ingen:/engine"), props); } else { _response.send(*_request_client); } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 1b6652ae..b2806ab6 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -14,8 +14,7 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include <stdlib.h> - +#include <cstdlib> #include <string> #include <thread> #include <vector> @@ -37,6 +36,7 @@ #include "ingen/Parser.hpp" #include "ingen/Serialiser.hpp" #include "ingen/Store.hpp" +#include "ingen/URI.hpp" #include "ingen/World.hpp" #include "ingen/ingen.h" #include "ingen/runtime_paths.hpp" @@ -232,7 +232,7 @@ public: /** Unused since LV2 has no dynamic ports. */ virtual void port_property(const Raul::Path& path, - const Raul::URI& uri, + const URI& uri, const Atom& value) {} virtual EnginePort* create_port(DuplexPort* graph_port) { @@ -439,7 +439,7 @@ struct IngenPlugin { }; static Lib::Graphs -find_graphs(const std::string& manifest_uri) +find_graphs(const URI& manifest_uri) { Sord::World world; Parser parser; @@ -447,7 +447,7 @@ find_graphs(const std::string& manifest_uri) const std::set<Parser::ResourceRecord> resources = parser.find_resources( world, manifest_uri, - Raul::URI(INGEN__Graph)); + URI(INGEN__Graph)); Lib::Graphs graphs; for (const auto& r : resources) { @@ -496,7 +496,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, SerdNode manifest_node = serd_node_new_file_uri( (const uint8_t*)manifest_path.c_str(), nullptr, nullptr, true); - Lib::Graphs graphs = find_graphs((const char*)manifest_node.buf); + Lib::Graphs graphs = find_graphs(URI((const char*)manifest_node.buf)); serd_node_free(&manifest_node); const LV2Graph* graph = nullptr; @@ -809,7 +809,7 @@ Lib::Lib(const char* bundle_path) SerdNode manifest_node = serd_node_new_file_uri( (const uint8_t*)manifest_path.c_str(), nullptr, nullptr, true); - graphs = find_graphs((const char*)manifest_node.buf); + graphs = find_graphs(URI((const char*)manifest_node.buf)); serd_node_free(&manifest_node); } diff --git a/src/server/internals/BlockDelay.cpp b/src/server/internals/BlockDelay.cpp index c0e8dded..e9667cc5 100644 --- a/src/server/internals/BlockDelay.cpp +++ b/src/server/internals/BlockDelay.cpp @@ -35,7 +35,7 @@ namespace Internals { InternalPlugin* BlockDelayNode::internal_plugin(URIs& uris) { return new InternalPlugin( - uris, Raul::URI(NS_INTERNALS "BlockDelay"), Raul::Symbol("blockDelay")); + uris, URI(NS_INTERNALS "BlockDelay"), Raul::Symbol("blockDelay")); } BlockDelayNode::BlockDelayNode(InternalPlugin* plugin, diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index ec701767..a0b2320b 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -36,7 +36,7 @@ namespace Internals { InternalPlugin* ControllerNode::internal_plugin(URIs& uris) { return new InternalPlugin( - uris, Raul::URI(NS_INTERNALS "Controller"), Raul::Symbol("controller")); + uris, URI(NS_INTERNALS "Controller"), Raul::Symbol("controller")); } ControllerNode::ControllerNode(InternalPlugin* plugin, @@ -53,7 +53,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, const Atom zero = bufs.forge().make(0.0f); const Atom one = bufs.forge().make(1.0f); - const Atom atom_Float = bufs.forge().make_urid(Raul::URI(LV2_ATOM__Float)); + const Atom atom_Float = bufs.forge().make_urid(URI(LV2_ATOM__Float)); _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, PortType::ATOM, uris.atom_Sequence, Atom()); diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index b3688dfd..665ee472 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -40,7 +40,7 @@ namespace Internals { InternalPlugin* NoteNode::internal_plugin(URIs& uris) { return new InternalPlugin( - uris, Raul::URI(NS_INTERNALS "Note"), Raul::Symbol("note")); + uris, URI(NS_INTERNALS "Note"), Raul::Symbol("note")); } NoteNode::NoteNode(InternalPlugin* plugin, diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp index 2da2a2ae..5474bf21 100644 --- a/src/server/internals/Time.cpp +++ b/src/server/internals/Time.cpp @@ -33,7 +33,7 @@ namespace Internals { InternalPlugin* TimeNode::internal_plugin(URIs& uris) { return new InternalPlugin( - uris, Raul::URI(NS_INTERNALS "Time"), Raul::Symbol("time")); + uris, URI(NS_INTERNALS "Time"), Raul::Symbol("time")); } TimeNode::TimeNode(InternalPlugin* plugin, diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 8adf211c..69967877 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -36,7 +36,7 @@ namespace Internals { InternalPlugin* TriggerNode::internal_plugin(URIs& uris) { return new InternalPlugin( - uris, Raul::URI(NS_INTERNALS "Trigger"), Raul::Symbol("trigger")); + uris, URI(NS_INTERNALS "Trigger"), Raul::Symbol("trigger")); } TriggerNode::TriggerNode(InternalPlugin* plugin, |