Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:46

0001 // Copyright (c) 2012 Artyom Beilis (Tonkikh)
0002 // Copyright (c) 2020-2021 Alexander Grund
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // https://www.boost.org/LICENSE_1_0.txt
0006 
0007 #ifndef BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED
0008 #define BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED
0009 
0010 #include <boost/nowide/config.hpp>
0011 #ifdef BOOST_WINDOWS
0012 #include <istream>
0013 #include <memory>
0014 #include <ostream>
0015 
0016 #include <boost/config/abi_prefix.hpp> // must be the last #include
0017 #else
0018 #include <iostream>
0019 #endif
0020 
0021 #ifdef BOOST_MSVC
0022 #pragma warning(push)
0023 #pragma warning(disable : 4251)
0024 #endif
0025 
0026 namespace boost {
0027 namespace nowide {
0028 #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
0029     using std::cout;
0030     using std::cerr;
0031     using std::cin;
0032     using std::clog;
0033 #else
0034 
0035     /// \cond INTERNAL
0036     namespace detail {
0037         class console_output_buffer;
0038         class console_input_buffer;
0039 
0040         class BOOST_NOWIDE_DECL winconsole_ostream : public std::ostream
0041         {
0042         public:
0043             winconsole_ostream(bool isBuffered, winconsole_ostream* tieStream);
0044             ~winconsole_ostream();
0045 
0046         private:
0047             std::unique_ptr<console_output_buffer> d;
0048             // Ensure the std streams are initialized and alive during the lifetime of this instance
0049             std::ios_base::Init init_;
0050         };
0051 
0052         class BOOST_NOWIDE_DECL winconsole_istream : public std::istream
0053         {
0054         public:
0055             explicit winconsole_istream(winconsole_ostream* tieStream);
0056             ~winconsole_istream();
0057 
0058         private:
0059             std::unique_ptr<console_input_buffer> d;
0060             // Ensure the std streams are initialized and alive during the lifetime of this instance
0061             std::ios_base::Init init_;
0062         };
0063     } // namespace detail
0064 
0065     /// \endcond
0066 
0067     ///
0068     /// \brief Same as std::cin, but uses UTF-8
0069     ///
0070     /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
0071     ///
0072     extern BOOST_NOWIDE_DECL detail::winconsole_istream cin;
0073     ///
0074     /// \brief Same as std::cout, but uses UTF-8
0075     ///
0076     /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
0077     ///
0078     extern BOOST_NOWIDE_DECL detail::winconsole_ostream cout;
0079     ///
0080     /// \brief Same as std::cerr, but uses UTF-8
0081     ///
0082     /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
0083     ///
0084     extern BOOST_NOWIDE_DECL detail::winconsole_ostream cerr;
0085     ///
0086     /// \brief Same as std::clog, but uses UTF-8
0087     ///
0088     /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
0089     ///
0090     extern BOOST_NOWIDE_DECL detail::winconsole_ostream clog;
0091 
0092 #endif
0093 
0094 } // namespace nowide
0095 } // namespace boost
0096 
0097 #ifdef BOOST_MSVC
0098 #pragma warning(pop)
0099 #endif
0100 
0101 #ifdef BOOST_WINDOWS
0102 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
0103 #endif
0104 
0105 #endif