summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-01-21 00:41:34 +0100
committerDavid Robillard <d@drobilla.net>2018-01-21 00:56:50 +0100
commit44f7ad5222d824d81dc743045d5887418847e74e (patch)
tree1b41535ac00b8b225a25dba2873b064cb074bfa9 /src/server/events
parent90fca083052880479ad90d870e556f0648e32106 (diff)
downloadingen-44f7ad5222d824d81dc743045d5887418847e74e.tar.gz
ingen-44f7ad5222d824d81dc743045d5887418847e74e.tar.bz2
ingen-44f7ad5222d824d81dc743045d5887418847e74e.zip
Add URI class and remove use of Raul::URI
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Copy.cpp4
-rw-r--r--src/server/events/CreateBlock.cpp2
-rw-r--r--src/server/events/CreateGraph.cpp8
-rw-r--r--src/server/events/Delete.cpp2
-rw-r--r--src/server/events/Delta.cpp24
-rw-r--r--src/server/events/Delta.hpp4
-rw-r--r--src/server/events/Get.cpp2
7 files changed, 22 insertions, 24 deletions
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);
}