X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72a7c55982140a7e296346e92f66a21d3f741537..603cfe42185349e119ba4c69bd56a79998babcc4:/src/common/stdstream.cpp?ds=sidebyside diff --git a/src/common/stdstream.cpp b/src/common/stdstream.cpp index af8475cdd3..0f4fea1836 100644 --- a/src/common/stdstream.cpp +++ b/src/common/stdstream.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/stdstream.h +// Name: src/common/stdstream.cpp // Purpose: Implementation of std::istream and std::ostream derived // wrappers for wxInputStream and wxOutputStream // Author: Jonathan Liu @@ -20,7 +20,7 @@ #pragma hdrstop #endif -#if wxUSE_STD_IOSTREAM +#if wxUSE_STREAMS && wxUSE_STD_IOSTREAM #ifndef WX_PRECOMP #endif @@ -39,7 +39,7 @@ namespace { -inline bool +bool IosSeekDirToWxSeekMode(std::ios_base::seekdir way, wxSeekMode& seekMode) { @@ -183,16 +183,6 @@ wxStdInputStreamBuffer::pbackfail(int c) return m_stream.Ungetch((char) c) ? c : EOF; } -// ========================================================================== -// wxStdInputStream -// ========================================================================== - -wxStdInputStream::wxStdInputStream(wxInputStream& stream) : - std::istream(NULL), m_streamBuffer(stream) -{ - std::ios::init(&m_streamBuffer); -} - // ========================================================================== // wxStdOutputStreamBuffer // ========================================================================== @@ -260,13 +250,44 @@ wxStdOutputStreamBuffer::overflow(int c) } // ========================================================================== -// wxStdOutputStream +// wxStdInputStream and wxStdOutputStream // ========================================================================== +// FIXME-VC6: it is impossible to call basic_ios::init() with this +// compiler, it complains about invalid call to non-static member +// function so use a suspicious (as it uses a pointer to not yet +// constructed streambuf) but working workaround +// +// It also doesn't like using istream in the ctor initializer list +// and we must spell it out as basic_istream. +#ifdef __VISUALC6__ + +wxStdInputStream::wxStdInputStream(wxInputStream& stream) + : std::basic_istream >(&m_streamBuffer), + m_streamBuffer(stream) +{ +} + +wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) + : std::basic_ostream >(&m_streamBuffer), + m_streamBuffer(stream) +{ +} + +#else // !VC6 + +wxStdInputStream::wxStdInputStream(wxInputStream& stream) : + std::istream(NULL), m_streamBuffer(stream) +{ + std::ios::init(&m_streamBuffer); +} + wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) : std::ostream(NULL), m_streamBuffer(stream) { std::ios::init(&m_streamBuffer); } -#endif // wxUSE_STD_IOSTREAM +#endif // VC6/!VC6 + +#endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM