diff options
author | David Robillard <d@drobilla.net> | 2008-08-18 03:49:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-18 03:49:35 +0000 |
commit | af759288a2517f9acf4c28f79d9c43be0086a221 (patch) | |
tree | b5852382a750fa5f8a6bc60f27edf9881960374f /src/libs/engine | |
parent | 77d608d6ca282795b348a615932b1abbd47b0472 (diff) | |
download | ingen-af759288a2517f9acf4c28f79d9c43be0086a221.tar.gz ingen-af759288a2517f9acf4c28f79d9c43be0086a221.tar.bz2 ingen-af759288a2517f9acf4c28f79d9c43be0086a221.zip |
More copy/paste and serialisation work.
Don't die on invalid path for set_property and set_variable (return error to client).
Working paste to subpatches, paste of connected patch ports and modules.
git-svn-id: http://svn.drobilla.net/lad/ingen@1428 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/OSCEngineReceiver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/SetMetadataEvent.cpp | 12 | ||||
-rw-r--r-- | src/libs/engine/events/SetMetadataEvent.hpp | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index b9e2a70d..1078a86a 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -70,7 +70,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t } // For debugging, print all incoming OSC messages - //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); + lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); // Set response address for this message. // It's important this is first and returns nonzero. diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index b4ee00ff..341fa06c 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -17,6 +17,7 @@ #include "SetMetadataEvent.hpp" #include <string> +#include <boost/format.hpp> #include "Responder.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" @@ -37,6 +38,7 @@ SetMetadataEvent::SetMetadataEvent( const string& key, const Atom& value) : QueuedEvent(engine, responder, timestamp) + , _error(NO_ERROR) , _property(property) , _path(path) , _key(key) @@ -49,6 +51,12 @@ SetMetadataEvent::SetMetadataEvent( void SetMetadataEvent::pre_process() { + if (!Path::is_valid(_path)) { + _error = INVALID_PATH; + QueuedEvent::pre_process(); + return; + } + _object = _engine.engine_store()->find_object(_path); if (_object == NULL) { QueuedEvent::pre_process(); @@ -75,7 +83,9 @@ SetMetadataEvent::execute(ProcessContext& context) void SetMetadataEvent::post_process() { - if (_object == NULL) { + if (_error == INVALID_PATH) { + _responder->respond_error((boost::format("Invalid path %1% setting %2%") % _path % _key).str()); + } else if (_object == NULL) { string msg = "Unable to find object "; msg += _path; _responder->respond_error(msg); diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp index 9707ce56..f6f8d3c3 100644 --- a/src/libs/engine/events/SetMetadataEvent.hpp +++ b/src/libs/engine/events/SetMetadataEvent.hpp @@ -49,6 +49,8 @@ public: void post_process(); private: + enum { NO_ERROR, INVALID_PATH } _error; + bool _property; string _path; string _key; |