File indexing completed on 2025-01-18 09:38:53
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
0010
0011 #if defined(_MSC_VER)
0012 # pragma once
0013 #endif
0014
0015 #include <boost/config.hpp> // BOOST_MSVC
0016 #include <boost/detail/workaround.hpp>
0017 #include <boost/iostreams/categories.hpp>
0018 #include <boost/iostreams/detail/default_arg.hpp>
0019 #include <boost/iostreams/detail/ios.hpp> // openmode.
0020 #include <boost/iostreams/positioning.hpp>
0021 #include <boost/static_assert.hpp>
0022 #include <boost/type_traits/is_convertible.hpp>
0023
0024 namespace boost { namespace iostreams {
0025
0026
0027
0028 template<typename Mode, typename Ch = char>
0029 struct device {
0030 typedef Ch char_type;
0031 struct category
0032 : Mode,
0033 device_tag,
0034 closable_tag,
0035 localizable_tag
0036 { };
0037
0038 void close()
0039 {
0040 using namespace detail;
0041 BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
0042 }
0043
0044 void close(BOOST_IOS::openmode)
0045 {
0046 using namespace detail;
0047 BOOST_STATIC_ASSERT((is_convertible<Mode, two_sequence>::value));
0048 }
0049
0050 template<typename Locale>
0051 void imbue(const Locale&) { }
0052 };
0053
0054 template<typename Mode, typename Ch = wchar_t>
0055 struct wdevice : device<Mode, Ch> { };
0056
0057 typedef device<input> source;
0058 typedef wdevice<input> wsource;
0059 typedef device<output> sink;
0060 typedef wdevice<output> wsink;
0061
0062
0063
0064 template<typename Mode, typename Ch = char>
0065 struct filter {
0066 typedef Ch char_type;
0067 struct category
0068 : Mode,
0069 filter_tag,
0070 closable_tag,
0071 localizable_tag
0072 { };
0073
0074 template<typename Device>
0075 void close(Device&)
0076 {
0077 using namespace detail;
0078 BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
0079 BOOST_STATIC_ASSERT((!is_convertible<Mode, dual_use>::value));
0080 }
0081
0082 template<typename Device>
0083 void close(Device&, BOOST_IOS::openmode)
0084 {
0085 using namespace detail;
0086 BOOST_STATIC_ASSERT(
0087 (is_convertible<Mode, two_sequence>::value) ||
0088 (is_convertible<Mode, dual_use>::value)
0089 );
0090 }
0091
0092 template<typename Locale>
0093 void imbue(const Locale&) { }
0094 };
0095
0096 template<typename Mode, typename Ch = wchar_t>
0097 struct wfilter : filter<Mode, Ch> { };
0098
0099 typedef filter<input> input_filter;
0100 typedef wfilter<input> input_wfilter;
0101 typedef filter<output> output_filter;
0102 typedef wfilter<output> output_wfilter;
0103 typedef filter<seekable> seekable_filter;
0104 typedef wfilter<seekable> seekable_wfilter;
0105 typedef filter<dual_use> dual_use_filter;
0106 typedef wfilter<dual_use> dual_use_wfilter;
0107
0108
0109
0110 template<typename Mode, typename Ch = char>
0111 struct multichar_filter : filter<Mode, Ch> {
0112 struct category : filter<Mode, Ch>::category, multichar_tag { };
0113 };
0114
0115 template<typename Mode, typename Ch = wchar_t>
0116 struct multichar_wfilter : multichar_filter<Mode, Ch> { };
0117
0118 typedef multichar_filter<input> multichar_input_filter;
0119 typedef multichar_wfilter<input> multichar_input_wfilter;
0120 typedef multichar_filter<output> multichar_output_filter;
0121 typedef multichar_wfilter<output> multichar_output_wfilter;
0122 typedef multichar_filter<dual_use> multichar_dual_use_filter;
0123 typedef multichar_wfilter<dual_use> multichar_dual_use_wfilter;
0124
0125
0126
0127 } }
0128
0129 #endif