diff options
author | David Robillard <d@drobilla.net> | 2016-07-30 13:10:13 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-07-30 15:32:49 -0400 |
commit | c8ae7295e911c62cf9dedf90187656937cc18cbb (patch) | |
tree | 0ba1207bf2c63278e9932eed2d04f961144a02db /ingen/Resource.hpp | |
parent | e74c6a3b388ded66fcc4cfb1fa5bece881b63113 (diff) | |
download | ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.gz ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.bz2 ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.zip |
Add undo support
Diffstat (limited to 'ingen/Resource.hpp')
-rw-r--r-- | ingen/Resource.hpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp index 31d23dac..604428ce 100644 --- a/ingen/Resource.hpp +++ b/ingen/Resource.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2016 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -122,6 +122,15 @@ public: Graph ctx = Graph::DEFAULT) { insert(std::make_pair(key, Property(value, ctx))); } + + bool contains(const Raul::URI& key, const Atom& value) { + for (const_iterator i = find(key); i != end() && i->first == key; ++i) { + if (i->second == value) { + return true; + } + } + return false; + } }; /** Get a single property value. @@ -156,8 +165,10 @@ public: * This will not remove any existing values, so if properties with * predicate `uri` and values other than `value` exist, this will result * in multiple values for the property. + * + * @return True iff a new property was added. */ - virtual void add_property(const Raul::URI& uri, + virtual bool add_property(const Raul::URI& uri, const Atom& value, Graph ctx = Graph::DEFAULT); |