From 451ef4f33b5a57dcb56bd7cb671bed359ac86247 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 22 Dec 2022 14:56:28 +0200 Subject: [PATCH] Inline simple constructors --- source/analyzer.cpp | 4 ---- source/analyzer.h | 2 +- source/androidapplicationcomponent.cpp | 4 ---- source/androidapplicationcomponent.h | 2 +- source/androidmanifestgenerator.cpp | 8 -------- source/androidmanifestgenerator.h | 4 ++-- source/binary.cpp | 4 ---- source/binary.h | 2 +- source/binarycomponent.cpp | 5 ----- source/binarycomponent.h | 2 +- source/buildtype.cpp | 5 ----- source/buildtype.h | 2 +- source/chainedtask.cpp | 5 ----- source/chainedtask.h | 2 +- source/compilecommandsgenerator.cpp | 8 -------- source/compilecommandsgenerator.h | 4 ++-- source/component.cpp | 5 ----- source/component.h | 2 +- source/config.cpp | 4 ---- source/config.h | 2 +- source/copy.cpp | 8 -------- source/copy.h | 4 ++-- source/csourcefile.cpp | 4 ---- source/csourcefile.h | 2 +- source/datasourcefile.cpp | 11 ----------- source/datasourcefile.h | 4 ++-- source/executable.cpp | 4 ---- source/executable.h | 2 +- source/feature.cpp | 5 ----- source/feature.h | 2 +- source/filetarget.cpp | 8 -------- source/filetarget.h | 4 ++-- source/importlibrary.cpp | 4 ---- source/importlibrary.h | 2 +- source/installcomponent.cpp | 4 ---- source/installcomponent.h | 2 +- source/internaltask.cpp | 4 ---- source/internaltask.h | 2 +- source/objcsourcefile.cpp | 8 -------- source/objcsourcefile.h | 3 +-- source/packagemanager.cpp | 4 ---- source/packagemanager.h | 2 +- source/pkgconfiggenerator.cpp | 9 --------- source/pkgconfiggenerator.h | 4 ++-- source/sourcefile.cpp | 4 ---- source/sourcefile.h | 2 +- source/staticlibrary.cpp | 4 ---- source/staticlibrary.h | 2 +- source/templatefile.cpp | 7 ------- source/templatefile.h | 2 +- source/tool.cpp | 19 ------------------- source/tool.h | 8 ++++---- source/vcxprojectgenerator.cpp | 8 -------- source/vcxprojectgenerator.h | 4 ++-- source/virtualfilesystem.cpp | 5 ----- source/virtualfilesystem.h | 2 +- source/virtualtarget.cpp | 4 ---- source/virtualtarget.h | 2 +- source/vssolutiongenerator.cpp | 8 -------- source/vssolutiongenerator.h | 4 ++-- 60 files changed, 41 insertions(+), 226 deletions(-) delete mode 100644 source/datasourcefile.cpp delete mode 100644 source/templatefile.cpp diff --git a/source/analyzer.cpp b/source/analyzer.cpp index b3b1f21..f91c298 100644 --- a/source/analyzer.cpp +++ b/source/analyzer.cpp @@ -13,10 +13,6 @@ using namespace std; using namespace Msp; -Analyzer::Analyzer(Builder &b): - builder(b) -{ } - void Analyzer::analyze() { if(mode==RDEPS) diff --git a/source/analyzer.h b/source/analyzer.h index 5827480..d30de04 100644 --- a/source/analyzer.h +++ b/source/analyzer.h @@ -34,7 +34,7 @@ private: std::map > rdepends; public: - Analyzer(Builder &); + Analyzer(Builder &b): builder(b) { } void set_mode(Mode m) { mode = m; } void set_max_depth(unsigned m) { max_depth = m; } diff --git a/source/androidapplicationcomponent.cpp b/source/androidapplicationcomponent.cpp index 1aab735..e4feaa2 100644 --- a/source/androidapplicationcomponent.cpp +++ b/source/androidapplicationcomponent.cpp @@ -14,10 +14,6 @@ using namespace std; using namespace Msp; -AndroidApplicationComponent::AndroidApplicationComponent(SourcePackage &p, const string &n): - Component(p, n) -{ } - void AndroidApplicationComponent::create_targets() const { Builder &builder = package.get_builder(); diff --git a/source/androidapplicationcomponent.h b/source/androidapplicationcomponent.h index c791a74..9e19b6d 100644 --- a/source/androidapplicationcomponent.h +++ b/source/androidapplicationcomponent.h @@ -20,7 +20,7 @@ private: std::vector permissions; public: - AndroidApplicationComponent(SourcePackage &, const std::string &); + AndroidApplicationComponent(SourcePackage &p, const std::string &n): Component(p, n) { } void create_targets() const override; }; diff --git a/source/androidmanifestgenerator.cpp b/source/androidmanifestgenerator.cpp index b9d67df..8268bb8 100644 --- a/source/androidmanifestgenerator.cpp +++ b/source/androidmanifestgenerator.cpp @@ -9,10 +9,6 @@ using namespace std; using namespace Msp; -AndroidManifestGenerator::AndroidManifestGenerator(Builder &b): - Tool(b, "AMG") -{ } - Target *AndroidManifestGenerator::create_target(const vector &, const string &) { throw logic_error("not implemented"); @@ -26,10 +22,6 @@ Task *AndroidManifestGenerator::run(const Target &target) const } -AndroidManifestGenerator::Worker::Worker(const AndroidManifestFile &m): - manifest(m) -{ } - void AndroidManifestGenerator::Worker::main() { const Component &comp = *manifest.get_component(); diff --git a/source/androidmanifestgenerator.h b/source/androidmanifestgenerator.h index 7c6e44c..630eb7c 100644 --- a/source/androidmanifestgenerator.h +++ b/source/androidmanifestgenerator.h @@ -15,14 +15,14 @@ private: const AndroidManifestFile &manifest; public: - Worker(const AndroidManifestFile &); + Worker(const AndroidManifestFile &m): manifest(m) { } private: void main() override; }; public: - AndroidManifestGenerator(Builder &); + AndroidManifestGenerator(Builder &b): Tool(b, "AMG") { } Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; diff --git a/source/binary.cpp b/source/binary.cpp index ffffaa5..f245037 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -14,10 +14,6 @@ using namespace std; using namespace Msp; -Binary::Binary(Builder &b, const FS::Path &p): - FileTarget(b, p) -{ } - Binary::Binary(Builder &b, const Component &c, const string &p, const vector &objs): FileTarget(b, c.get_package(), c.get_package().get_output_directory()/p), objects(objs) diff --git a/source/binary.h b/source/binary.h index 16ed1ec..ac5a855 100644 --- a/source/binary.h +++ b/source/binary.h @@ -19,7 +19,7 @@ private: protected: std::vector objects; - Binary(Builder &, const Msp::FS::Path &); + Binary(Builder &b, const Msp::FS::Path &p): FileTarget(b, p) { } Binary(Builder &, const Component &, const std::string &, const std::vector &); public: diff --git a/source/binarycomponent.cpp b/source/binarycomponent.cpp index 608ed3f..3209ccc 100644 --- a/source/binarycomponent.cpp +++ b/source/binarycomponent.cpp @@ -8,11 +8,6 @@ using namespace std; using namespace Msp; -BinaryComponent::BinaryComponent(SourcePackage &p, const string &n, Type t): - Component(p, n), - type(t) -{ } - void BinaryComponent::create_build_info() { Component::create_build_info(); diff --git a/source/binarycomponent.h b/source/binarycomponent.h index eca9508..ef145da 100644 --- a/source/binarycomponent.h +++ b/source/binarycomponent.h @@ -26,7 +26,7 @@ private: std::vector uses; public: - BinaryComponent(SourcePackage &, const std::string &, Type); + BinaryComponent(SourcePackage &p, const std::string &n, Type t): Component(p, n), type(t) { } Type get_type() const { return type; } diff --git a/source/buildtype.cpp b/source/buildtype.cpp index fbfe6a0..2485ca5 100644 --- a/source/buildtype.cpp +++ b/source/buildtype.cpp @@ -3,11 +3,6 @@ using namespace std; using namespace Msp; -BuildType::BuildType(const string &n): - name(n) -{ } - - BuildType::Loader::Loader(BuildType &b): DataFile::ObjectLoader(b) { diff --git a/source/buildtype.h b/source/buildtype.h index 8fcd6a2..c16e8f9 100644 --- a/source/buildtype.h +++ b/source/buildtype.h @@ -22,7 +22,7 @@ private: BuildInfo build_info; public: - BuildType(const std::string &); + BuildType(const std::string &n): name(n) { } const std::string &get_name() const { return name; } const BuildInfo &get_build_info() const { return build_info; } diff --git a/source/chainedtask.cpp b/source/chainedtask.cpp index 4e0decb..a232ef8 100644 --- a/source/chainedtask.cpp +++ b/source/chainedtask.cpp @@ -4,11 +4,6 @@ using namespace std; using namespace Msp; -ChainedTask::ChainedTask(Task *t) -{ - add_task(t); -} - ChainedTask::~ChainedTask() { for(Task *t: tasks) diff --git a/source/chainedtask.h b/source/chainedtask.h index 2986e8e..30a3b3e 100644 --- a/source/chainedtask.h +++ b/source/chainedtask.h @@ -16,7 +16,7 @@ private: Status final_status = RUNNING; public: - ChainedTask(Task *); + ChainedTask(Task *t) { add_task(t); } ~ChainedTask(); void add_task(Task *); diff --git a/source/compilecommandsgenerator.cpp b/source/compilecommandsgenerator.cpp index 82221e7..8e3947d 100644 --- a/source/compilecommandsgenerator.cpp +++ b/source/compilecommandsgenerator.cpp @@ -10,10 +10,6 @@ using namespace std; using namespace Msp; -CompileCommandsGenerator::CompileCommandsGenerator(Builder &b): - Tool(b, "CCJG") -{ } - Target *CompileCommandsGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); @@ -27,10 +23,6 @@ Task *CompileCommandsGenerator::run(const Target &target) const } -CompileCommandsGenerator::Worker::Worker(const CompileCommandsJson &t): - target(t) -{ } - void CompileCommandsGenerator::Worker::main() { Builder &builder = target.get_package()->get_builder(); diff --git a/source/compilecommandsgenerator.h b/source/compilecommandsgenerator.h index 519cad0..a655d94 100644 --- a/source/compilecommandsgenerator.h +++ b/source/compilecommandsgenerator.h @@ -15,14 +15,14 @@ private: const CompileCommandsJson ⌖ public: - Worker(const CompileCommandsJson &); + Worker(const CompileCommandsJson &t): target(t) { } private: void main() override; }; public: - CompileCommandsGenerator(Builder &); + CompileCommandsGenerator(Builder &b): Tool(b, "CCJG") { } Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; diff --git a/source/component.cpp b/source/component.cpp index 0186f3e..4fddcef 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -11,11 +11,6 @@ using namespace std; using namespace Msp; -Component::Component(SourcePackage &p, const string &n): - package(p), - name(n) -{ } - void Component::prepare() { for(Package *r: requires) diff --git a/source/component.h b/source/component.h index 5479cc5..7ddd972 100644 --- a/source/component.h +++ b/source/component.h @@ -44,7 +44,7 @@ protected: InstallMap install_map; std::vector problems; - Component(SourcePackage &, const std::string &); + Component(SourcePackage &p, const std::string &n): package(p), name(n) { } public: virtual ~Component() { } diff --git a/source/config.cpp b/source/config.cpp index 48864a9..1d3b180 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -12,10 +12,6 @@ using namespace std; using namespace Msp; -Config::Config(SourcePackage &p): - package(p) -{ } - const Config::Option &Config::add_option(const Feature &f) { Option opt(f); diff --git a/source/config.h b/source/config.h index 37508b0..ba8416b 100644 --- a/source/config.h +++ b/source/config.h @@ -43,7 +43,7 @@ private: mutable bool changed = false; public: - Config(SourcePackage &); + Config(SourcePackage &p): package(p) { } /** Adds a configuration option based on a feature. */ const Option &add_option(const Feature &); diff --git a/source/copy.cpp b/source/copy.cpp index f7dab41..45c5a81 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -14,10 +14,6 @@ using namespace std; using namespace Msp; -Copy::Copy(Builder &b): - Tool(b, "CP") -{ } - Target *Copy::create_target(const vector &sources, const string &arg) { FileTarget &file_tgt = dynamic_cast(*sources.front()); @@ -37,10 +33,6 @@ Task *Copy::run(const Target &target) const } -Copy::Worker::Worker(const InstalledFile &t): - target(t) -{ } - void Copy::Worker::main() { const FileTarget &source = target.get_source(); diff --git a/source/copy.h b/source/copy.h index 5f20c16..a5044d8 100644 --- a/source/copy.h +++ b/source/copy.h @@ -23,13 +23,13 @@ private: const InstalledFile ⌖ public: - Worker(const InstalledFile &); + Worker(const InstalledFile &t): target(t) { } private: void main() override; }; public: - Copy(Builder &); + Copy(Builder &b): Tool(b, "CP") { } Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; diff --git a/source/csourcefile.cpp b/source/csourcefile.cpp index 6429d4f..bc76605 100644 --- a/source/csourcefile.cpp +++ b/source/csourcefile.cpp @@ -11,10 +11,6 @@ using namespace std; using namespace Msp; -CSourceFile::CSourceFile(Builder &b, const FS::Path &p): - SourceFile(b, p) -{ } - CSourceFile::CSourceFile(Builder &b, const Component &c, const FS::Path &p): SourceFile(b, c, p) { diff --git a/source/csourcefile.h b/source/csourcefile.h index da966eb..c57654a 100644 --- a/source/csourcefile.h +++ b/source/csourcefile.h @@ -13,7 +13,7 @@ protected: std::vector includes; public: - CSourceFile(Builder &, const Msp::FS::Path &); + CSourceFile(Builder &b, const Msp::FS::Path &p): SourceFile(b, p) { } CSourceFile(Builder &, const Component &, const Msp::FS::Path &); const char *get_type() const override { return "CSourceFile"; } diff --git a/source/datasourcefile.cpp b/source/datasourcefile.cpp deleted file mode 100644 index b2a6d21..0000000 --- a/source/datasourcefile.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "datasourcefile.h" - -using namespace Msp; - -DataSourceFile::DataSourceFile(Builder &b, const FS::Path &p): - SourceFile(b, p) -{ } - -DataSourceFile::DataSourceFile(Builder &b, const Component &c, const FS::Path &p): - SourceFile(b, c, p) -{ } diff --git a/source/datasourcefile.h b/source/datasourcefile.h index 64093b5..7518423 100644 --- a/source/datasourcefile.h +++ b/source/datasourcefile.h @@ -6,8 +6,8 @@ class DataSourceFile: public SourceFile { public: - DataSourceFile(Builder &, const Msp::FS::Path &); - DataSourceFile(Builder &, const Component &, const Msp::FS::Path &); + DataSourceFile(Builder &b, const Msp::FS::Path &p): SourceFile(b, p) { } + DataSourceFile(Builder &b, const Component &c, const Msp::FS::Path &p): SourceFile(b, c, p) { } const char *get_type() const override { return "DataSourceFile"; } }; diff --git a/source/executable.cpp b/source/executable.cpp index 488b6df..aa0d8fb 100644 --- a/source/executable.cpp +++ b/source/executable.cpp @@ -6,10 +6,6 @@ using namespace std; using namespace Msp; -Executable::Executable(Builder &b, const FS::Path &p): - Binary(b, p) -{ } - Executable::Executable(Builder &b, const Component &c, const vector &objs): Binary(b, c, b.get_current_arch().create_filename(c.get_name()), objs) { diff --git a/source/executable.h b/source/executable.h index a75e26e..5728e2f 100644 --- a/source/executable.h +++ b/source/executable.h @@ -6,7 +6,7 @@ class Executable: public Binary { public: - Executable(Builder &, const Msp::FS::Path &); + Executable(Builder &b, const Msp::FS::Path &p): Binary(b, p) { } Executable(Builder &, const Component &, const std::vector &); const char *get_type() const override { return "Executable"; } diff --git a/source/feature.cpp b/source/feature.cpp index 891ba72..2518377 100644 --- a/source/feature.cpp +++ b/source/feature.cpp @@ -3,11 +3,6 @@ using namespace std; using namespace Msp; -Feature::Feature(const string &n): - name(n) -{ } - - Feature::Loader::Loader(Feature &f): Msp::DataFile::ObjectLoader(f) { diff --git a/source/feature.h b/source/feature.h index f8ec334..0dca1f5 100644 --- a/source/feature.h +++ b/source/feature.h @@ -20,7 +20,7 @@ struct Feature std::vector choices; bool exported = false; - Feature(const std::string &); + Feature(const std::string &n): name(n) { } }; #endif diff --git a/source/filetarget.cpp b/source/filetarget.cpp index 07be2c9..a2bd3f0 100644 --- a/source/filetarget.cpp +++ b/source/filetarget.cpp @@ -13,14 +13,6 @@ using namespace std; using namespace Msp; -FileTarget::FileTarget(Builder &b, const FS::Path &a): - FileTarget(b, 0, a) -{ } - -FileTarget::FileTarget(Builder &b, const SourcePackage &p, const FS::Path &a): - FileTarget(b, &p, a) -{ } - FileTarget::FileTarget(Builder &b, const SourcePackage *p, const FS::Path &a): Target(b, generate_name(b, p, a)), path(a) diff --git a/source/filetarget.h b/source/filetarget.h index aff1fb7..da165d0 100644 --- a/source/filetarget.h +++ b/source/filetarget.h @@ -19,8 +19,8 @@ protected: bool nested_build_sig = false; bool arch_in_build_sig = false; - FileTarget(Builder &, const Msp::FS::Path &); - FileTarget(Builder &, const SourcePackage &, const Msp::FS::Path &); + FileTarget(Builder &b, const Msp::FS::Path &a): FileTarget(b, 0, a) { } + FileTarget(Builder &b, const SourcePackage &p, const Msp::FS::Path &a): FileTarget(b, &p, a) { } private: FileTarget(Builder &, const SourcePackage *, const Msp::FS::Path &); void stat(); diff --git a/source/importlibrary.cpp b/source/importlibrary.cpp index 9d2ea8f..435fb30 100644 --- a/source/importlibrary.cpp +++ b/source/importlibrary.cpp @@ -10,10 +10,6 @@ using namespace std; using namespace Msp; -ImportLibrary::ImportLibrary(Builder &b, const FS::Path &p): - FileTarget(b, p) -{ } - ImportLibrary::ImportLibrary(Builder &b, const Component &c, SharedLibrary &sl, ExportDefinitions &exp): FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c, sl)), shared_lib(&sl) diff --git a/source/importlibrary.h b/source/importlibrary.h index e985be7..1c5d682 100644 --- a/source/importlibrary.h +++ b/source/importlibrary.h @@ -16,7 +16,7 @@ private: SharedLibrary *shared_lib = 0; public: - ImportLibrary(Builder &, const Msp::FS::Path &); + ImportLibrary(Builder &b, const Msp::FS::Path &p): FileTarget(b, p) { } ImportLibrary(Builder &, const Component &, SharedLibrary &, ExportDefinitions &); private: static std::string generate_filename(const Component &, const SharedLibrary &); diff --git a/source/installcomponent.cpp b/source/installcomponent.cpp index 319053f..86919fa 100644 --- a/source/installcomponent.cpp +++ b/source/installcomponent.cpp @@ -7,10 +7,6 @@ using namespace std; using namespace Msp; -InstallComponent::InstallComponent(SourcePackage &p, const string &n): - Component(p, n) -{ } - void InstallComponent::create_targets() const { Builder &builder = package.get_builder(); diff --git a/source/installcomponent.h b/source/installcomponent.h index 412bd0b..457256d 100644 --- a/source/installcomponent.h +++ b/source/installcomponent.h @@ -6,7 +6,7 @@ class InstallComponent: public Component { public: - InstallComponent(SourcePackage &, const std::string &); + InstallComponent(SourcePackage &p, const std::string &n): Component(p, n) { } void create_targets() const override; }; diff --git a/source/internaltask.cpp b/source/internaltask.cpp index 0f3cbc2..5810be1 100644 --- a/source/internaltask.cpp +++ b/source/internaltask.cpp @@ -1,9 +1,5 @@ #include "internaltask.h" -InternalTask::InternalTask(Worker *w): - worker(w) -{ } - InternalTask::~InternalTask() { worker->join(); diff --git a/source/internaltask.h b/source/internaltask.h index 98b76a0..5954519 100644 --- a/source/internaltask.h +++ b/source/internaltask.h @@ -29,7 +29,7 @@ private: Worker *worker; public: - InternalTask(Worker *); + InternalTask(Worker *w): worker(w) { } ~InternalTask(); std::string get_command() const override { return ""; } diff --git a/source/objcsourcefile.cpp b/source/objcsourcefile.cpp index ed334fc..953819f 100644 --- a/source/objcsourcefile.cpp +++ b/source/objcsourcefile.cpp @@ -4,14 +4,6 @@ using namespace std; using namespace Msp; -ObjCSourceFile::ObjCSourceFile(Builder &b, const FS::Path &p): - CSourceFile(b, p) -{ } - -ObjCSourceFile::ObjCSourceFile(Builder &b, const Component &c, const FS::Path &p): - CSourceFile(b, c, p) -{ } - void ObjCSourceFile::parse_includes(IO::Base &in) { static Regex r_include("^[ \t]*#(include|import)[ \t]+([\"<].*)[\">]"); diff --git a/source/objcsourcefile.h b/source/objcsourcefile.h index fda3d29..37f79a3 100644 --- a/source/objcsourcefile.h +++ b/source/objcsourcefile.h @@ -9,8 +9,7 @@ Represents an Objective-C source file. class ObjCSourceFile: public CSourceFile { public: - ObjCSourceFile(Builder &, const Msp::FS::Path &); - ObjCSourceFile(Builder &, const Component &, const Msp::FS::Path &); + using CSourceFile::CSourceFile; const char *get_type() const override { return "ObjCSourceFile"; } diff --git a/source/packagemanager.cpp b/source/packagemanager.cpp index 9e53bb4..37374b6 100644 --- a/source/packagemanager.cpp +++ b/source/packagemanager.cpp @@ -16,10 +16,6 @@ using namespace std; using namespace Msp; -PackageManager::PackageManager(Builder &b): - builder(b) -{ } - PackageManager::~PackageManager() { for(const auto &kvp: packages) diff --git a/source/packagemanager.h b/source/packagemanager.h index 22f1eac..fc0aa98 100644 --- a/source/packagemanager.h +++ b/source/packagemanager.h @@ -29,7 +29,7 @@ private: bool env_set = false; public: - PackageManager(Builder &); + PackageManager(Builder &b): builder(b) { } ~PackageManager(); /// Adds a location to look for source packages from. diff --git a/source/pkgconfiggenerator.cpp b/source/pkgconfiggenerator.cpp index f042ec5..02f1423 100644 --- a/source/pkgconfiggenerator.cpp +++ b/source/pkgconfiggenerator.cpp @@ -8,11 +8,6 @@ using namespace std; using namespace Msp; -PkgConfigGenerator::PkgConfigGenerator(Builder &b): - Tool(b, "PCG") -{ -} - Target *PkgConfigGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); @@ -26,10 +21,6 @@ Task *PkgConfigGenerator::run(const Target &target) const } -PkgConfigGenerator::Worker::Worker(const PkgConfigFile &t): - target(t) -{ } - void PkgConfigGenerator::Worker::main() { Builder &builder = target.get_package()->get_builder(); diff --git a/source/pkgconfiggenerator.h b/source/pkgconfiggenerator.h index 3b28e3f..727b3e2 100644 --- a/source/pkgconfiggenerator.h +++ b/source/pkgconfiggenerator.h @@ -15,7 +15,7 @@ private: const PkgConfigFile ⌖ public: - Worker(const PkgConfigFile &); + Worker(const PkgConfigFile &t): target(t) { } private: void main() override; @@ -24,7 +24,7 @@ private: }; public: - PkgConfigGenerator(Builder &); + PkgConfigGenerator(Builder &b): Tool(b, "PCG") { } Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; diff --git a/source/sourcefile.cpp b/source/sourcefile.cpp index 1dcfd2e..b5b84c7 100644 --- a/source/sourcefile.cpp +++ b/source/sourcefile.cpp @@ -2,10 +2,6 @@ #include "sourcefile.h" #include "sourcepackage.h" -SourceFile::SourceFile(Builder &b, const Msp::FS::Path &p): - FileTarget(b, p) -{ } - SourceFile::SourceFile(Builder &b, const Component &c, const Msp::FS::Path &p): FileTarget(b, c.get_package(), p) { diff --git a/source/sourcefile.h b/source/sourcefile.h index bdb657f..16521a5 100644 --- a/source/sourcefile.h +++ b/source/sourcefile.h @@ -6,7 +6,7 @@ class SourceFile: public FileTarget { protected: - SourceFile(Builder &, const Msp::FS::Path &); + SourceFile(Builder &b, const Msp::FS::Path &p): FileTarget(b, p) { } SourceFile(Builder &, const Component &, const Msp::FS::Path &); }; diff --git a/source/staticlibrary.cpp b/source/staticlibrary.cpp index c515966..039eb8e 100644 --- a/source/staticlibrary.cpp +++ b/source/staticlibrary.cpp @@ -7,10 +7,6 @@ using namespace std; using namespace Msp; -StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p): - FileTarget(b, p) -{ } - StaticLibrary::StaticLibrary(Builder &b, const Component &c, const vector &objs): FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c)) { diff --git a/source/staticlibrary.h b/source/staticlibrary.h index 6b52871..98d2990 100644 --- a/source/staticlibrary.h +++ b/source/staticlibrary.h @@ -18,7 +18,7 @@ private: BuildInfo build_info; public: - StaticLibrary(Builder &, const Msp::FS::Path &); + StaticLibrary(Builder &b, const Msp::FS::Path &p): FileTarget(b, p) { } StaticLibrary(Builder &, const Component &, const std::vector &); private: static std::string generate_filename(const Component &); diff --git a/source/templatefile.cpp b/source/templatefile.cpp deleted file mode 100644 index f5bfcb5..0000000 --- a/source/templatefile.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "templatefile.h" - -using namespace Msp; - -TemplateFile::TemplateFile(Builder &b, const Component &c, const FS::Path &p): - SourceFile(b, c, p) -{ } diff --git a/source/templatefile.h b/source/templatefile.h index cb2841e..0912025 100644 --- a/source/templatefile.h +++ b/source/templatefile.h @@ -9,7 +9,7 @@ Input file for SourceGenerator. class TemplateFile: public SourceFile { public: - TemplateFile(Builder &, const Component &, const Msp::FS::Path &); + TemplateFile(Builder &b, const Component &c, const Msp::FS::Path &p): SourceFile(b, c, p) { } const char *get_type() const override { return "TemplateFile"; } }; diff --git a/source/tool.cpp b/source/tool.cpp index 5d0903a..852fa2d 100644 --- a/source/tool.cpp +++ b/source/tool.cpp @@ -9,20 +9,6 @@ using namespace std; using namespace Msp; -Tool::Tool(Builder &b, const string &t): - Tool(b, 0, t) -{ } - -Tool::Tool(Builder &b, const Architecture &a, const string &t): - Tool(b, &a, t) -{ } - -Tool::Tool(Builder &b, const Architecture *a, const string &t): - builder(b), - architecture(a), - tag(t) -{ } - void Tool::set_command(const string &cmd, bool cross) { if(cmd.empty()) @@ -73,11 +59,6 @@ string Tool::create_build_signature(const BuildInfo &) const } -SubTool::SubTool(Tool &p): - Tool(p), - parent(p) -{ } - Target *SubTool::create_source(const Component &c, const FS::Path &p) const { return parent.create_source(c, p); diff --git a/source/tool.h b/source/tool.h index e1bef2d..6fa4fb5 100644 --- a/source/tool.h +++ b/source/tool.h @@ -43,10 +43,10 @@ protected: bool prepared = false; std::vector problems; - Tool(Builder &, const std::string &); - Tool(Builder &, const Architecture &, const std::string &); + Tool(Builder &b, const std::string &t): Tool(b, 0, t) { } + Tool(Builder &b, const Architecture &a, const std::string &t): Tool(b, &a, t) { } private: - Tool(Builder &, const Architecture *, const std::string &); + Tool(Builder &b, const Architecture *a, const std::string &t): builder(b), architecture(a), tag(t) { } public: virtual ~Tool() { } @@ -133,7 +133,7 @@ class SubTool: public Tool protected: Tool &parent; - SubTool(Tool &); + SubTool(Tool &t): Tool(t), parent(t) { } public: Target *create_source(const Component &, const Msp::FS::Path &) const override; diff --git a/source/vcxprojectgenerator.cpp b/source/vcxprojectgenerator.cpp index 93c0eb4..1528802 100644 --- a/source/vcxprojectgenerator.cpp +++ b/source/vcxprojectgenerator.cpp @@ -12,10 +12,6 @@ using namespace std; using namespace Msp; -VcxProjectGenerator::VcxProjectGenerator(Builder &b): - Tool(b, "VCXG") -{ } - Target *VcxProjectGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); @@ -29,10 +25,6 @@ Task *VcxProjectGenerator::run(const Target &target) const } -VcxProjectGenerator::Worker::Worker(const VcxProjectFile &t): - target(t) -{ } - void VcxProjectGenerator::Worker::main() { const SourcePackage &spkg = *target.get_package(); diff --git a/source/vcxprojectgenerator.h b/source/vcxprojectgenerator.h index a7feb1a..bf06f40 100644 --- a/source/vcxprojectgenerator.h +++ b/source/vcxprojectgenerator.h @@ -15,14 +15,14 @@ private: const VcxProjectFile ⌖ public: - Worker(const VcxProjectFile &); + Worker(const VcxProjectFile &t): target(t) { } private: void main() override; }; public: - VcxProjectGenerator(Builder &); + VcxProjectGenerator(Builder &b): Tool(b, "VCXG") { } Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index d3bc708..16d4de8 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -15,11 +15,6 @@ using namespace std; using namespace Msp; -VirtualFileSystem::VirtualFileSystem(Builder &b): - builder(b) -{ -} - FileTarget *VirtualFileSystem::get_target(const FS::Path &p) const { auto i = targets.find(p.str()); diff --git a/source/virtualfilesystem.h b/source/virtualfilesystem.h index 4aa20d4..60e198a 100644 --- a/source/virtualfilesystem.h +++ b/source/virtualfilesystem.h @@ -29,7 +29,7 @@ private: SearchPath sys_bin_path; public: - VirtualFileSystem(Builder &); + VirtualFileSystem(Builder &b): builder(b) { } /** Gets an existing target associated with a path. If no target has claimed that path, 0 is returned. */ diff --git a/source/virtualtarget.cpp b/source/virtualtarget.cpp index 44a3524..07177d8 100644 --- a/source/virtualtarget.cpp +++ b/source/virtualtarget.cpp @@ -7,10 +7,6 @@ using namespace std; using namespace Msp; -VirtualTarget::VirtualTarget(Builder &b, const string &n): - Target(b, n) -{ } - void VirtualTarget::check_rebuild() { // Virtual targets are only rebuilt if their dependencies need rebuilding. diff --git a/source/virtualtarget.h b/source/virtualtarget.h index 50d1274..5151826 100644 --- a/source/virtualtarget.h +++ b/source/virtualtarget.h @@ -9,7 +9,7 @@ A target that is not associated with any file. class VirtualTarget: public Target { public: - VirtualTarget(Builder &, const std::string &); + VirtualTarget(Builder &b, const std::string &n): Target(b, n) { } const char *get_type() const override { return "VirtualTarget"; } private: diff --git a/source/vssolutiongenerator.cpp b/source/vssolutiongenerator.cpp index a810cab..9f8a7ab 100644 --- a/source/vssolutiongenerator.cpp +++ b/source/vssolutiongenerator.cpp @@ -10,10 +10,6 @@ using namespace std; using namespace Msp; -VsSolutionGenerator::VsSolutionGenerator(Builder &b): - Tool(b, "VSSG") -{ } - Target *VsSolutionGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); @@ -27,10 +23,6 @@ Task *VsSolutionGenerator::run(const Target &target) const } -VsSolutionGenerator::Worker::Worker(const VsSolutionFile &t): - target(t) -{ } - void VsSolutionGenerator::Worker::main() { const SourcePackage &spkg = *target.get_package(); diff --git a/source/vssolutiongenerator.h b/source/vssolutiongenerator.h index 14eae5f..68d581f 100644 --- a/source/vssolutiongenerator.h +++ b/source/vssolutiongenerator.h @@ -15,14 +15,14 @@ private: const VsSolutionFile ⌖ public: - Worker(const VsSolutionFile &); + Worker(const VsSolutionFile &t): target(t) { } private: void main() override; }; public: - VsSolutionGenerator(Builder &); + VsSolutionGenerator(Builder &b): Tool(b, "VSSG") { } Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; -- 2.43.0