diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-05-06 13:07:19 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2012-06-04 21:42:37 (GMT) |
commit | 2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac (patch) | |
tree | 331c3ab61eb7a5060f5495709bcaa2139c74d8e9 /Source/cmGlobalGenerator.cxx | |
parent | 1ccbfdebb99b167e1da1d9aa8a072adaea6325c6 (diff) | |
download | CMake-2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac.zip CMake-2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac.tar.gz CMake-2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac.tar.bz2 |
Move the EscapeJSON method to a sharable location.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b06cdb4..f883041 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2474,3 +2474,16 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) cmSystemTools::RemoveFile(file.c_str()); } } + +//---------------------------------------------------------------------------- +// static +std::string cmGlobalGenerator::EscapeJSON(const std::string& s) { + std::string result; + for (std::string::size_type i = 0; i < s.size(); ++i) { + if (s[i] == '"' || s[i] == '\\') { + result += '\\'; + } + result += s[i]; + } + return result; +} |