diff options
author | David Robillard <d@drobilla.net> | 2011-09-23 19:44:47 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-09-23 19:44:47 +0000 |
commit | 53f83f508516d2dddf027782dce6dd045bcf1943 (patch) | |
tree | ecb1d924ebc0104205755484355e7d8dad25f8b5 /src/shared | |
parent | 9a99f038176a7fadc59bbeaa3d3d57f16e4abb74 (diff) | |
download | ingen-53f83f508516d2dddf027782dce6dd045bcf1943.tar.gz ingen-53f83f508516d2dddf027782dce6dd045bcf1943.tar.bz2 ingen-53f83f508516d2dddf027782dce6dd045bcf1943.zip |
Don't prompt for save location when path is already known from previous save or load.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3476 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/ResourceImpl.cpp | 16 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index d315b8f0..14227ccf 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -40,10 +40,20 @@ ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value) } Raul::Atom& -ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) +ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value, + Resource::Graph ctx) { - _properties.erase(uri); - return _properties.insert(make_pair(uri, value))->second; + // Erase existing property in this context + for (Properties::iterator i = _properties.find(uri); + (i != _properties.end()) && (i->first == uri); + ++i) { + if (i->second.context() == ctx && i->second == value) { + _properties.erase(i); + } + } + + // Insert new property + return _properties.insert(make_pair(uri, Property(value, ctx)))->second; } void diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index 47d6f31d..6afc567d 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -46,7 +46,8 @@ public: Properties properties(Resource::Graph ctx) const; const Raul::Atom& get_property(const Raul::URI& uri) const; - Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value); + Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value, + Resource::Graph ctx=Resource::DEFAULT); void remove_property(const Raul::URI& uri, const Raul::Atom& value); bool has_property(const Raul::URI& uri, const Raul::Atom& value) const; void add_property(const Raul::URI& uri, const Raul::Atom& value); |