From d443ddb053141510311e002c59746a2dd9ba8b16 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 11 Jan 2013 05:40:18 +0000 Subject: 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 --- src/Configuration.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/Configuration.cpp') diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 60f41597..2776d560 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -96,15 +96,15 @@ Configuration::print_usage(const std::string& program, std::ostream& os) os << _shortdesc << std::endl << std::endl; os << _desc << std::endl << std::endl; os << "Options:" << std::endl; - for (Options::iterator o = _options.begin(); o != _options.end(); ++o) { - Option& option = o->second; + for (auto o : _options) { + Option& option = o.second; os << " "; if (option.letter != '\0') os << "-" << option.letter << ", "; else os << " "; os.width(_max_name_length + 4); - os << std::left << (std::string("--") + o->first); + os << std::left << (std::string("--") + o.first); os << option.desc << std::endl; } } @@ -281,15 +281,15 @@ Configuration::save(URIMap& uri_map, writer); // Write a statement for each valid option - for (Options::iterator o = _options.begin(); o != _options.end(); ++o) { - const Raul::Atom& value = o->second.value; - if (!(o->second.scope & scopes) || - o->second.key.empty() || + for (auto o : _options) { + const Raul::Atom& value = o.second.value; + if (!(o.second.scope & scopes) || + o.second.key.empty() || !value.is_valid()) { continue; } - const std::string key(std::string("ingen:") + o->second.key); + const std::string key(std::string("ingen:") + o.second.key); SerdNode pred = serd_node_from_string( SERD_CURIE, (const uint8_t*)key.c_str()); sratom_write(sratom, &uri_map.urid_unmap_feature()->urid_unmap, 0, @@ -312,10 +312,8 @@ Configuration::load_default(const std::string& app, std::list loaded; const std::vector dirs = Glib::get_system_config_dirs(); - for (std::vector::const_iterator i = dirs.begin(); - i != dirs.end(); - ++i) { - const std::string path = Glib::build_filename(*i, app, filename); + for (auto d : dirs) { + const std::string path = Glib::build_filename(d, app, filename); if (load(path)) { loaded.push_back(path); } -- cgit v1.2.1