summaryrefslogtreecommitdiffstats
path: root/src/shared/LV2URIMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/LV2URIMap.cpp')
-rw-r--r--src/shared/LV2URIMap.cpp88
1 files changed, 1 insertions, 87 deletions
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index 14b6ca0a..8a414c9f 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -26,7 +26,6 @@
#include "ingen/shared/LV2URIMap.hpp"
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
-#include "lv2/lv2plug.in/ns/ext/event/event.h"
#include "raul/log.hpp"
using namespace std;
@@ -36,19 +35,11 @@ namespace Ingen {
namespace Shared {
LV2URIMap::LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap)
- : _uri_map_feature(new URIMapFeature(this))
- , _urid_map_feature(new URIDMapFeature(this, map))
+ : _urid_map_feature(new URIDMapFeature(this, map))
, _urid_unmap_feature(new URIDUnmapFeature(this, unmap))
{
}
-LV2URIMap::URIMapFeature::URIMapFeature(LV2URIMap* map)
- : Feature(LV2_URI_MAP_URI, &uri_map)
-{
- uri_map.uri_to_id = &LV2URIMap::uri_map_uri_to_id;
- uri_map.callback_data = map;
-}
-
LV2URIMap::URIDMapFeature::URIDMapFeature(LV2URIMap* map,
LV2_URID_Map* impl)
: Feature(LV2_URID__map, &urid_map)
@@ -101,83 +92,6 @@ LV2URIMap::URIDUnmapFeature::unmap(LV2_URID urid)
}
uint32_t
-LV2URIMap::uri_to_id(const char* map,
- const char* uri)
-{
- const uint32_t id = map_uri(uri);
- if (map && !strcmp(map, LV2_EVENT_URI)) {
- GlobalToEvent::iterator i = _global_to_event.find(id);
- if (i != _global_to_event.end()) {
- return i->second;
- } else {
- if (_global_to_event.size() + 1 > UINT16_MAX) {
- error << "Event URI " << uri << " ID out of range." << endl;
- return 0;
- }
- const uint16_t ev_id = _global_to_event.size() + 1;
- assert(_event_to_global.find(ev_id) == _event_to_global.end());
- _global_to_event.insert(make_pair(id, ev_id));
- _event_to_global.insert(make_pair(ev_id, id));
- return ev_id;
- }
- } else {
- return id;
- }
-}
-
-const char*
-LV2URIMap::id_to_uri(const char* map,
- const uint32_t id)
-{
- if (map && !strcmp(map, LV2_EVENT_URI)) {
- EventToGlobal::iterator i = _event_to_global.find(id);
- if (i == _event_to_global.end()) {
- error << "Failed to unmap event URI " << id << endl;
- return NULL;
- }
- return unmap_uri(i->second);
- } else {
- return unmap_uri(id);
- }
-}
-
-std::pair<bool, uint32_t>
-LV2URIMap::event_to_global(uint16_t event_id) const
-{
- EventToGlobal::const_iterator i = _event_to_global.find(event_id);
- if (i == _event_to_global.end()) {
- return std::make_pair(false, uint32_t(0));
- }
- return std::make_pair(true, i->second);
-}
-
-std::pair<bool, uint16_t>
-LV2URIMap::global_to_event(uint32_t global_id) const
-{
- GlobalToEvent::const_iterator i = _global_to_event.find(global_id);
- if (i == _global_to_event.end()) {
- return std::make_pair(false, uint16_t(0));
- }
- return std::make_pair(true, i->second);
-}
-
-uint32_t
-LV2URIMap::uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data,
- const char* map,
- const char* uri)
-{
- LV2URIMap* me = (LV2URIMap*)callback_data;
- return me->uri_to_id(map, uri);
-}
-
-LV2_URID
-LV2URIMap::urid_map(LV2_URID_Map_Handle handle, const char* uri)
-{
- LV2URIMap* me = (LV2URIMap*)handle;
- return me->uri_to_id(NULL, uri);
-}
-
-uint32_t
LV2URIMap::map_uri(const char* uri)
{
return _urid_map_feature->map(uri);