]> git.tdb.fi Git - builder.git/blobdiff - source/sourcepackage.cpp
Refactor the constructor of SourcePackage::Loader
[builder.git] / source / sourcepackage.cpp
index 8c535e72192d8dd8dae16b5989f70b3faa4367f6..74c38864bce10cb4f63bdd5888604b0f69841365 100644 (file)
@@ -167,23 +167,11 @@ void SourcePackage::save_caches()
 }
 
 
-SourcePackage::Loader::Loader(SourcePackage &p):
+SourcePackage::Loader::Loader(SourcePackage &p, const Config::InputOptions *o):
        DataFile::DerivedObjectLoader<SourcePackage, Package::Loader>(p),
-       FeatureConditional(p, p.name)
+       FeatureConditional(p, p.name),
+       options(o)
 {
-       init(0);
-}
-
-SourcePackage::Loader::Loader(SourcePackage &p, const Config::InputOptions &o):
-       DataFile::DerivedObjectLoader<SourcePackage, Package::Loader>(p),
-       FeatureConditional(p, p.name)
-{
-       init(&o);
-}
-
-void SourcePackage::Loader::init(const Config::InputOptions *o)
-{
-       options = o;
        add("android_application", &Loader::component<AndroidApplicationComponent>);
        add("build_info",  &Loader::build_info);
        add("datapack",    &Loader::component<DataPackComponent>);
@@ -205,7 +193,7 @@ void SourcePackage::Loader::finish()
 {
        /* Make sure the source tarball is last in the list so targets from all
        other components wil be created first */
-       ComponentList::iterator i = find(obj.components, obj.source_archive);
+       auto i = find(obj.components, obj.source_archive);
        if(i!=obj.components.end())
                obj.components.splice(obj.components.end(), obj.components, i);
 }
@@ -220,7 +208,7 @@ void SourcePackage::Loader::feature(const string &n, const string &d)
        const Config::Option &opt = obj.config.add_option(feat);
        if(options)
        {
-               Config::InputOptions::const_iterator i = options->find(opt.name);
+               auto i = options->find(opt.name);
                if(i!=options->end())
                        obj.config.set_option(opt.name, i->second);
        }