diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/ResourceImpl.cpp | 11 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 9 |
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; }; |