cmSystemTool: Let EscapeQuotes accept a cm::string_view

This commit is contained in:
Sebastian Holtermann 2019-07-28 16:01:58 +02:00
parent ad3183db8c
commit 2c5454f227
2 changed files with 5 additions and 5 deletions

View File

@ -176,15 +176,15 @@ void cmSystemTools::ExpandRegistryValues(std::string& source,
}
#endif
std::string cmSystemTools::EscapeQuotes(const std::string& str)
std::string cmSystemTools::EscapeQuotes(cm::string_view str)
{
std::string result;
result.reserve(str.size());
for (const char* ch = str.c_str(); *ch != '\0'; ++ch) {
if (*ch == '"') {
for (const char ch : str) {
if (ch == '"') {
result += '\\';
}
result += *ch;
result += ch;
}
return result;
}

View File

@ -78,7 +78,7 @@ public:
KeyWOW64 view = KeyWOW64_Default);
//! Escape quotes in a string.
static std::string EscapeQuotes(const std::string& str);
static std::string EscapeQuotes(cm::string_view str);
/** Map help document name to file name. */
static std::string HelpFileName(std::string);