summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-09 17:44:36 +0100
committerDavid Robillard <d@drobilla.net>2019-12-12 19:42:09 +0100
commit3c0ed6b66b6e99c68fc01c86b5796a55d74a5977 (patch)
tree7be3252c13ef123b956424169c1bfbf55359564a /src/server/events
parente32f32a360f2bf8f017ea347b6d1e568c0beaf68 (diff)
downloadingen-3c0ed6b66b6e99c68fc01c86b5796a55d74a5977.tar.gz
ingen-3c0ed6b66b6e99c68fc01c86b5796a55d74a5977.tar.bz2
ingen-3c0ed6b66b6e99c68fc01c86b5796a55d74a5977.zip
WIP: Port to serd1serd1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Copy.cpp5
-rw-r--r--src/server/events/Delta.cpp8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index 5418af4b..5ac31f55 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -131,9 +131,10 @@ Copy::engine_to_engine(PreProcessContext& ctx)
}
static bool
-ends_with(const std::string& str, const std::string& end)
+ends_with(const URI& uri, const std::string& end)
{
- if (str.length() >= end.length()) {
+ const auto& str = uri.str();
+ if (str.length() >= end.length()) {
return !str.compare(str.length() - end.length(), end.length(), end);
}
return false;
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 0a7b05ea..ab751b76 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -35,6 +35,8 @@
#include "ingen/World.hpp"
#include "raul/Maid.hpp"
+#include <boost/optional/optional_io.hpp>
+
#include <mutex>
#include <set>
#include <string>
@@ -364,7 +366,7 @@ Delta::pre_process(PreProcessContext& ctx)
_status = Status::BAD_VALUE_TYPE;
}
} else if (key == uris.pset_preset) {
- URI uri;
+ boost::optional<URI> uri;
if (uris.forge.is_uri(value)) {
const std::string uri_str = uris.forge.str(value, false);
if (URI::is_valid(uri_str)) {
@@ -374,9 +376,9 @@ Delta::pre_process(PreProcessContext& ctx)
uri = URI(FilePath(value.ptr<char>()));
}
- if (!uri.empty()) {
+ if (uri) {
op = SpecialType::PRESET;
- if ((_state = block->load_preset(uri))) {
+ if ((_state = block->load_preset(*uri))) {
lilv_state_emit_port_values(
_state, s_add_set_event, this);
} else {