]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/nowide/iostream.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / nowide / iostream.hpp
CommitLineData
f67539c2
TL
1//
2// Copyright (c) 2012 Artyom Beilis (Tonkikh)
20effc67 3// Copyright (c) 2020 Alexander Grund
f67539c2
TL
4//
5// Distributed under the Boost Software License, Version 1.0. (See
20effc67 6// accompanying file LICENSE or copy at
f67539c2
TL
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9#ifndef BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED
10#define BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED
11
12#include <boost/nowide/config.hpp>
13#ifdef BOOST_WINDOWS
f67539c2 14#include <istream>
20effc67 15#include <memory>
f67539c2
TL
16#include <ostream>
17
18#include <boost/config/abi_prefix.hpp> // must be the last #include
19#else
20#include <iostream>
21#endif
22
23#ifdef BOOST_MSVC
24#pragma warning(push)
25#pragma warning(disable : 4251)
26#endif
27
28namespace boost {
29namespace nowide {
30#if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
31 using std::cout;
32 using std::cerr;
33 using std::cin;
34 using std::clog;
35#else
36
37 /// \cond INTERNAL
38 namespace detail {
39 class console_output_buffer;
40 class console_input_buffer;
41
42 class BOOST_NOWIDE_DECL winconsole_ostream : public std::ostream
43 {
f67539c2
TL
44 public:
45 winconsole_ostream(int fd, winconsole_ostream* tieStream);
46 ~winconsole_ostream();
47
48 private:
20effc67 49 std::unique_ptr<console_output_buffer> d;
f67539c2
TL
50 };
51
52 class BOOST_NOWIDE_DECL winconsole_istream : public std::istream
53 {
f67539c2
TL
54 public:
55 explicit winconsole_istream(winconsole_ostream* tieStream);
56 ~winconsole_istream();
57
58 private:
20effc67 59 std::unique_ptr<console_input_buffer> d;
f67539c2
TL
60 };
61 } // namespace detail
62
63 /// \endcond
64
65 ///
66 /// \brief Same as std::cin, but uses UTF-8
67 ///
68 /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
69 ///
70 extern BOOST_NOWIDE_DECL detail::winconsole_istream cin;
71 ///
72 /// \brief Same as std::cout, but uses UTF-8
73 ///
74 /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
75 ///
76 extern BOOST_NOWIDE_DECL detail::winconsole_ostream cout;
77 ///
78 /// \brief Same as std::cerr, but uses UTF-8
79 ///
80 /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
81 ///
82 extern BOOST_NOWIDE_DECL detail::winconsole_ostream cerr;
83 ///
84 /// \brief Same as std::clog, but uses UTF-8
85 ///
86 /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
87 ///
88 extern BOOST_NOWIDE_DECL detail::winconsole_ostream clog;
89
90#endif
91
92} // namespace nowide
93} // namespace boost
94
95#ifdef BOOST_MSVC
96#pragma warning(pop)
97#endif
98
99#ifdef BOOST_WINDOWS
100#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
101#endif
102
103#endif