diff options
author | Alex Neundorf <neundorf@kde.org> | 2010-08-29 15:51:44 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2010-08-29 15:51:44 (GMT) |
commit | 0367245f0c1a665d44b7169cc0f24eda5dbb4de3 (patch) | |
tree | 45f3c2e2a8bece0b1ece8fadd5f8ed33cf56bdac /Source/cmFindPackageCommand.cxx | |
parent | 130b0e21958535a4f4f408cf7392fa9b3ee336fe (diff) | |
download | CMake-0367245f0c1a665d44b7169cc0f24eda5dbb4de3.zip CMake-0367245f0c1a665d44b7169cc0f24eda5dbb4de3.tar.gz CMake-0367245f0c1a665d44b7169cc0f24eda5dbb4de3.tar.bz2 |
Replace the two vector<string,string> with one vector<struct{string,string}>
Before this patch there were two separate vectors, and the code made sure
they always had the same size.
With this patch the code doesn't have to ensure this anymore, there is only
one vector now.
Alex
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 90fcf69..48122a8 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -726,8 +726,7 @@ bool cmFindPackageCommand::FindModule(bool& found) //---------------------------------------------------------------------------- bool cmFindPackageCommand::HandlePackageMode() { - this->ConsideredConfigFiles.clear(); - this->ConsideredVersions.clear(); + this->ConsideredConfigs.clear(); // Support old capitalization behavior. std::string upperDir = cmSystemTools::UpperCase(this->Name); @@ -819,17 +818,17 @@ bool cmFindPackageCommand::HandlePackageMode() cmOStringStream e; // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. - if (this->ConsideredConfigFiles.size() > 0) + if (this->ConsideredConfigs.size() > 0) { e << "Could not find configuration file for package " << this->Name << " with " << (this->VersionExact ? "exact " : "at least ") << "version " << this->Version << " .\n" << "Found the following files:\n"; - for(std::vector<std::string>::size_type i=0; - i<this->ConsideredConfigFiles.size(); i++) + for(std::vector<ConfigFileInfo>::size_type i=0; + i<this->ConsideredConfigs.size(); i++) { - e << " " << this->ConsideredConfigFiles[i] - << ", version: " << this->ConsideredVersions[i] << "\n"; + e << " " << this->ConsideredConfigs[i].filename + << ", version: " << this->ConsideredConfigs[i].version << "\n"; } } else @@ -933,12 +932,12 @@ bool cmFindPackageCommand::HandlePackageMode() std::string consideredConfigFiles; std::string consideredVersions; - for(std::vector<std::string>::size_type i=0; - i<this->ConsideredConfigFiles.size(); i++) + for(std::vector<ConfigFileInfo>::size_type i=0; + i<this->ConsideredConfigs.size(); i++) { - consideredConfigFiles += this->ConsideredConfigFiles[i]; + consideredConfigFiles += this->ConsideredConfigs[i].filename; consideredConfigFiles += ";"; - consideredVersions += this->ConsideredVersions[i]; + consideredVersions += this->ConsideredConfigs[i].version; consideredVersions += ";"; } @@ -1554,8 +1553,10 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) haveResult = true; } - this->ConsideredConfigFiles.push_back(config_file); - this->ConsideredVersions.push_back(version); + ConfigFileInfo configFileInfo; + configFileInfo.filename = config_file; + configFileInfo.version = version; + this->ConsideredConfigs.push_back(configFileInfo); return result; } |