diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-01-11 12:51:31 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-01-12 23:00:43 (GMT) |
commit | 1491ab1c6626ed6a3b67e74b94fd18230e1bb4d4 (patch) | |
tree | a60e54ab966af5d00dfa6622c3b64fd87e7eed05 /Source | |
parent | 29112c9a695a8dce6486203d0415f17ac41d3a0b (diff) | |
download | CMake-1491ab1c6626ed6a3b67e74b94fd18230e1bb4d4.zip CMake-1491ab1c6626ed6a3b67e74b94fd18230e1bb4d4.tar.gz CMake-1491ab1c6626ed6a3b67e74b94fd18230e1bb4d4.tar.bz2 |
Autogen: Generators: Make class static method a source static function
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 71 | ||||
-rw-r--r-- | 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<std::string>& list, return (std::find(list.begin(), list.end(), entry) != list.end()); } +static void UicMergeOptions(std::vector<std::string>& opts, + const std::vector<std::string>& fileOpts, + bool isQt5) +{ + static const char* valueOptions[] = { "tr", "translate", + "postfix", "generator", + "include", // Since Qt 5.3 + "g" }; + std::vector<std::string> extraOpts; + for (std::vector<std::string>::const_iterator it = fileOpts.begin(); + it != fileOpts.end(); ++it) { + std::vector<std::string>::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<std::string>& opts, const std::vector<std::string>& fileOpts, - bool isQt5) -{ - static const char* valueOptions[] = { "tr", "translate", - "postfix", "generator", - "include", // Since Qt 5.3 - "g" }; - std::vector<std::string> extraOpts; - for (std::vector<std::string>::const_iterator it = fileOpts.begin(); - it != fileOpts.end(); ++it) { - std::vector<std::string>::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<std::string, std::vector<std::string> >& includedUis) { @@ -1235,8 +1235,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, if (optionIt != this->UicOptions.end()) { std::vector<std::string> 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<std::string>& opts, - const std::vector<std::string>& fileOpts, - bool isQt5); bool GenerateUiFiles( const std::map<std::string, std::vector<std::string> >& includedUis); bool GenerateUi(const std::string& realName, const std::string& uiInputFile, |