summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-22 03:53:44 +0000
committerDavid Robillard <d@drobilla.net>2011-10-22 03:53:44 +0000
commitd3c91af24a76bf999f18eab5cb5136857c93125a (patch)
treea38a0d205d1477390fc6c3fcdf2bdfab8daf08ba /src/shared
parent0cfeb9f3a3a6098e1e2ea6edf07633af7a7d7eaa (diff)
downloadingen-d3c91af24a76bf999f18eab5cb5136857c93125a.tar.gz
ingen-d3c91af24a76bf999f18eab5cb5136857c93125a.tar.bz2
ingen-d3c91af24a76bf999f18eab5cb5136857c93125a.zip
Move basic URI map and unmap implementation to URIs.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3588 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/LV2URIMap.cpp6
-rw-r--r--src/shared/URIs.cpp12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index f87fdfce..d39f0b88 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -48,7 +48,7 @@ uint32_t
LV2URIMap::uri_to_id(const char* map,
const char* uri)
{
- const uint32_t id = static_cast<uint32_t>(g_quark_from_string(uri));
+ const uint32_t id = _uris.map_uri(uri);
if (map && !strcmp(map, LV2_EVENT_URI)) {
GlobalToEvent::iterator i = _global_to_event.find(id);
if (i != _global_to_event.end()) {
@@ -79,9 +79,9 @@ LV2URIMap::id_to_uri(const char* map,
error << "Failed to unmap event URI " << id << endl;
return NULL;
}
- return g_quark_to_string(i->second);
+ return _uris.unmap_uri(i->second);
} else {
- return g_quark_to_string(id);
+ return _uris.unmap_uri(id);
}
}
diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp
index b6f1d0f4..c0753d5d 100644
--- a/src/shared/URIs.cpp
+++ b/src/shared/URIs.cpp
@@ -119,5 +119,17 @@ URIs::URIs()
{
}
+uint32_t
+URIs::map_uri(const char* uri)
+{
+ return static_cast<uint32_t>(g_quark_from_string(uri));
+}
+
+const char*
+URIs::unmap_uri(uint32_t urid)
+{
+ return g_quark_to_string(urid);
+}
+
} // namespace Shared
} // namespace Ingen