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