diff options
author | David Robillard <d@drobilla.net> | 2009-05-28 14:33:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-28 14:33:33 +0000 |
commit | 46b2e1598ed75319735893ed039ac669aca2d8a7 (patch) | |
tree | a36c8c2ba5e2c14c468c34396d0914be258edfda /src/shared | |
parent | f2c45c3f5b1f6c06d351ed91223343cd3a69ab4b (diff) | |
download | ingen-46b2e1598ed75319735893ed039ac669aca2d8a7.tar.gz ingen-46b2e1598ed75319735893ed039ac669aca2d8a7.tar.bz2 ingen-46b2e1598ed75319735893ed039ac669aca2d8a7.zip |
Make SetMetadataEvent do multiple properties at once.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2019 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/ResourceImpl.cpp | 17 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 3 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 9e403be3..ca3eaacd 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -50,8 +50,6 @@ ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value) void ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) { - cerr << "SET PROPERTY " << uri << " = " << value << endl; - assert(value.type() != Raul::Atom::URI || strcmp(value.get_uri(), "lv2:ControlPort")); _properties.erase(uri); _properties.insert(make_pair(uri, value)); } @@ -126,10 +124,23 @@ ResourceImpl::type( void -ResourceImpl::merge_properties(const Properties& p) +ResourceImpl::set_properties(const Properties& p) { typedef Resource::Properties::const_iterator iterator; for (iterator i = p.begin(); i != p.end(); ++i) + _properties.erase(i->first); + for (iterator i = p.begin(); i != p.end(); ++i) + set_property(i->first, i->second); +} + + +void +ResourceImpl::add_properties(const Properties& p) +{ + typedef Resource::Properties::const_iterator iterator; + for (iterator i = p.begin(); i != p.end(); ++i) + _properties.erase(i->first); + for (iterator i = p.begin(); i != p.end(); ++i) add_property(i->first, i->second); } diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index 1f8dbedd..118d4dbe 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -40,7 +40,8 @@ public: const Raul::Atom& get_property(const Raul::URI& uri) const; void set_property(const Raul::URI& uri, const Raul::Atom& value); void add_property(const Raul::URI& uri, const Raul::Atom& value); - void merge_properties(const Properties& p); + void set_properties(const Properties& p); + void add_properties(const Properties& p); sigc::signal<void, const Raul::URI&, const Raul::Atom&> signal_property; |