summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-13 22:07:26 +0000
committerDavid Robillard <d@drobilla.net>2010-02-13 22:07:26 +0000
commitad07c414d557629251b2f4ea4078c22f241cc865 (patch)
treedafecc5dd8758e0273105bb2a2a8d481509d19fb /src/shared
parentb8cf49d04a2600f83767ddda46929d4d47adc3fd (diff)
downloadingen-ad07c414d557629251b2f4ea4078c22f241cc865.tar.gz
ingen-ad07c414d557629251b2f4ea4078c22f241cc865.tar.bz2
ingen-ad07c414d557629251b2f4ea4078c22f241cc865.zip
Learn and remove bindings exclusively through property interface.
Note this commit breaks some aspects of OSC and HTTP control for now. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2442 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ClashAvoider.cpp9
-rw-r--r--src/shared/ClashAvoider.hpp4
-rw-r--r--src/shared/LV2URIMap.cpp1
-rw-r--r--src/shared/LV2URIMap.hpp1
-rw-r--r--src/shared/ResourceImpl.cpp52
-rw-r--r--src/shared/ResourceImpl.hpp4
6 files changed, 71 insertions, 0 deletions
diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp
index c6aec06d..c86d9cde 100644
--- a/src/shared/ClashAvoider.cpp
+++ b/src/shared/ClashAvoider.cpp
@@ -152,6 +152,15 @@ ClashAvoider::put(const Raul::URI& path,
void
+ClashAvoider::delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add)
+{
+ _target.delta(map_uri(path), remove, add);
+}
+
+
+void
ClashAvoider::move(const Raul::Path& old_path,
const Raul::Path& new_path)
{
diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp
index 50a036da..9c131e0e 100644
--- a/src/shared/ClashAvoider.hpp
+++ b/src/shared/ClashAvoider.hpp
@@ -51,6 +51,10 @@ public:
virtual void put(const Raul::URI& path,
const Resource::Properties& properties);
+ virtual void delta(const Raul::URI& path,
+ const Shared::Resource::Properties& remove,
+ const Shared::Resource::Properties& add);
+
virtual void move(const Raul::Path& old_path,
const Raul::Path& new_path);
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index 5717a4a9..f83f7aa5 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -104,6 +104,7 @@ LV2URIMap::LV2URIMap()
, rdfs_seeAlso(NS_RDFS "seeAlso")
, string_transfer("http://lv2plug.in/ns/dev/string-port#StringTransfer")
, ui_format_events("http://lv2plug.in/ns/extensions/ui#Events")
+ , wildcard(NS_INGEN "wildcard")
{
uri_map_feature_data.uri_to_id = &LV2URIMap::uri_map_uri_to_id;
uri_map_feature_data.callback_data = this;
diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp
index d14314b7..6b298e79 100644
--- a/src/shared/LV2URIMap.hpp
+++ b/src/shared/LV2URIMap.hpp
@@ -112,6 +112,7 @@ public:
const Quark rdfs_seeAlso;
const Quark string_transfer;
const Quark ui_format_events;
+ const Quark wildcard;
};
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp
index ea64a5d7..230d53b8 100644
--- a/src/shared/ResourceImpl.cpp
+++ b/src/shared/ResourceImpl.cpp
@@ -64,6 +64,24 @@ ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value)
}
+void
+ResourceImpl::remove_property(const Raul::URI& uri, const Raul::Atom& value)
+{
+ const LV2URIMap& uris = Shared::LV2URIMap::instance();
+ if (value == uris.wildcard) {
+ _properties.erase(uri);
+ } else {
+ Properties::iterator i = _properties.find(uri);
+ for (; (i != _properties.end()) && (i->first == uri); ++i) {
+ if (i->second == value) {
+ _properties.erase(i);
+ return;
+ }
+ }
+ }
+}
+
+
bool
ResourceImpl::has_property(const Raul::URI& uri, const Raul::Atom& value) const
{
@@ -177,5 +195,39 @@ ResourceImpl::add_properties(const Properties& p)
}
+void
+ResourceImpl::remove_properties(const Properties& p)
+{
+ const LV2URIMap& uris = Shared::LV2URIMap::instance();
+ typedef Resource::Properties::const_iterator iterator;
+ for (iterator i = p.begin(); i != p.end(); ++i) {
+ if (i->second == uris.wildcard) {
+ _properties.erase(i->first);
+ } else {
+ for (Properties::iterator j = _properties.find(i->first);
+ (j != _properties.end()) && (j->first == i->first); ++j) {
+ if (j->second == i->second) {
+ _properties.erase(j);
+ break;
+ }
+ }
+ }
+ }
+}
+
+
+void
+
+ResourceImpl::dump(std::ostream& os) const
+{
+ typedef Resource::Properties::const_iterator iterator;
+ os << _uri << " [" << endl;
+ for (iterator i = _properties.begin(); i != _properties.end(); ++i) {
+ os << "\t" << i->first << " " << i->second << " ;" << endl;
+ }
+ os << "]" << endl;
+}
+
+
} // namespace Shared
} // namespace Ingen
diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp
index eb80a46c..8e827df8 100644
--- a/src/shared/ResourceImpl.hpp
+++ b/src/shared/ResourceImpl.hpp
@@ -40,10 +40,14 @@ public:
const Raul::Atom& get_property(const Raul::URI& uri) const;
Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value);
+ void remove_property(const Raul::URI& uri, const Raul::Atom& value);
bool has_property(const Raul::URI& uri, const Raul::Atom& value) const;
void add_property(const Raul::URI& uri, const Raul::Atom& value);
void set_properties(const Properties& p);
void add_properties(const Properties& p);
+ void remove_properties(const Properties& p);
+
+ void dump(std::ostream& os) const;
sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property;