From 95064a6d35c93557c9bb87bc8eeff8555d7295a2 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 18 Apr 2016 11:39:06 +0200 Subject: [PATCH] Autogen: Rename header extension Join method to JoinExts While at it, simplify the signature and avoid a trailing separator. --- Source/cmQtAutoGenerators.cxx | 14 +++++++++----- Source/cmQtAutoGenerators.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ee40e7a7a..19f6a383d 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -762,7 +762,7 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, std::cerr << "AUTOGEN: error: " << absFilename << ": The file " << "includes the moc file \"" << currentMoc << "\", " << "but could not find header \"" << basename - << '{' << this->Join(headerExtensions, ',') << "}\" "; + << '{' << this->JoinExts(headerExtensions) << "}\" "; if (mocSubDir.empty()) { std::cerr << "in " << absPath << "\n" << std::endl; @@ -937,7 +937,7 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, std::cerr << "AUTOGEN: error: " << absFilename << " The file " << "includes the moc file \"" << currentMoc << "\", " << "but could not find header \"" << basename - << '{' << this->Join(headerExtensions, ',') << "}\" "; + << '{' << this->JoinExts(headerExtensions) << "}\" "; if (mocSubDir.empty()) { std::cerr << "in " << absPath << "\n" << std::endl; @@ -1347,8 +1347,7 @@ bool cmQtAutoGenerators::GenerateQrc() return true; } -std::string cmQtAutoGenerators::Join(const std::vector& lst, - char separator) +std::string cmQtAutoGenerators::JoinExts(const std::vector& lst) { if (lst.empty()) { @@ -1356,11 +1355,16 @@ std::string cmQtAutoGenerators::Join(const std::vector& lst, } std::string result; + std::string separator = ","; for (std::vector::const_iterator it = lst.begin(); it != lst.end(); ++it) { - result += "." + (*it) + separator; + if(it != lst.begin()) + { + result += separator; + } + result += '.' + (*it); } result.erase(result.end() - 1); return result; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index d5a23ab27..f9dd41c8e 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -69,7 +69,7 @@ private: void Init(); - std::string Join(const std::vector& lst, char separator); + std::string JoinExts(const std::vector& lst); static void MergeUicOptions(std::vector &opts, const std::vector &fileOpts, bool isQt5);