/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Similar to std::ifstream/ofstream, but takes char16ptr_t on Windows. // Until C++17, std functions can only take char* filenames. So Unicode // filenames were lost on Windows. To address this limitations, this wrapper // uses proprietary wchar_t* overloads on MSVC, and __gnu_cxx::stdio_filebuf // extension on MinGW. Once we can use C++17 filesystem API everywhere, // we will be able to avoid this wrapper.
#include"mozilla/Char16.h" #include <istream> #include <ostream> #include <fstream> #ifdefined(__MINGW32__) && defined(__GLIBCXX__) # include "mozilla/UniquePtr.h" # include <fcntl.h> # include <ext/stdio_filebuf.h> #endif
namespace mozilla {
#ifdefined(__MINGW32__) && defined(__GLIBCXX__) // MinGW does not support wchar_t* overloads that are MSVC extension until // C++17, so we have to implement widechar wrappers using a GNU extension. class IFStream : public std::istream { public: explicit IFStream(char16ptr_t filename, openmode mode = in);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.