diff options
author | Dāvis Mosāns <davispuh@gmail.com> | 2016-10-05 13:43:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-06 14:56:00 (GMT) |
commit | f00214aa4f8036951a926efd7dc3891d47abce49 (patch) | |
tree | aa2bf607f5e77144e7ddf8fedafe53196c55c623 /Source/cmGeneratedFileStream.cxx | |
parent | bb1d3370cedceec48c82a523cf35df2207c7db17 (diff) | |
download | CMake-f00214aa4f8036951a926efd7dc3891d47abce49.zip CMake-f00214aa4f8036951a926efd7dc3891d47abce49.tar.gz CMake-f00214aa4f8036951a926efd7dc3891d47abce49.tar.bz2 |
cmGeneratedFileStream: Add optional encoding support
This allows to save file stream in different encoding than internal
encoding.
Diffstat (limited to 'Source/cmGeneratedFileStream.cxx')
-rw-r--r-- | Source/cmGeneratedFileStream.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 02717a4..6cdb7f5 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -10,13 +10,21 @@ #include <cm_zlib.h> #endif -cmGeneratedFileStream::cmGeneratedFileStream() +cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding) : cmGeneratedFileStreamBase() , Stream() { +#ifdef CMAKE_BUILD_WITH_CMAKE + if (encoding != codecvt::None) { + imbue(std::locale(getloc(), new codecvt(encoding))); + } +#else + static_cast<void>(encoding); +#endif } -cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet) +cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet, + Encoding encoding) : cmGeneratedFileStreamBase(name) , Stream(TempName.c_str()) { @@ -26,6 +34,13 @@ cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet) this->TempName.c_str()); cmSystemTools::ReportLastSystemError(""); } +#ifdef CMAKE_BUILD_WITH_CMAKE + if (encoding != codecvt::None) { + imbue(std::locale(getloc(), new codecvt(encoding))); + } +#else + static_cast<void>(encoding); +#endif } cmGeneratedFileStream::~cmGeneratedFileStream() |