blob: b5a4255a0d6db8f2e32ee3943a501070949586d0 [file] [log] [blame]
Jeff Thompson86b6d642013-10-17 15:01:56 -07001// (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
18namespace ndnboost { namespace iostreams {
19
20//------------------Tags for dispatch according to i/o mode-------------------//
21
22struct any_tag { };
23namespace detail { struct two_sequence : virtual any_tag { }; }
24namespace detail { struct random_access : virtual any_tag { }; }
25namespace detail { struct one_head : virtual any_tag { }; }
26namespace detail { struct two_head : virtual any_tag { }; }
27struct input : virtual any_tag { };
28struct output : virtual any_tag { };
29struct bidirectional : virtual input, virtual output, detail::two_sequence { };
30struct dual_use : virtual input, virtual output { }; // Pseudo-mode.
31struct input_seekable : virtual input, virtual detail::random_access { };
32struct output_seekable : virtual output, virtual detail::random_access { };
33struct seekable
34 : virtual input_seekable,
35 virtual output_seekable,
36 detail::one_head
37 { };
38struct dual_seekable
39 : virtual input_seekable,
40 virtual output_seekable,
41 detail::two_head
42 { };
43struct bidirectional_seekable
44 : input_seekable, output_seekable,
45 bidirectional, detail::two_head
46 { };
47
48//------------------Tags for use as i/o categories----------------------------//
49
50struct device_tag : virtual any_tag { };
51struct filter_tag : virtual any_tag { };
52
53 //
54 // Tags for optional behavior.
55 //
56
57struct peekable_tag : virtual any_tag { }; // Devices.
58struct closable_tag : virtual any_tag { };
59struct flushable_tag : virtual any_tag { };
60struct localizable_tag : virtual any_tag { };
61struct optimally_buffered_tag : virtual any_tag { };
62struct direct_tag : virtual any_tag { }; // Devices.
63struct multichar_tag : virtual any_tag { }; // Filters.
64
65struct source_tag : device_tag, input { };
66struct sink_tag : device_tag, output { };
67struct bidirectional_device_tag : device_tag, bidirectional { };
68struct seekable_device_tag : virtual device_tag, seekable { };
69
70struct input_filter_tag : filter_tag, input { };
71struct output_filter_tag : filter_tag, output { };
72struct bidirectional_filter_tag : filter_tag, bidirectional { };
73struct seekable_filter_tag : filter_tag, seekable { };
74struct dual_use_filter_tag : filter_tag, dual_use { };
75
76struct multichar_input_filter_tag
77 : multichar_tag,
78 input_filter_tag
79 { };
80struct multichar_output_filter_tag
81 : multichar_tag,
82 output_filter_tag
83 { };
84struct multichar_bidirectional_filter_tag
85 : multichar_tag,
86 bidirectional_filter_tag
87 { };
88struct multichar_seekable_filter_tag
89 : multichar_tag,
90 seekable_filter_tag
91 { };
92struct 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
101struct std_io_tag : virtual localizable_tag { };
102struct istream_tag
103 : virtual device_tag,
104 virtual peekable_tag,
105 virtual std_io_tag
106 { };
107struct ostream_tag
108 : virtual device_tag,
109 virtual std_io_tag
110 { };
111struct iostream_tag
112 : istream_tag,
113 ostream_tag
114 { };
115struct streambuf_tag
116 : device_tag,
117 peekable_tag,
118 std_io_tag
119 { };
120struct ifstream_tag
121 : input_seekable,
122 closable_tag,
123 istream_tag
124 { };
125struct ofstream_tag
126 : output_seekable,
127 closable_tag,
128 ostream_tag
129 { };
130struct fstream_tag
131 : seekable,
132 closable_tag,
133 iostream_tag
134 { };
135struct filebuf_tag
136 : seekable,
137 closable_tag,
138 streambuf_tag
139 { };
140struct istringstream_tag
141 : input_seekable,
142 istream_tag
143 { };
144struct ostringstream_tag
145 : output_seekable,
146 ostream_tag
147 { };
148struct stringstream_tag
149 : dual_seekable,
150 iostream_tag
151 { };
152struct stringbuf_tag
153 : dual_seekable,
154 streambuf_tag
155 { };
156struct generic_istream_tag
157 : input_seekable,
158 istream_tag
159 { };
160struct generic_ostream_tag
161 : output_seekable,
162 ostream_tag
163 { };
164struct generic_iostream_tag
165 : seekable,
166 iostream_tag
167 { };
168struct generic_streambuf_tag
169 : seekable,
170 streambuf_tag
171 { };
172
173} } // End namespaces iostreams, boost.
174
175#endif // #ifndef NDNBOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED