From 1491ab1c6626ed6a3b67e74b94fd18230e1bb4d4 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 11 Jan 2017 13:51:31 +0100 Subject: Autogen: Generators: Make class static method a source static function --- Source/cmQtAutoGenerators.cxx | 71 +++++++++++++++++++++---------------------- Source/cmQtAutoGenerators.h | 3 -- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 57b9450..ea55064 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -97,6 +97,40 @@ static bool ListContains(const std::vector& list, return (std::find(list.begin(), list.end(), entry) != list.end()); } +static void UicMergeOptions(std::vector& opts, + const std::vector& fileOpts, + bool isQt5) +{ + static const char* valueOptions[] = { "tr", "translate", + "postfix", "generator", + "include", // Since Qt 5.3 + "g" }; + std::vector extraOpts; + for (std::vector::const_iterator it = fileOpts.begin(); + it != fileOpts.end(); ++it) { + std::vector::iterator existingIt = + std::find(opts.begin(), opts.end(), *it); + if (existingIt != opts.end()) { + const char* o = it->c_str(); + if (*o == '-') { + ++o; + } + if (isQt5 && *o == '-') { + ++o; + } + if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { + assert(existingIt + 1 != opts.end()); + *(existingIt + 1) = *(it + 1); + ++it; + } + } else { + extraOpts.push_back(*it); + } + } + opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); +} + // -- Class methods cmQtAutoGenerators::cmQtAutoGenerators() @@ -1109,40 +1143,6 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, return false; } -void cmQtAutoGenerators::MergeUicOptions( - std::vector& opts, const std::vector& fileOpts, - bool isQt5) -{ - static const char* valueOptions[] = { "tr", "translate", - "postfix", "generator", - "include", // Since Qt 5.3 - "g" }; - std::vector extraOpts; - for (std::vector::const_iterator it = fileOpts.begin(); - it != fileOpts.end(); ++it) { - std::vector::iterator existingIt = - std::find(opts.begin(), opts.end(), *it); - if (existingIt != opts.end()) { - const char* o = it->c_str(); - if (*o == '-') { - ++o; - } - if (isQt5 && *o == '-') { - ++o; - } - if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { - assert(existingIt + 1 != opts.end()); - *(existingIt + 1) = *(it + 1); - ++it; - } - } else { - extraOpts.push_back(*it); - } - } - opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); -} - bool cmQtAutoGenerators::GenerateUiFiles( const std::map >& includedUis) { @@ -1235,8 +1235,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, if (optionIt != this->UicOptions.end()) { std::vector fileOpts; cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); - cmQtAutoGenerators::MergeUicOptions(opts, fileOpts, - this->QtMajorVersion == "5"); + UicMergeOptions(opts, fileOpts, this->QtMajorVersion == "5"); } command.insert(command.end(), opts.begin(), opts.end()); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 18648e6..ed17dcd 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -80,9 +80,6 @@ private: const std::string& subDirPrefix); // - Uic file generation - static void MergeUicOptions(std::vector& opts, - const std::vector& fileOpts, - bool isQt5); bool GenerateUiFiles( const std::map >& includedUis); bool GenerateUi(const std::string& realName, const std::string& uiInputFile, -- cgit v0.12