summaryrefslogtreecommitdiffstats
path: root/include/ingen/shared/LV2URIMap.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/ingen/shared/LV2URIMap.hpp')
-rw-r--r--include/ingen/shared/LV2URIMap.hpp71
1 files changed, 56 insertions, 15 deletions
diff --git a/include/ingen/shared/LV2URIMap.hpp b/include/ingen/shared/LV2URIMap.hpp
index 98508fd1..fc41f3bf 100644
--- a/include/ingen/shared/LV2URIMap.hpp
+++ b/include/ingen/shared/LV2URIMap.hpp
@@ -24,22 +24,62 @@
#include <boost/utility.hpp>
#include "ingen/shared/LV2Features.hpp"
-#include "ingen/shared/URIs.hpp"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
+#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "raul/URI.hpp"
namespace Ingen {
namespace Shared {
-/** Implementation of the LV2 URI Map extension
- */
-class LV2URIMap : public boost::noncopyable, public LV2Features::Feature {
+/** URI to Integer Map */
+class LV2URIMap : public boost::noncopyable {
public:
- LV2URIMap(URIs& uris);
-
- SharedPtr<LV2_Feature> feature(Shared::World*, Node*) {
- return SharedPtr<LV2_Feature>(&uri_map_feature, NullDeleter<LV2_Feature>);
- }
+ LV2URIMap(LV2_URID_Map* map, LV2_URID_Unmap* unmap);
+ virtual ~LV2URIMap() {}
+
+ uint32_t map_uri(const char* uri);
+ const char* unmap_uri(uint32_t urid);
+
+ class Feature : public LV2Features::Feature {
+ public:
+ Feature(const char* URI, void* data) {
+ _feature.URI = URI;
+ _feature.data = data;
+ }
+
+ SharedPtr<LV2_Feature> feature(Shared::World*, Node*) {
+ return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>);
+ }
+
+ private:
+ LV2_Feature _feature;
+ };
+
+ class URIMapFeature : public Feature {
+ public:
+ URIMapFeature(LV2URIMap* map);
+
+ private:
+ LV2_URI_Map_Feature _feature_data;
+ };
+
+ class URIDMapFeature : public Feature {
+ public:
+ URIDMapFeature(LV2URIMap* map, LV2_URID_Map* urid_map);
+ private:
+ LV2_URID_Map _feature_data;
+ };
+
+ class URIDUnmapFeature : public Feature {
+ public:
+ URIDUnmapFeature(LV2URIMap* map, LV2_URID_Unmap* urid_unmap);
+ private:
+ LV2_URID_Unmap _feature_data;
+ };
+
+ SharedPtr<URIMapFeature> uri_map_feature() { return _uri_map_feature; }
+ SharedPtr<URIDMapFeature> urid_map_feature() { return _urid_map_feature; }
+ SharedPtr<URIDUnmapFeature> urid_unmap_feature() { return _urid_unmap_feature; }
virtual uint32_t uri_to_id(const char* map, const char* uri);
virtual const char* id_to_uri(const char* map, uint32_t id);
@@ -52,16 +92,17 @@ private:
const char* map,
const char* uri);
- LV2_Feature uri_map_feature;
- LV2_URI_Map_Feature uri_map_feature_data;
+ static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char* uri);
+ static const char* urid_unmap(LV2_URID_Map_Handle handle, LV2_URID urid);
typedef std::map<uint16_t, uint32_t> EventToGlobal;
typedef std::map<uint32_t, uint16_t> GlobalToEvent;
- EventToGlobal _event_to_global;
- GlobalToEvent _global_to_event;
-
- URIs& _uris;
+ SharedPtr<URIMapFeature> _uri_map_feature;
+ SharedPtr<URIDMapFeature> _urid_map_feature;
+ SharedPtr<URIDUnmapFeature> _urid_unmap_feature;
+ EventToGlobal _event_to_global;
+ GlobalToEvent _global_to_event;
};
} // namespace Shared