diff options
author | David Robillard <d@drobilla.net> | 2013-01-11 05:40:18 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-11 05:40:18 +0000 |
commit | d443ddb053141510311e002c59746a2dd9ba8b16 (patch) | |
tree | 6bbe7b6532824117dc9a1ca25d7a09ef3601c2cc /src/client | |
parent | 10e9a3a800a35916872abf9e354be4c554338e4e (diff) | |
download | ingen-d443ddb053141510311e002c59746a2dd9ba8b16.tar.gz ingen-d443ddb053141510311e002c59746a2dd9ba8b16.tar.bz2 ingen-d443ddb053141510311e002c59746a2dd9ba8b16.zip |
Use range-based for loops where possible.
Mmm, shiny.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4919 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/BlockModel.cpp | 6 | ||||
-rw-r--r-- | src/client/ClientStore.cpp | 32 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 7 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 8 | ||||
-rw-r--r-- | src/client/PortModel.cpp | 7 |
5 files changed, 27 insertions, 33 deletions
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index cacba04c..eb982f0d 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -143,9 +143,9 @@ BlockModel::add_port(SharedPtr<PortModel> pm) SharedPtr<const PortModel> BlockModel::get_port(const Raul::Symbol& symbol) const { - for (Ports::const_iterator i = _ports.begin(); i != _ports.end(); ++i) - if ((*i)->symbol() == symbol) - return (*i); + for (auto p : _ports) + if (p->symbol() == symbol) + return p; return SharedPtr<PortModel>(); } diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index a6b011a4..318d31a5 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -93,9 +93,8 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) } typedef Resource::Properties::const_iterator Iterator; - for (Iterator i = object->properties().begin(); - i != object->properties().end(); ++i) - object->signal_property().emit(i->first, i->second); + for (auto p : object->properties()) + object->signal_property().emit(p.first, p.second); } SharedPtr<ObjectModel> @@ -217,9 +216,9 @@ ClientStore::put(const Raul::URI& uri, typedef Resource::Properties::const_iterator Iterator; #ifdef INGEN_CLIENT_STORE_DUMP std::cerr << "Put " << uri << " {" << endl; - for (Iterator i = properties.begin(); i != properties.end(); ++i) - std::cerr << '\t' << i->first << " = " << _uris.forge.str(i->second) - << " :: " << i->second.type() << endl; + for (auto p : properties) + std::cerr << '\t' << p.first << " = " << _uris.forge.str(p.second) + << " :: " << p.second.type() << endl; std::cerr << "}" << endl; #endif @@ -313,14 +312,14 @@ ClientStore::delta(const Raul::URI& uri, typedef Resource::Properties::const_iterator iterator; #ifdef INGEN_CLIENT_STORE_DUMP std::cerr << "Delta " << uri << " {" << endl; - for (iterator i = remove.begin(); i != remove.end(); ++i) - std::cerr << " - " << i->first - << " = " << _uris.forge.str(i->second) - << " :: " << i->second.type() << endl; - for (iterator i = add.begin(); i != add.end(); ++i) - std::cerr << " + " << i->first - << " = " << _uris.forge.str(i->second) - << " :: " << i->second.type() << endl; + for (auto r : remove) + std::cerr << " - " << r.first + << " = " << _uris.forge.str(r.second) + << " :: " << r.second.type() << endl; + for (auto a : add) + std::cerr << " + " << a.first + << " = " << _uris.forge.str(a.second) + << " :: " << a.second.type() << endl; std::cerr << "}" << endl; #endif @@ -459,9 +458,8 @@ ClientStore::disconnect_all(const Raul::Path& parent_graph, } const GraphModel::Arcs arcs = graph->arcs(); - for (GraphModel::Arcs::const_iterator i = arcs.begin(); - i != arcs.end(); ++i) { - SharedPtr<ArcModel> arc = PtrCast<ArcModel>(i->second); + for (auto a : arcs) { + SharedPtr<ArcModel> arc = PtrCast<ArcModel>(a.second); if (arc->tail()->parent() == object || arc->head()->parent() == object || arc->tail()->path() == path diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 5c2bae00..51427f90 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -79,10 +79,9 @@ ObjectModel::set(SharedPtr<ObjectModel> o) if (o->_parent) _parent = o->_parent; - for (Properties::const_iterator v = o->properties().begin(); - v != o->properties().end(); ++v) { - Resource::set_property(v->first, v->second); - _signal_property.emit(v->first, v->second); + for (auto v : o->properties()) { + Resource::set_property(v.first, v.second); + _signal_property.emit(v.first, v.second); } } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 63113e54..8bf7aead 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -159,11 +159,9 @@ PluginModel::set(SharedPtr<PluginModel> p) if (p->_lilv_plugin) _lilv_plugin = p->_lilv_plugin; - for (Properties::const_iterator v = p->properties().begin(); - v != p->properties().end(); - ++v) { - Resource::set_property(v->first, v->second); - _signal_property.emit(v->first, v->second); + for (auto v : p->properties()) { + Resource::set_property(v.first, v.second); + _signal_property.emit(v.first, v.second); } _signal_changed.emit(); diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index e936a1e2..a4261202 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -54,10 +54,9 @@ bool PortModel::is_uri() const { // FIXME: Resource::has_property doesn't work, URI != URID - for (Resource::Properties::const_iterator i = properties().begin(); - i != properties().end(); ++i) { - if (i->second.type() == _uris.atom_URID && - static_cast<LV2_URID>(i->second.get_int32()) == _uris.atom_URID) { + for (auto p : properties()) { + if (p.second.type() == _uris.atom_URID && + static_cast<LV2_URID>(p.second.get_int32()) == _uris.atom_URID) { return true; } } |