]> git.tdb.fi Git - builder.git/blobdiff - source/sourcearchivecomponent.cpp
Replace basic for loops with range-based loops or algorithms
[builder.git] / source / sourcearchivecomponent.cpp
index 3304e6badff7df162d6a76d77f878d5cdc68b06c..fdf82e53bafb1a966fe56db064d0dfba9f3ef6ff 100644 (file)
@@ -6,6 +6,7 @@
 #include "tool.h"
 
 using namespace std;
+using namespace Msp;
 
 SourceArchiveComponent::SourceArchiveComponent(SourcePackage &p):
        Component(p, p.get_name()+"-source")
@@ -18,21 +19,19 @@ void SourceArchiveComponent::create_targets() const
        list<Target *> files;
        files.insert(files.begin(), &package.get_build_file());
 
-       SourceList source_filenames = collect_source_files();
-       for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
+       for(const FS::Path &s: collect_source_files())
        {
-               FileTarget *file = builder.get_vfs().get_target(*i);
+               FileTarget *file = builder.get_vfs().get_target(s);
                if(!file)
-                       file = new File(builder, package, *i);
+                       file = new File(builder, package, s);
                files.push_back(file);
        }
 
        BuildGraph &build_graph = builder.get_build_graph();
-       const BuildGraph::TargetMap &targets = build_graph.get_targets();
-       for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
-               if(i->second->get_package()==&package && !i->second->is_buildable())
-                       if(find(files.begin(), files.end(), i->second)==files.end())
-                               files.push_back(i->second);
+       for(const auto &kvp: build_graph.get_targets())
+               if(kvp.second->get_package()==&package && !kvp.second->is_buildable())
+                       if(find(files.begin(), files.end(), kvp.second)==files.end())
+                               files.push_back(kvp.second);
 
        const Toolchain &toolchain = builder.get_toolchain();
        string archive_name = package.get_name();