diff options
author | David Robillard <d@drobilla.net> | 2017-03-19 13:26:38 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-03-20 02:58:56 +0100 |
commit | f1c793f7e2148b10610a09a459d9e89b39d2d87b (patch) | |
tree | b898407dce08af0f2f978d59a85d4887d8555b54 /ingen/Resource.hpp | |
parent | efc0fe0a973db706d9409b345ad6fae585f4388c (diff) | |
download | ingen-f1c793f7e2148b10610a09a459d9e89b39d2d87b.tar.gz ingen-f1c793f7e2148b10610a09a459d9e89b39d2d87b.tar.bz2 ingen-f1c793f7e2148b10610a09a459d9e89b39d2d87b.zip |
Fix round-trip preservation of property contexts
Diffstat (limited to 'ingen/Resource.hpp')
-rw-r--r-- | ingen/Resource.hpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp index 3eb1349f..fe3d94fa 100644 --- a/ingen/Resource.hpp +++ b/ingen/Resource.hpp @@ -57,25 +57,19 @@ public: static Raul::URI graph_to_uri(Graph g) { switch (g) { - case Graph::DEFAULT: return Raul::URI(INGEN_NS "defaultContext"); case Graph::EXTERNAL: return Raul::URI(INGEN_NS "externalContext"); case Graph::INTERNAL: return Raul::URI(INGEN_NS "internalContext"); + default: return Raul::URI(INGEN_NS "defaultContext"); } } - static Graph uri_to_graph(const char* uri) { - const char* suffix = uri + sizeof(INGEN_NS) - 1; - if (strncmp(uri, INGEN_NS, sizeof(INGEN_NS) - 1)) { - return Graph::DEFAULT; - } else if (!strcmp(suffix, "defaultContext")) { - return Graph::DEFAULT; - } else if (!strcmp(suffix, "externalContext")) { + static Graph uri_to_graph(const Raul::URI& uri) { + if (uri == INGEN_NS "externalContext") { return Graph::EXTERNAL; - } else if (!strcmp(suffix, "internalContext")) { + } else if (uri == INGEN_NS "internalContext") { return Graph::INTERNAL; - } else { - return Graph::DEFAULT; } + return Graph::DEFAULT; } virtual ~Resource() {} |