diff options
author | David Robillard <d@drobilla.net> | 2010-02-13 22:07:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-13 22:07:26 +0000 |
commit | ad07c414d557629251b2f4ea4078c22f241cc865 (patch) | |
tree | dafecc5dd8758e0273105bb2a2a8d481509d19fb /src/shared/ResourceImpl.cpp | |
parent | b8cf49d04a2600f83767ddda46929d4d47adc3fd (diff) | |
download | ingen-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/ResourceImpl.cpp')
-rw-r--r-- | src/shared/ResourceImpl.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
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 |