diff options
Diffstat (limited to 'src/shared/LV2URIMap.hpp')
-rw-r--r-- | src/shared/LV2URIMap.hpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp index 8c645ae0..d34be8f9 100644 --- a/src/shared/LV2URIMap.hpp +++ b/src/shared/LV2URIMap.hpp @@ -21,6 +21,7 @@ #include <boost/utility.hpp> #include "raul/URI.hpp" #include "lv2/http/lv2plug.in/ns/ext/uri-map/uri-map.h" +#include "lv2/http/lv2plug.in/ns/ext/uri-unmap/uri-unmap.h" #include "ingen-config.h" #include "LV2Features.hpp" @@ -28,7 +29,7 @@ namespace Ingen { namespace Shared { -/** Implementation of the LV2 URI Map extension +/** Implementation of the LV2 URI Map and URI Unmap extensions */ class LV2URIMap : public boost::noncopyable, public LV2Features::Feature { public: @@ -38,16 +39,38 @@ public: return SharedPtr<LV2_Feature>(&uri_map_feature, NullDeleter<LV2_Feature>); } - virtual uint32_t uri_to_id(const char* map, const char* uri); + struct UnmapFeature : public LV2Features::Feature { + UnmapFeature(const LV2URIMap& map) : _feature(map.uri_unmap_feature) {} + + SharedPtr<LV2_Feature> feature(Node*) { + return SharedPtr<LV2_Feature>(&_feature, NullDeleter<LV2_Feature>); + } + + LV2_Feature _feature; + }; + + SharedPtr<UnmapFeature> unmap_feature() { return _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); private: static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, const char* uri); + static const char* uri_unmap_id_to_uri(LV2_URI_Map_Callback_Data callback_data, + const char* map, + const uint32_t id); + LV2_Feature uri_map_feature; LV2_URI_Map_Feature uri_map_feature_data; + LV2_Feature uri_unmap_feature; + LV2_URI_Unmap_Feature uri_unmap_feature_data; + + SharedPtr<UnmapFeature> _unmap_feature; + public: struct Quark : public Raul::URI { Quark(const char* str); |