9#ifndef GEMMI_OFSTREAM_HPP_
10#define GEMMI_OFSTREAM_HPP_
14#elif defined(_WIN32) && defined(__has_include)
17# if __has_include(<filesystem>) && !(defined(__MINGW32__) && __GNUC__ < 9)
33#elif defined(_WIN32) && defined(__cpp_lib_filesystem)
35 ptr->open(std::filesystem::path(
wfilename));
49 keeper_.reset(
new std::ofstream);
57 std::ostream&
ref() {
return *ptr_; }
60 std::unique_ptr<std::ofstream> keeper_;
70 keeper_.reset(
new std::ifstream);
78 std::istream&
ref() {
return *ptr_; }
81 std::unique_ptr<std::ifstream> keeper_;
fail(), unreachable() and __declspec/__attribute__ macros
void open_stream_from_utf8_path(T &ptr, const std::string &filename)
std::wstring UTF8_to_wchar(const char *in)
GEMMI_COLD void sys_fail(const std::string &msg)
Ifstream(const std::string &filename, std::istream *dash=nullptr)
std::istream * operator->()
Ofstream(const std::string &filename, std::ostream *dash=nullptr)
std::ostream * operator->()
Conversion between UTF-8 and wchar. Used only for file names on Windows.