diff options
author | Brad King <brad.king@kitware.com> | 2014-04-01 18:54:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-01 18:54:28 (GMT) |
commit | f2a3dd9d1acb252dd40c35859f9a148c2d0ff823 (patch) | |
tree | 05e94318f5356f755c26cfc60da52da8abe9d45b /Source/cmIDEOptions.cxx | |
parent | 358be9b3207ad92a7ce4a5744db6a7265d8a0844 (diff) | |
download | CMake-f2a3dd9d1acb252dd40c35859f9a148c2d0ff823.zip CMake-f2a3dd9d1acb252dd40c35859f9a148c2d0ff823.tar.gz CMake-f2a3dd9d1acb252dd40c35859f9a148c2d0ff823.tar.bz2 |
cmIDEOptions: Factor FlagMap update out to separate method
This will allow it to be re-used in other code paths.
Diffstat (limited to 'Source/cmIDEOptions.cxx')
-rw-r--r-- | Source/cmIDEOptions.cxx | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index e03223f..eda1ef6 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -99,33 +99,7 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, (!(entry->special & cmIDEFlagTable::UserRequired) || static_cast<int>(strlen(flag+1)) > n)) { - if(entry->special & cmIDEFlagTable::UserIgnored) - { - // Ignore the user-specified value. - this->FlagMap[entry->IDEName] = entry->value; - } - else if(entry->special & cmIDEFlagTable::SemicolonAppendable) - { - const char *new_value = flag+1+n; - - std::map<std::string,std::string>::iterator itr; - itr = this->FlagMap.find(entry->IDEName); - if(itr != this->FlagMap.end()) - { - // Append to old value (if present) with semicolons; - itr->second += ";"; - itr->second += new_value; - } - else - { - this->FlagMap[entry->IDEName] = new_value; - } - } - else - { - // Use the user-specified value. - this->FlagMap[entry->IDEName] = flag+1+n; - } + this->FlagMapUpdate(entry, flag+n+1); entry_found = true; } } @@ -151,6 +125,37 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, } //---------------------------------------------------------------------------- +void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry, + const char* new_value) +{ + if(entry->special & cmIDEFlagTable::UserIgnored) + { + // Ignore the user-specified value. + this->FlagMap[entry->IDEName] = entry->value; + } + else if(entry->special & cmIDEFlagTable::SemicolonAppendable) + { + std::map<std::string,std::string>::iterator itr; + itr = this->FlagMap.find(entry->IDEName); + if(itr != this->FlagMap.end()) + { + // Append to old value (if present) with semicolons; + itr->second += ";"; + itr->second += new_value; + } + else + { + this->FlagMap[entry->IDEName] = new_value; + } + } + else + { + // Use the user-specified value. + this->FlagMap[entry->IDEName] = new_value; + } +} + +//---------------------------------------------------------------------------- void cmIDEOptions::AddDefine(const std::string& def) { this->Defines.push_back(def); |