diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-01-17 13:38:27 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 13:05:28 -0500 |
commit | 381d50c149183183378b446fd789b1bd18c7524c (patch) | |
tree | 41f13826232b6b3650df64ef564a9a18d2a21479 | |
parent | 3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd (diff) | |
download | cmake-381d50c149183183378b446fd789b1bd18c7524c.tar.gz |
stringapi: Accept strings in cmStrCmp
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 4 | ||||
-rw-r--r-- | Source/cmStandardIncludes.h | 11 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7d0ce5f6d1..d940fe24d1 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -660,7 +660,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts, ++o; } if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(o)) != cmArrayEnd(valueOptions)) + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { assert(existingIt + 1 != opts.end()); *(existingIt + 1) = *(it + 1); @@ -831,7 +831,7 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts, ++o; } if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(o)) != cmArrayEnd(valueOptions)) + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { assert(existingIt + 1 != opts.end()); *(existingIt + 1) = *(it + 1); diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index b4ae657604..04e1bc840d 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -449,11 +449,16 @@ bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) struct cmStrCmp { cmStrCmp(const char *test) : m_test(test) {} - cmStrCmp(std::string &test) : m_test(test.c_str()) {} + cmStrCmp(const std::string &test) : m_test(test) {} + + bool operator()(const std::string& input) const + { + return m_test == input; + } bool operator()(const char * input) const { - return strcmp(input, m_test) == 0; + return strcmp(input, m_test.c_str()) == 0; } // For use with binary_search @@ -463,7 +468,7 @@ struct cmStrCmp { } private: - const char * const m_test; + const cmStdString m_test; }; #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fc2ab252a4..d5cd140b94 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1314,7 +1314,7 @@ static bool whiteListedInterfaceProperty(const std::string& prop) if (std::binary_search(cmArrayBegin(builtIns), cmArrayEnd(builtIns), prop.c_str(), - cmStrCmp(prop.c_str()))) + cmStrCmp(prop))) { return true; } |