From c8ae7295e911c62cf9dedf90187656937cc18cbb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 30 Jul 2016 13:10:13 -0400 Subject: Add undo support --- ingen/Resource.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ingen/Resource.hpp') 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 + Copyright 2007-2016 David Robillard 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); -- cgit v1.2.1