diff options
author | David Robillard <d@drobilla.net> | 2011-02-19 05:10:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-19 05:10:29 +0000 |
commit | 6b18de71d1c603255b263a64434005306f152f13 (patch) | |
tree | 09c6e87acca1fe76bc74b3b549fee7ad09751993 /src/shared | |
parent | 8e07e115429a0869593d4f29dc3e6cf5c8b25049 (diff) | |
download | ingen-6b18de71d1c603255b263a64434005306f152f13.tar.gz ingen-6b18de71d1c603255b263a64434005306f152f13.tar.bz2 ingen-6b18de71d1c603255b263a64434005306f152f13.zip |
Save/load patches as nested bundles (fix ticket #520).
Sane (context-based, ala RDF quads) approach to the problem of externally visible / internally visible properties.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2993 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/Builder.cpp | 1 | ||||
-rw-r--r-- | src/shared/ClashAvoider.cpp | 3 | ||||
-rw-r--r-- | src/shared/ClashAvoider.hpp | 3 | ||||
-rw-r--r-- | src/shared/ResourceImpl.cpp | 36 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 5 |
5 files changed, 26 insertions, 22 deletions
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index ef8c23e1..98ce3879 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -97,7 +97,6 @@ void Builder::build_object(SharedPtr<const GraphObject> object) { typedef GraphObject::Properties::const_iterator iterator; - _interface.put(object->meta().uri(), object->meta().properties()); _interface.put(object->uri(), object->properties()); } diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index 36fc5e4e..36244303 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -145,7 +145,8 @@ ClashAvoider::exists(const Raul::Path& path) const void ClashAvoider::put(const Raul::URI& path, - const Shared::Resource::Properties& properties) + const Shared::Resource::Properties& properties, + Resource::Graph ctx) { _target.put(map_uri(path), properties); } diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp index 745d3272..6c43bd72 100644 --- a/src/shared/ClashAvoider.hpp +++ b/src/shared/ClashAvoider.hpp @@ -49,7 +49,8 @@ public: // Object commands virtual void put(const Raul::URI& path, - const Resource::Properties& properties); + const Resource::Properties& properties, + Resource::Graph ctx=Resource::DEFAULT); virtual void delta(const Raul::URI& path, const Shared::Resource::Properties& remove, diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index dc9bfbae..8b8a56ec 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -27,20 +27,6 @@ namespace Ingen { namespace Shared { -bool -ResourceImpl::is_meta_uri(const Raul::URI& uri) -{ - return uri.substr(0, 6) == "meta:#"; -} - - -const Raul::URI -ResourceImpl::meta_uri(const Raul::URI& uri) -{ - return string("meta:#") + uri.chop_start("/"); -} - - void ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value) { @@ -154,8 +140,6 @@ ResourceImpl::type( } else if (atom == uris.atom_MessagePort) { data_type = PortType::MESSAGE; port = true; - } else { - warn << "[ResourceImpl] Unrecognized type " << atom << endl; } } @@ -225,5 +209,25 @@ ResourceImpl::dump(std::ostream& os) const } +Resource::Properties +ResourceImpl::properties(Resource::Graph ctx) const +{ + if (ctx == Resource::DEFAULT) { + return properties(); + } + + typedef Resource::Properties::const_iterator iterator; + + Properties props; + for (iterator i = _properties.begin(); i != _properties.end(); ++i) { + if (i->second.context() == Resource::DEFAULT + || i->second.context() == ctx) { + props.insert(make_pair(i->first, i->second)); + } + } + + return props; +} + } // namespace Shared } // namespace Ingen diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index 6bb88a76..6ce6cd26 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -43,6 +43,8 @@ public: const Properties& properties() const { return _properties; } Properties& properties() { return _properties; } + 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); void remove_property(const Raul::URI& uri, const Raul::Atom& value); @@ -65,9 +67,6 @@ public: bool& node, bool& port, bool& is_output, PortType& data_type); - static bool is_meta_uri(const Raul::URI& uri); - static const Raul::URI meta_uri(const Raul::URI& uri); - protected: Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const; |