diff options
author | Ben McMorran <bemcmorr@microsoft.com> | 2020-08-01 00:37:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-08-03 16:56:41 (GMT) |
commit | 67599c7ada47f37da950ca276538076be90eabb9 (patch) | |
tree | d78cf84b417209232b656bd782217fb74fbfaf4f /Source/cmGeneratedFileStream.cxx | |
parent | 03d3cc1136f7736df5171e5153ed7f8a45a4107a (diff) | |
download | CMake-67599c7ada47f37da950ca276538076be90eabb9.zip CMake-67599c7ada47f37da950ca276538076be90eabb9.tar.gz CMake-67599c7ada47f37da950ca276538076be90eabb9.tar.bz2 |
cmGeneratedFileStream: Add WriteRaw method
Diffstat (limited to 'Source/cmGeneratedFileStream.cxx')
-rw-r--r-- | Source/cmGeneratedFileStream.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 345f0ba..2768547 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -14,10 +14,11 @@ #endif cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding) + : OriginalLocale(getloc()) { #ifndef CMAKE_BOOTSTRAP if (encoding != codecvt::None) { - imbue(std::locale(getloc(), new codecvt(encoding))); + imbue(std::locale(OriginalLocale, new codecvt(encoding))); } #else static_cast<void>(encoding); @@ -228,3 +229,14 @@ void cmGeneratedFileStream::SetTempExt(std::string const& ext) { this->TempExt = ext; } + +void cmGeneratedFileStream::WriteRaw(std::string const& data) +{ +#ifndef CMAKE_BOOTSTRAP + std::locale activeLocale = this->imbue(this->OriginalLocale); + this->write(data.data(), data.size()); + this->imbue(activeLocale); +#else + this->write(data.data(), data.size()); +#endif +} |