Blame view

3rdparty/boost_1_81_0/boost/iostreams/concepts.hpp 3.86 KB
63e88f80   Hu Chunming   提交三方库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
  // (C) Copyright 2003-2007 Jonathan Turkanis
  // Distributed under the Boost Software License, Version 1.0. (See accompanying
  // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
  
  // See http://www.boost.org/libs/iostreams for documentation.
  
  #ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
  #define BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
  
  #if defined(_MSC_VER)
  # pragma once
  #endif
  
  #include <boost/config.hpp>  // BOOST_MSVC
  #include <boost/detail/workaround.hpp>
  #include <boost/iostreams/categories.hpp>
  #include <boost/iostreams/detail/default_arg.hpp>
  #include <boost/iostreams/detail/ios.hpp>  // openmode.
  #include <boost/iostreams/positioning.hpp>
  #include <boost/static_assert.hpp>
  #include <boost/type_traits/is_convertible.hpp>
  
  namespace boost { namespace iostreams {
  
  //--------------Definitions of helper templates for device concepts-----------//
  
  template<typename Mode, typename Ch = char>
  struct device {
      typedef Ch char_type;
      struct category
          : Mode,
            device_tag,
            closable_tag,
            localizable_tag
          { };
  
      void close()
      {
          using namespace detail;
          BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
      }
  
      void close(BOOST_IOS::openmode)
      {
          using namespace detail;
          BOOST_STATIC_ASSERT((is_convertible<Mode, two_sequence>::value));
      }
  
      template<typename Locale>
      void imbue(const Locale&) { }
  };
  
  template<typename Mode, typename Ch = wchar_t>
  struct wdevice : device<Mode, Ch> { };
  
  typedef device<input>    source;
  typedef wdevice<input>   wsource;
  typedef device<output>   sink;
  typedef wdevice<output>  wsink;
  
  //--------------Definitions of helper templates for simple filter concepts----//
  
  template<typename Mode, typename Ch = char>
  struct filter {
      typedef Ch char_type;
      struct category
          : Mode,
            filter_tag,
            closable_tag,
            localizable_tag
          { };
  
      template<typename Device>
      void close(Device&)
      {
          using namespace detail;
          BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
          BOOST_STATIC_ASSERT((!is_convertible<Mode, dual_use>::value));
      }
  
      template<typename Device>
      void close(Device&, BOOST_IOS::openmode)
      {
          using namespace detail;
          BOOST_STATIC_ASSERT(
              (is_convertible<Mode, two_sequence>::value) ||
              (is_convertible<Mode, dual_use>::value)
          );
      }
  
      template<typename Locale>
      void imbue(const Locale&) { }
  };
  
  template<typename Mode, typename Ch = wchar_t>
  struct wfilter : filter<Mode, Ch> { };
  
  typedef filter<input>      input_filter;
  typedef wfilter<input>     input_wfilter;
  typedef filter<output>     output_filter;
  typedef wfilter<output>    output_wfilter;
  typedef filter<seekable>   seekable_filter;
  typedef wfilter<seekable>  seekable_wfilter;
  typedef filter<dual_use>   dual_use_filter;
  typedef wfilter<dual_use>  dual_use_wfilter;
          
  //------Definitions of helper templates for multi-character filter cncepts----//
  
  template<typename Mode, typename Ch = char>
  struct multichar_filter : filter<Mode, Ch> {
      struct category : filter<Mode, Ch>::category, multichar_tag { };
  };
  
  template<typename Mode, typename Ch = wchar_t>
  struct multichar_wfilter : multichar_filter<Mode, Ch> { };
  
  typedef multichar_filter<input>      multichar_input_filter;
  typedef multichar_wfilter<input>     multichar_input_wfilter;
  typedef multichar_filter<output>     multichar_output_filter;
  typedef multichar_wfilter<output>    multichar_output_wfilter;
  typedef multichar_filter<dual_use>   multichar_dual_use_filter;
  typedef multichar_wfilter<dual_use>  multichar_dual_use_wfilter;
  
  //----------------------------------------------------------------------------//
  
  } } // End namespaces iostreams, boost.
  
  #endif // #ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED