]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/quickbook/src/stream.cpp
1 /*=============================================================================
2 Copyright (c) 2009 Daniel James
4 Use, modification and distribution is subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
13 #if QUICKBOOK_WIDE_PATHS || QUICKBOOK_WIDE_STREAMS
21 bool ms_errors
= false;
24 void set_ms_errors(bool x
) {
28 #if QUICKBOOK_WIDE_STREAMS
30 void initialise_output()
32 if (_isatty(_fileno(stdout
))) _setmode(_fileno(stdout
), _O_U16TEXT
);
33 if (_isatty(_fileno(stderr
))) _setmode(_fileno(stderr
), _O_U16TEXT
);
36 void write_utf8(ostream::base_ostream
& out
, quickbook::string_view x
)
43 static ostream
x(std::wcout
);
49 inline ostream
& error_stream()
51 static ostream
x(std::wcerr
);
58 void initialise_output()
62 void write_utf8(ostream::base_ostream
& out
, quickbook::string_view x
)
69 static ostream
x(std::cout
);
75 inline ostream
& error_stream()
77 static ostream
x(std::clog
);
86 return error_stream() << "Error: ";
89 ostream
& outerr(fs::path
const& file
, std::ptrdiff_t line
)
94 return error_stream() << path_to_stream(file
) << "(" << line
<< "): error: ";
96 return error_stream() << path_to_stream(file
) << ":" << line
<< ": error: ";
100 return error_stream() << path_to_stream(file
) << ": error: ";
104 ostream
& outerr(file_ptr
const& f
, string_iterator pos
)
106 return outerr(f
->path
, f
->position_of(pos
).line
);
109 ostream
& outwarn(fs::path
const& file
, std::ptrdiff_t line
)
114 return error_stream() << path_to_stream(file
) << "(" << line
<< "): warning: ";
116 return error_stream() << path_to_stream(file
) << ":" << line
<< ": warning: ";
120 return error_stream() << path_to_stream(file
) << ": warning: ";
124 ostream
& outwarn(file_ptr
const& f
, string_iterator pos
)
126 return outwarn(f
->path
, f
->position_of(pos
).line
);
129 ostream
& ostream::operator<<(char c
) {
130 assert(c
&& !(c
& 0x80));
135 inline bool check_ascii(char const* x
) {
136 for(;*x
;++x
) if(*x
& 0x80) return false;
140 ostream
& ostream::operator<<(char const* x
) {
141 assert(check_ascii(x
));
146 ostream
& ostream::operator<<(std::string
const& x
) {
151 ostream
& ostream::operator<<(quickbook::string_view x
) {
156 ostream
& ostream::operator<<(int x
) {
161 ostream
& ostream::operator<<(unsigned int x
) {
166 ostream
& ostream::operator<<(long x
) {
171 ostream
& ostream::operator<<(unsigned long x
) {
176 #if !defined(BOOST_NO_LONG_LONG)
177 ostream
& ostream::operator<<(boost::long_long_type x
) {
182 ostream
& ostream::operator<<(boost::ulong_long_type x
) {
188 ostream
& ostream::operator<<(fs::path
const& x
) {
189 base
<< path_to_stream(x
);
193 ostream
& ostream::operator<<(base_ostream
& (*x
)(base_ostream
&)) {
198 ostream
& ostream::operator<<(base_ios
& (*x
)(base_ios
&)) {