Chris@16
|
1 //
|
Chris@16
|
2 // is_write_buffered.hpp
|
Chris@16
|
3 // ~~~~~~~~~~~~~~~~~~~~~
|
Chris@16
|
4 //
|
Chris@101
|
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
Chris@16
|
6 //
|
Chris@16
|
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
9 //
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_ASIO_IS_WRITE_BUFFERED_HPP
|
Chris@16
|
12 #define BOOST_ASIO_IS_WRITE_BUFFERED_HPP
|
Chris@16
|
13
|
Chris@16
|
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
Chris@16
|
15 # pragma once
|
Chris@16
|
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/asio/detail/config.hpp>
|
Chris@16
|
19 #include <boost/asio/buffered_stream_fwd.hpp>
|
Chris@16
|
20 #include <boost/asio/buffered_write_stream_fwd.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 #include <boost/asio/detail/push_options.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 namespace boost {
|
Chris@16
|
25 namespace asio {
|
Chris@16
|
26
|
Chris@16
|
27 namespace detail {
|
Chris@16
|
28
|
Chris@16
|
29 template <typename Stream>
|
Chris@16
|
30 char is_write_buffered_helper(buffered_stream<Stream>* s);
|
Chris@16
|
31
|
Chris@16
|
32 template <typename Stream>
|
Chris@16
|
33 char is_write_buffered_helper(buffered_write_stream<Stream>* s);
|
Chris@16
|
34
|
Chris@16
|
35 struct is_write_buffered_big_type { char data[10]; };
|
Chris@16
|
36 is_write_buffered_big_type is_write_buffered_helper(...);
|
Chris@16
|
37
|
Chris@16
|
38 } // namespace detail
|
Chris@16
|
39
|
Chris@16
|
40 /// The is_write_buffered class is a traits class that may be used to determine
|
Chris@16
|
41 /// whether a stream type supports buffering of written data.
|
Chris@16
|
42 template <typename Stream>
|
Chris@16
|
43 class is_write_buffered
|
Chris@16
|
44 {
|
Chris@16
|
45 public:
|
Chris@16
|
46 #if defined(GENERATING_DOCUMENTATION)
|
Chris@16
|
47 /// The value member is true only if the Stream type supports buffering of
|
Chris@16
|
48 /// written data.
|
Chris@16
|
49 static const bool value;
|
Chris@16
|
50 #else
|
Chris@16
|
51 BOOST_ASIO_STATIC_CONSTANT(bool,
|
Chris@16
|
52 value = sizeof(detail::is_write_buffered_helper((Stream*)0)) == 1);
|
Chris@16
|
53 #endif
|
Chris@16
|
54 };
|
Chris@16
|
55
|
Chris@16
|
56 } // namespace asio
|
Chris@16
|
57 } // namespace boost
|
Chris@16
|
58
|
Chris@16
|
59 #include <boost/asio/detail/pop_options.hpp>
|
Chris@16
|
60
|
Chris@16
|
61 #endif // BOOST_ASIO_IS_WRITE_BUFFERED_HPP
|