]> git.tdb.fi Git - builder.git/blobdiff - source/apkbuilder.cpp
Replace basic for loops with range-based loops or algorithms
[builder.git] / source / apkbuilder.cpp
index 9cd1a16b5b45e878bf194509438e9a06dd26d52b..2568f33e081bce17a8852300ca09bf75da758e4f 100644 (file)
@@ -25,11 +25,11 @@ Target *ApkBuilder::create_target(const list<Target *> &sources, const string &)
 {
        AndroidResourceBundle *resource_bundle = 0;
        list<FileTarget *> other_files;
-       for(list<Target *>::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+       for(Target *s: sources)
        {
-               if(AndroidResourceBundle *r = dynamic_cast<AndroidResourceBundle *>(*i))
+               if(AndroidResourceBundle *r = dynamic_cast<AndroidResourceBundle *>(s))
                        resource_bundle = r;
-               else if(FileTarget *f = dynamic_cast<FileTarget *>(*i))
+               else if(FileTarget *f = dynamic_cast<FileTarget *>(s))
                        other_files.push_back(f);
        }
        AndroidPackageFile *apk = new AndroidPackageFile(builder, *resource_bundle->get_component(), *resource_bundle, other_files);
@@ -51,13 +51,12 @@ Task *ApkBuilder::run(const Target &tgt) const
        argv.push_back(executable->get_path().str());
        argv.push_back("u");
 
-       const Target::Dependencies &depends = apk.get_dependencies();
        FS::Path input_path;
        list<FS::Path> files;
-       for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i)
+       for(Target *d: apk.get_dependencies())
        {
-               FileTarget *file = dynamic_cast<FileTarget *>(*i);
-               Target *real = (*i)->get_real_target();
+               FileTarget *file = dynamic_cast<FileTarget *>(d);
+               Target *real = d->get_real_target();
 
                if(dynamic_cast<AndroidResourceBundle *>(real))
                        input_path = file->get_path();
@@ -67,8 +66,8 @@ Task *ApkBuilder::run(const Target &tgt) const
 
        FS::Path work_dir = FS::dirname(input_path);
 
-       for(list<FS::Path>::const_iterator i=files.begin(); i!=files.end(); ++i)
-               argv.push_back(FS::relative(*i, work_dir).str());
+       for(const FS::Path &f: files)
+               argv.push_back(FS::relative(f, work_dir).str());
 
        ExternalTask *task = new ExternalTask(argv, work_dir);
        task->set_stdin(FS::basename(input_path));