diff options
author | David Robillard <d@drobilla.net> | 2011-05-13 03:02:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-13 03:02:06 +0000 |
commit | 6bb7a6d9818210511c231b6ac09c051bcd3c564b (patch) | |
tree | 43d8d3749c4e079137c4aaaa4cec29f21c774d29 /src | |
parent | 198560d5fd499ab14eb4e130ee74e21fa86674a4 (diff) | |
download | ingen-6bb7a6d9818210511c231b6ac09c051bcd3c564b.tar.gz ingen-6bb7a6d9818210511c231b6ac09c051bcd3c564b.tar.bz2 ingen-6bb7a6d9818210511c231b6ac09c051bcd3c564b.zip |
Make ClientStore::plugin and ClientStore::resource const-correct.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3260 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/client/ClientStore.cpp | 26 | ||||
-rw-r--r-- | src/client/ClientStore.hpp | 7 |
2 files changed, 23 insertions, 10 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 24d7728f..492529a0 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -153,7 +153,7 @@ ClientStore::remove_object(const Path& path) } SharedPtr<PluginModel> -ClientStore::plugin(const URI& uri) +ClientStore::_plugin(const URI& uri) { assert(uri.length() > 0); Plugins::iterator i = _plugins->find(uri); @@ -163,6 +163,12 @@ ClientStore::plugin(const URI& uri) return (*i).second; } +SharedPtr<const PluginModel> +ClientStore::plugin(const Raul::URI& uri) const +{ + return const_cast<ClientStore*>(this)->_plugin(uri); +} + SharedPtr<ObjectModel> ClientStore::_object(const Path& path) { @@ -185,18 +191,24 @@ ClientStore::object(const Path& path) const } SharedPtr<Resource> -ClientStore::resource(const URI& uri) +ClientStore::_resource(const URI& uri) { if (Path::is_path(uri)) return _object(uri.str()); else - return plugin(uri); + return _plugin(uri); +} + +SharedPtr<const Resource> +ClientStore::resource(const Raul::URI& uri) const +{ + return const_cast<ClientStore*>(this)->_resource(uri); } void ClientStore::add_plugin(SharedPtr<PluginModel> pm) { - SharedPtr<PluginModel> existing = this->plugin(pm->uri()); + SharedPtr<PluginModel> existing = _plugin(pm->uri()); if (existing) { existing->set(pm); } else { @@ -315,7 +327,7 @@ ClientStore::put(const URI& uri, const Iterator p = properties.find(_uris->rdf_instanceOf); SharedPtr<PluginModel> plug; if (p->second.is_valid() && p->second.type() == Atom::URI) { - if (!(plug = plugin(p->second.get_uri()))) { + if (!(plug = _plugin(p->second.get_uri()))) { LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl; plug = SharedPtr<PluginModel>( new PluginModel(uris(), @@ -389,11 +401,11 @@ ClientStore::delta(const URI& uri, void ClientStore::set_property(const URI& subject_uri, const URI& predicate, const Atom& value) { - SharedPtr<Resource> subject = resource(subject_uri); + SharedPtr<Resource> subject = _resource(subject_uri); if (subject) { subject->set_property(predicate, value); } else { - SharedPtr<PluginModel> plugin = this->plugin(subject_uri); + SharedPtr<PluginModel> plugin = _plugin(subject_uri); if (plugin) plugin->set_property(predicate, value); else diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp index 32b66484..a01a9dc6 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -61,10 +61,9 @@ public: SharedPtr<ServerInterface> engine=SharedPtr<ServerInterface>(), SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); - SharedPtr<PluginModel> plugin(const Raul::URI& uri); - SharedPtr<Resource> resource(const Raul::URI& uri); - SharedPtr<const ObjectModel> object(const Raul::Path& path) const; + SharedPtr<const PluginModel> plugin(const Raul::URI& uri) const; + SharedPtr<const Resource> resource(const Raul::URI& uri) const; void clear(); @@ -111,6 +110,8 @@ private: void add(GraphObject* o) { throw; } SharedPtr<ObjectModel> _object(const Raul::Path& path); + SharedPtr<PluginModel> _plugin(const Raul::URI& uri); + SharedPtr<Resource> _resource(const Raul::URI& uri); void add_object(SharedPtr<ObjectModel> object); SharedPtr<ObjectModel> remove_object(const Raul::Path& path); |