[857] | 1 | // (C) Copyright Jonathan Turkanis 2003.
|
---|
| 2 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
---|
| 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
|
---|
| 4 |
|
---|
| 5 | // See http://www.boost.org/libs/iostreams for documentation.
|
---|
| 6 |
|
---|
| 7 | // Contains category and mode tags for classifying filters, devices and
|
---|
| 8 | // standard stream and stream buffers types.
|
---|
| 9 |
|
---|
| 10 | #ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED
|
---|
| 11 | #define BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED
|
---|
| 12 |
|
---|
| 13 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
---|
| 14 | # pragma once
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
| 17 | namespace boost { namespace iostreams {
|
---|
| 18 |
|
---|
| 19 | //------------------Tags for dispatch according to i/o mode-------------------//
|
---|
| 20 |
|
---|
| 21 | struct any_tag { };
|
---|
| 22 | namespace detail { struct two_sequence : virtual any_tag { }; }
|
---|
| 23 | namespace detail { struct random_access : virtual any_tag { }; }
|
---|
| 24 | namespace detail { struct one_head : virtual any_tag { }; }
|
---|
| 25 | namespace detail { struct two_head : virtual any_tag { }; }
|
---|
| 26 | struct input : virtual any_tag { };
|
---|
| 27 | struct output : virtual any_tag { };
|
---|
| 28 | struct bidirectional : virtual input, virtual output, detail::two_sequence { };
|
---|
| 29 | struct dual_use : virtual input, virtual output { }; // Pseudo-mode.
|
---|
| 30 | struct input_seekable : virtual input, virtual detail::random_access { };
|
---|
| 31 | struct output_seekable : virtual output, virtual detail::random_access { };
|
---|
| 32 | struct seekable
|
---|
| 33 | : virtual input_seekable,
|
---|
| 34 | virtual output_seekable,
|
---|
| 35 | detail::one_head
|
---|
| 36 | { };
|
---|
| 37 | struct dual_seekable
|
---|
| 38 | : virtual input_seekable,
|
---|
| 39 | virtual output_seekable,
|
---|
| 40 | detail::two_head
|
---|
| 41 | { };
|
---|
| 42 | struct bidirectional_seekable
|
---|
| 43 | : input_seekable, output_seekable,
|
---|
| 44 | bidirectional, detail::two_head
|
---|
| 45 | { };
|
---|
| 46 |
|
---|
| 47 | //------------------Tags for use as i/o categories----------------------------//
|
---|
| 48 |
|
---|
| 49 | struct device_tag : virtual any_tag { };
|
---|
| 50 | struct filter_tag : virtual any_tag { };
|
---|
| 51 |
|
---|
| 52 | //
|
---|
| 53 | // Tags for optional behavior.
|
---|
| 54 | //
|
---|
| 55 |
|
---|
| 56 | struct peekable_tag : virtual any_tag { }; // Devices.
|
---|
| 57 | struct closable_tag : virtual any_tag { };
|
---|
| 58 | struct flushable_tag : virtual any_tag { };
|
---|
| 59 | struct localizable_tag : virtual any_tag { };
|
---|
| 60 | struct optimally_buffered_tag : virtual any_tag { };
|
---|
| 61 | struct direct_tag : virtual any_tag { }; // Devices.
|
---|
| 62 | struct multichar_tag : virtual any_tag { }; // Filters.
|
---|
| 63 |
|
---|
| 64 | struct source_tag : device_tag, input { };
|
---|
| 65 | struct sink_tag : device_tag, output { };
|
---|
| 66 | struct bidirectional_device_tag : device_tag, bidirectional { };
|
---|
| 67 | struct seekable_device_tag : virtual device_tag, seekable { };
|
---|
| 68 |
|
---|
| 69 | struct input_filter_tag : filter_tag, input { };
|
---|
| 70 | struct output_filter_tag : filter_tag, output { };
|
---|
| 71 | struct bidirectional_filter_tag : filter_tag, bidirectional { };
|
---|
| 72 | struct seekable_filter_tag : filter_tag, seekable { };
|
---|
| 73 | struct dual_use_filter_tag : filter_tag, dual_use { };
|
---|
| 74 |
|
---|
| 75 | struct multichar_input_filter_tag
|
---|
| 76 | : multichar_tag,
|
---|
| 77 | input_filter_tag
|
---|
| 78 | { };
|
---|
| 79 | struct multichar_output_filter_tag
|
---|
| 80 | : multichar_tag,
|
---|
| 81 | output_filter_tag
|
---|
| 82 | { };
|
---|
| 83 | struct multichar_bidirectional_filter_tag
|
---|
| 84 | : multichar_tag,
|
---|
| 85 | bidirectional_filter_tag
|
---|
| 86 | { };
|
---|
| 87 | struct multichar_seekable_filter_tag
|
---|
| 88 | : multichar_tag,
|
---|
| 89 | seekable_filter_tag
|
---|
| 90 | { };
|
---|
| 91 | struct multichar_dual_use_filter_tag
|
---|
| 92 | : filter_tag,
|
---|
| 93 | dual_use
|
---|
| 94 | { };
|
---|
| 95 |
|
---|
| 96 | //
|
---|
| 97 | // Tags for standard streams and streambufs.
|
---|
| 98 | //
|
---|
| 99 |
|
---|
| 100 | struct std_io_tag : virtual localizable_tag { };
|
---|
| 101 | struct istream_tag
|
---|
| 102 | : virtual input_seekable,
|
---|
| 103 | virtual device_tag,
|
---|
| 104 | virtual peekable_tag,
|
---|
| 105 | virtual std_io_tag
|
---|
| 106 | { };
|
---|
| 107 | struct ostream_tag
|
---|
| 108 | : virtual output_seekable,
|
---|
| 109 | virtual device_tag,
|
---|
| 110 | virtual peekable_tag,
|
---|
| 111 | virtual std_io_tag
|
---|
| 112 | { };
|
---|
| 113 | struct iostream_tag
|
---|
| 114 | : seekable_device_tag,
|
---|
| 115 | istream_tag,
|
---|
| 116 | ostream_tag
|
---|
| 117 | { };
|
---|
| 118 | struct streambuf_tag
|
---|
| 119 | : seekable_device_tag,
|
---|
| 120 | peekable_tag,
|
---|
| 121 | std_io_tag
|
---|
| 122 | { };
|
---|
| 123 | struct stringstream_tag
|
---|
| 124 | : dual_seekable,
|
---|
| 125 | device_tag,
|
---|
| 126 | std_io_tag
|
---|
| 127 | { };
|
---|
| 128 | struct stringbuf_tag
|
---|
| 129 | : dual_seekable,
|
---|
| 130 | device_tag,
|
---|
| 131 | std_io_tag
|
---|
| 132 | { };
|
---|
| 133 |
|
---|
| 134 | namespace detail {
|
---|
| 135 |
|
---|
| 136 | struct linked_tag : streambuf_tag { };
|
---|
| 137 |
|
---|
| 138 | } // End namespace detail.
|
---|
| 139 |
|
---|
| 140 | } } // End namespaces iostreams, boost.
|
---|
| 141 |
|
---|
| 142 | #endif // #ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED
|
---|