From 6af7742c35ecdf2831908443ca0e04bf23317a96 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 11 Jan 2023 19:57:00 +0100 Subject: Rename Configuation struct to configuration and make get/has functions member functions. --- src/bootstrap.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/bootstrap.cc') diff --git a/src/bootstrap.cc b/src/bootstrap.cc index 09d6353..1fb3807 100644 --- a/src/bootstrap.cc +++ b/src/bootstrap.cc @@ -22,20 +22,18 @@ std::filesystem::path configurationFile("configuration.cc"); std::filesystem::path configHeaderFile("config.h"); -namespace ctor { -const Configuration default_configuration{}; -const Configuration& configuration() +const ctor::configuration default_configuration{}; +const ctor::configuration& ctor::get_configuration() { return default_configuration; } -bool hasConfiguration(const std::string& key) +bool ctor::configuration::has(const std::string& key) const { return false; } -const std::string& getConfiguration(const std::string& key, - const std::string& defaultValue) +const std::string& ctor::configuration::get(const std::string& key, const std::string& default_value) const { if(key == cfg::host_cxx && std::getenv("CXX")) { @@ -49,9 +47,8 @@ const std::string& getConfiguration(const std::string& key, return s; } - return defaultValue; + return default_value; } -} // namespace ctor:: int main(int argc, char* argv[]) { @@ -64,7 +61,8 @@ int main(int argc, char* argv[]) ctor::settings settings{}; - settings.builddir = ctor::getConfiguration(cfg::builddir, settings.builddir); + const auto& c = ctor::get_configuration(); + settings.builddir = c.get(cfg::builddir, settings.builddir); settings.parallel_processes = std::max(1u, std::thread::hardware_concurrency() * 2 - 1); settings.verbose = 0; -- cgit v1.2.3