summaryrefslogtreecommitdiffstats
path: root/src/Resource.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-30 13:10:13 -0400
committerDavid Robillard <d@drobilla.net>2016-07-30 15:32:49 -0400
commitc8ae7295e911c62cf9dedf90187656937cc18cbb (patch)
tree0ba1207bf2c63278e9932eed2d04f961144a02db /src/Resource.cpp
parente74c6a3b388ded66fcc4cfb1fa5bece881b63113 (diff)
downloadingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.gz
ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.bz2
ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.zip
Add undo support
Diffstat (limited to 'src/Resource.cpp')
-rw-r--r--src/Resource.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/Resource.cpp b/src/Resource.cpp
index cbb9c3b7..46cd29f8 100644
--- a/src/Resource.cpp
+++ b/src/Resource.cpp
@@ -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
@@ -24,7 +24,7 @@ using namespace std;
namespace Ingen {
-void
+bool
Resource::add_property(const Raul::URI& uri,
const Atom& value,
Graph ctx)
@@ -34,12 +34,13 @@ Resource::add_property(const Raul::URI& uri,
const std::pair<iterator, iterator> range = _properties.equal_range(uri);
for (iterator i = range.first; i != range.second && i != _properties.end(); ++i) {
if (i->second == value && i->second.context() == ctx) {
- return;
+ return false;
}
}
const Atom& v = _properties.insert(make_pair(uri, Property(value, ctx)))->second;
on_property(uri, v);
+ return true;
}
const Atom&
@@ -102,13 +103,7 @@ Resource::remove_property(const Raul::URI& uri, const URIs::Quark& value)
bool
Resource::has_property(const Raul::URI& uri, const Atom& value) const
{
- Properties::const_iterator i = _properties.find(uri);
- for (; (i != _properties.end()) && (i->first == uri); ++i) {
- if (i->second == value) {
- return true;
- }
- }
- return false;
+ return _properties.contains(uri, value);
}
bool