mirror of
https://github.com/boostorg/nowide.git
synced 2026-02-21 15:12:30 +00:00
Use wchar_t overloads and custom filebuf also on cygwin
boost::filesystem::path uses wchar_t* on cygwin and cygwins std::filesystem::path may use it too
This commit is contained in:
@@ -46,6 +46,15 @@
|
||||
#include <boost/config/auto_link.hpp>
|
||||
#endif // auto-linking disabled
|
||||
|
||||
/// @def BOOST_NOWIDE_USE_WCHAR_OVERLOADS
|
||||
/// @brief Whether to use the wchar_t* overloads in fstream/filebuf
|
||||
/// Enabled on Windows and Cygwin as the latter may use wchar_t in filesystem::path
|
||||
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|
||||
#define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 1
|
||||
#else
|
||||
#define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 0
|
||||
#endif
|
||||
|
||||
/// @def BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
|
||||
/// @brief Define to 1 to use internal class from filebuf.hpp
|
||||
///
|
||||
@@ -55,7 +64,7 @@
|
||||
///
|
||||
/// Affects boost::nowide::basic_filebuf,
|
||||
/// boost::nowide::basic_ofstream, boost::nowide::basic_ifstream, boost::nowide::basic_fstream
|
||||
#if defined(BOOST_WINDOWS)
|
||||
#if defined(BOOST_WINDOWS) || BOOST_NOWIDE_USE_WCHAR_OVERLOADS
|
||||
#ifdef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
|
||||
#undef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
|
||||
#endif
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace nowide {
|
||||
{
|
||||
open(file_name, mode);
|
||||
}
|
||||
#ifdef BOOST_WINDOWS
|
||||
#if BOOST_NOWIDE_USE_WCHAR_OVERLOADS
|
||||
explicit basic_ifstream(const wchar_t* file_name, std::ios_base::openmode mode = std::ios_base::in)
|
||||
{
|
||||
open(file_name, mode);
|
||||
@@ -118,7 +118,7 @@ namespace nowide {
|
||||
{
|
||||
open(file_name, mode);
|
||||
}
|
||||
#ifdef BOOST_WINDOWS
|
||||
#if BOOST_NOWIDE_USE_WCHAR_OVERLOADS
|
||||
explicit basic_ofstream(const wchar_t* file_name, std::ios_base::openmode mode = std::ios_base::out)
|
||||
{
|
||||
open(file_name, mode);
|
||||
@@ -162,7 +162,7 @@ namespace nowide {
|
||||
{
|
||||
open(file_name, mode);
|
||||
}
|
||||
#ifdef BOOST_WINDOWS
|
||||
#if BOOST_NOWIDE_USE_WCHAR_OVERLOADS
|
||||
explicit basic_fstream(const wchar_t* file_name,
|
||||
std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out)
|
||||
{
|
||||
@@ -252,7 +252,7 @@ namespace nowide {
|
||||
else
|
||||
clear();
|
||||
}
|
||||
#ifdef BOOST_WINDOWS
|
||||
#if BOOST_NOWIDE_USE_WCHAR_OVERLOADS
|
||||
void open(const wchar_t* file_name, std::ios_base::openmode mode = T_StreamType::mode())
|
||||
{
|
||||
if(!rdbuf()->open(file_name, mode | T_StreamType::mode_modifier()))
|
||||
|
||||
Reference in New Issue
Block a user