diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2017-12-09 03:30:16 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2017-12-09 03:30:16 (GMT) |
commit | c62ffdcd4f6f638a7d57221528ffbe112887c1b4 (patch) | |
tree | 53ff5991e05654bc9105a8a439e2058f8193d683 /Source/cmIDEOptions.cxx | |
parent | d25bcab161bfccb43cbeb43dfe96c805e2c27530 (diff) | |
download | CMake-c62ffdcd4f6f638a7d57221528ffbe112887c1b4.zip CMake-c62ffdcd4f6f638a7d57221528ffbe112887c1b4.tar.gz CMake-c62ffdcd4f6f638a7d57221528ffbe112887c1b4.tar.bz2 |
cmIDEOptions: use std::string instead of const char*
Revise method signatures to save a few c_str() conversions.
Diffstat (limited to 'Source/cmIDEOptions.cxx')
-rw-r--r-- | Source/cmIDEOptions.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 5e872d2..4b59f44 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -155,12 +155,12 @@ std::vector<std::string> const& cmIDEOptions::GetDefines() const return this->Defines; } -void cmIDEOptions::AddFlag(const char* flag, const char* value) +void cmIDEOptions::AddFlag(std::string const& flag, std::string const& value) { this->FlagMap[flag] = value; } -void cmIDEOptions::AddFlag(const char* flag, +void cmIDEOptions::AddFlag(std::string const& flag, std::vector<std::string> const& value) { this->FlagMap[flag] = value; @@ -185,7 +185,7 @@ void cmIDEOptions::AppendFlagString(std::string const& flag, this->FlagMap[flag].append_with_space(value); } -void cmIDEOptions::RemoveFlag(const char* flag) +void cmIDEOptions::RemoveFlag(std::string const& flag) { this->FlagMap.erase(flag); } @@ -195,12 +195,13 @@ bool cmIDEOptions::HasFlag(std::string const& flag) const return this->FlagMap.find(flag) != this->FlagMap.end(); } -const char* cmIDEOptions::GetFlag(const char* flag) +const char* cmIDEOptions::GetFlag(std::string const& flag) const { // This method works only for single-valued flags! - std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(flag); - if (i != this->FlagMap.end() && i->second.size() == 1) { + std::map<std::string, FlagValue>::const_iterator i = + this->FlagMap.find(flag); + if (i != this->FlagMap.cend() && i->second.size() == 1) { return i->second[0].c_str(); } - return 0; + return nullptr; } |