diff options
author | David Robillard <d@drobilla.net> | 2011-05-19 22:36:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-19 22:36:30 +0000 |
commit | ddaaa0e19ce196eba68e88165a483cf62478895b (patch) | |
tree | e9cffa134702ec1ea3bf4fba98c8e8f283667d5f /include | |
parent | 9c48078b76cadfb8afd4aeffdf6e97b0b133ef57 (diff) | |
download | ingen-ddaaa0e19ce196eba68e88165a483cf62478895b.tar.gz ingen-ddaaa0e19ce196eba68e88165a483cf62478895b.tar.bz2 ingen-ddaaa0e19ce196eba68e88165a483cf62478895b.zip |
Convey put context parameter via OSC.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3287 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'include')
-rw-r--r-- | include/ingen/Resource.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/ingen/Resource.hpp b/include/ingen/Resource.hpp index 09879501..136c2df8 100644 --- a/include/ingen/Resource.hpp +++ b/include/ingen/Resource.hpp @@ -23,6 +23,9 @@ #include "raul/Atom.hpp" #include "raul/URI.hpp" +#include "raul/log.hpp" + +#define NS_INGEN "http://drobilla.net/software/ingen#" namespace Ingen { @@ -35,6 +38,37 @@ public: INTERNAL }; + static Raul::URI graph_to_uri(Graph g) { + switch (g) { + default: + case DEFAULT: + return "http://drobilla.net/software/ingen#defaultContext"; + case EXTERNAL: + return "http://drobilla.net/software/ingen#externalContext"; + case INTERNAL: + return "http://drobilla.net/software/ingen#internalContext"; + } + } + + static Graph uri_to_graph(const char* uri) { + const size_t prefix_len = strlen("http://drobilla.net/software/ingen#"); + if (strncmp(uri, NS_INGEN, sizeof(NS_INGEN) - 1)) { + return DEFAULT; + } + + const char* suffix = uri + prefix_len; + if (!strcmp(suffix, "defaultContext")) { + return DEFAULT; + } else if (!strcmp(suffix, "externalContext")) { + return EXTERNAL; + } else if (!strcmp(suffix, "internalContext")) { + return INTERNAL; + } + + Raul::error << "Unknown context URI " << uri << std::endl; + return DEFAULT; + } + class Property : public Raul::Atom { public: Property(const Raul::Atom& atom, Graph ctx=DEFAULT) |