summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-28 19:54:24 +0000
committerDavid Robillard <d@drobilla.net>2009-05-28 19:54:24 +0000
commitcf6e43bc6a14fc0fd290864b4f71aeb600a28e9d (patch)
tree9dca0dddfdb454e2db6d8e4c0c15adcafc140ee5 /src/shared
parent939a16ee56b4ba58246a98afda203f714d7d17c8 (diff)
downloadingen-cf6e43bc6a14fc0fd290864b4f71aeb600a28e9d.tar.gz
ingen-cf6e43bc6a14fc0fd290864b4f71aeb600a28e9d.tar.bz2
ingen-cf6e43bc6a14fc0fd290864b4f71aeb600a28e9d.zip
Generic plugin property mechanism.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2031 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ResourceImpl.cpp11
-rw-r--r--src/shared/ResourceImpl.hpp9
2 files changed, 15 insertions, 5 deletions
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp
index ca3eaacd..ac828f58 100644
--- a/src/shared/ResourceImpl.cpp
+++ b/src/shared/ResourceImpl.cpp
@@ -47,11 +47,18 @@ ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value)
}
-void
+Raul::Atom&
ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value)
{
_properties.erase(uri);
- _properties.insert(make_pair(uri, value));
+ return _properties.insert(make_pair(uri, value))->second;
+}
+
+
+Raul::Atom&
+ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) const
+{
+ return const_cast<ResourceImpl*>(this)->set_property(uri, value);
}
diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp
index 118d4dbe..36d4305e 100644
--- a/src/shared/ResourceImpl.hpp
+++ b/src/shared/ResourceImpl.hpp
@@ -38,7 +38,7 @@ public:
Properties& properties() { return _properties; }
const Raul::Atom& get_property(const Raul::URI& uri) const;
- void set_property(const Raul::URI& uri, const Raul::Atom& value);
+ Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value);
void add_property(const Raul::URI& uri, const Raul::Atom& value);
void set_properties(const Properties& p);
void add_properties(const Properties& p);
@@ -57,9 +57,12 @@ public:
static const Raul::URI meta_uri(const Raul::URI& base, const Raul::URI& uri);
+protected:
+ Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const;
+
private:
- Raul::URI _uri;
- Properties _properties;
+ Raul::URI _uri;
+ mutable Properties _properties;
};