~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to include/libtorrent/asio/is_read_buffered.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Cristian Greco
  • Date: 2008-07-02 10:46:21 UTC
  • Revision ID: james.westby@ubuntu.com-20080702104621-jzx3pfke9lkcxfxn
Tags: upstream-0.13.1
ImportĀ upstreamĀ versionĀ 0.13.1

Show diffs side-by-side

added added

removed removed

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