From 296efcd4d03934b7c82a070e4cb73fd777975dce Mon Sep 17 00:00:00 2001 From: am0ebe <am0ebe@gmx.de> Date: Fri, 25 Feb 2022 03:34:00 +0100 Subject: [PATCH] . --- examples/Demo.cpp | 5 ++--- src/algorithms/tools.cpp | 38 +++++++++++++++++++------------------- src/algorithms/tools.h | 4 ++-- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/examples/Demo.cpp b/examples/Demo.cpp index 42bcfa7..2fe5a7b 100644 --- a/examples/Demo.cpp +++ b/examples/Demo.cpp @@ -171,13 +171,12 @@ void parse(int argc, char** argv) cout << "amountFiles: " << amountFiles << endl; cout << boolalpha << "testMode: " << testMode << endl; - vector<String> x ={ + if( !Tools::check({ "camParamFile", camParamFile, "centerFile", centerFile, "inputFile", inputFile, "outputDir", outputDir - }; - if( !Tools::check(x)) + })) exit(error::config_filedir); Tools::maybeAppendSepToDir(outputDir); diff --git a/src/algorithms/tools.cpp b/src/algorithms/tools.cpp index aed3233..f758e21 100644 --- a/src/algorithms/tools.cpp +++ b/src/algorithms/tools.cpp @@ -12,33 +12,33 @@ void Tools::print_ruler() std::cout << "######################################" << std::endl; } -bool Tools::maybeAppendSepToDir(String& d) +void Tools::maybeAppendSepToDir(cv::String& d) { - const char SEP = std::filesystem::path::preferred_separator; - if( d.back() != SEP ) - d += SEP; + const char SEP = std::filesystem::path::preferred_separator; + if( d.back() != SEP ) + d += SEP; } -auto Tools::check(vector<String>& x) +bool Tools::check(const std::vector<cv::String>& x) { - bool checkAll = true; - String name, path; + bool checkAll = true; + cv::String name, path; - for (int i{0}; i<x.size()-1; i++) - { - name = x[i]; - path = x[++i]; + for (uint i{0}; i<x.size()-1; i++) + { + name = x[i]; + path = x[++i]; - bool check = std::filesystem::exists(path); - if (!check) - std::cerr << name << ": " << path << " [not found!] " << std::endl; - else - std::cout << name << ": " << path << std::endl; + bool check = std::filesystem::exists(path); + if (!check) + std::cerr << name << ": " << path << " [not found!] " << std::endl; + else + std::cout << name << ": " << path << std::endl; - checkAll &= check; - } + checkAll &= check; + } - return checkAll; + return checkAll; } std::string Tools::mNzero(int i) diff --git a/src/algorithms/tools.h b/src/algorithms/tools.h index 2406fe5..9b2dd06 100644 --- a/src/algorithms/tools.h +++ b/src/algorithms/tools.h @@ -26,8 +26,8 @@ class Tools { public: - static void maybeAppendSepToDir(std::String& d) - static bool check(std::vector<std::String>& x) + static void maybeAppendSepToDir(cv::String&); + static bool check(const std::vector<cv::String>&); //! print ruler static void print_ruler(); -- GitLab