summaryrefslogtreecommitdiffstats
path: root/src/Resource.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-11 05:40:18 +0000
committerDavid Robillard <d@drobilla.net>2013-01-11 05:40:18 +0000
commitd443ddb053141510311e002c59746a2dd9ba8b16 (patch)
tree6bbe7b6532824117dc9a1ca25d7a09ef3601c2cc /src/Resource.cpp
parent10e9a3a800a35916872abf9e354be4c554338e4e (diff)
downloadingen-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/Resource.cpp')
-rw-r--r--src/Resource.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Resource.cpp b/src/Resource.cpp
index 38c00248..1a701eca 100644
--- a/src/Resource.cpp
+++ b/src/Resource.cpp
@@ -152,35 +152,35 @@ Resource::type(const URIs& uris,
}
void
-Resource::set_properties(const Properties& p)
+Resource::set_properties(const Properties& props)
{
/* Note a simple loop that calls set_property is inappropriate here since
it will not correctly set multiple properties in p (notably rdf:type)
*/
// Erase existing properties with matching keys
- for (Properties::const_iterator i = p.begin(); i != p.end(); ++i) {
- _properties.erase(i->first);
+ for (const auto& p : props) {
+ _properties.erase(p.first);
}
// Set new properties
- add_properties(p);
+ add_properties(props);
}
void
-Resource::add_properties(const Properties& p)
+Resource::add_properties(const Properties& props)
{
typedef Resource::Properties::const_iterator iterator;
- for (iterator i = p.begin(); i != p.end(); ++i)
- add_property(i->first, i->second, i->second.context());
+ for (const auto& p : props)
+ add_property(p.first, p.second, p.second.context());
}
void
-Resource::remove_properties(const Properties& p)
+Resource::remove_properties(const Properties& props)
{
typedef Resource::Properties::const_iterator iterator;
- for (iterator i = p.begin(); i != p.end(); ++i)
- remove_property(i->first, i->second);
+ for (const auto& p : props)
+ remove_property(p.first, p.second);
}
Resource::Properties
@@ -193,10 +193,10 @@ Resource::properties(Resource::Graph ctx) const
typedef Resource::Properties::const_iterator iterator;
Properties props;
- for (iterator i = _properties.begin(); i != _properties.end(); ++i) {
- if (i->second.context() == Resource::Graph::DEFAULT
- || i->second.context() == ctx) {
- props.insert(make_pair(i->first, i->second));
+ for (const auto& p : _properties) {
+ if (p.second.context() == Resource::Graph::DEFAULT
+ || p.second.context() == ctx) {
+ props.insert(make_pair(p.first, p.second));
}
}