source: NonGTP/Boost/boost/iostreams/categories.hpp @ 857

Revision 857, 4.2 KB checked in by igarcia, 19 years ago (diff)
Line 
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
17namespace boost { namespace iostreams {
18
19//------------------Tags for dispatch according to i/o mode-------------------//
20
21struct any_tag { };
22namespace detail { struct two_sequence : virtual any_tag { }; }
23namespace detail { struct random_access : virtual any_tag { }; }
24namespace detail { struct one_head : virtual any_tag { }; }
25namespace detail { struct two_head : virtual any_tag { }; }
26struct input : virtual any_tag { };
27struct output : virtual any_tag { };
28struct bidirectional : virtual input, virtual output, detail::two_sequence { };
29struct dual_use : virtual input, virtual output { }; // Pseudo-mode.
30struct input_seekable : virtual input, virtual detail::random_access { };
31struct output_seekable : virtual output, virtual detail::random_access { };
32struct seekable
33    : virtual input_seekable,
34      virtual output_seekable,
35      detail::one_head
36    { };
37struct dual_seekable
38    : virtual input_seekable,
39      virtual output_seekable,
40      detail::two_head
41    { }; 
42struct bidirectional_seekable
43    : input_seekable, output_seekable,
44      bidirectional, detail::two_head
45    { };
46
47//------------------Tags for use as i/o categories----------------------------//
48
49struct device_tag : virtual any_tag { };
50struct filter_tag : virtual any_tag { };
51
52    //
53    // Tags for optional behavior.
54    //
55
56struct peekable_tag : virtual any_tag { };        // Devices.
57struct closable_tag : virtual any_tag { };
58struct flushable_tag : virtual any_tag { };
59struct localizable_tag : virtual any_tag { };
60struct optimally_buffered_tag : virtual any_tag { };
61struct direct_tag : virtual any_tag { };          // Devices.
62struct multichar_tag : virtual any_tag { };       // Filters.
63
64struct source_tag : device_tag, input { };
65struct sink_tag : device_tag, output { };
66struct bidirectional_device_tag : device_tag, bidirectional { };
67struct seekable_device_tag : virtual device_tag, seekable { };
68
69struct input_filter_tag : filter_tag, input { };
70struct output_filter_tag : filter_tag, output { };
71struct bidirectional_filter_tag : filter_tag, bidirectional { };
72struct seekable_filter_tag : filter_tag, seekable { };
73struct dual_use_filter_tag : filter_tag, dual_use { };
74
75struct multichar_input_filter_tag
76    : multichar_tag,
77      input_filter_tag
78    { };
79struct multichar_output_filter_tag
80    : multichar_tag,
81      output_filter_tag
82    { };
83struct multichar_bidirectional_filter_tag
84    : multichar_tag,
85      bidirectional_filter_tag
86    { };
87struct multichar_seekable_filter_tag
88    : multichar_tag,
89      seekable_filter_tag
90    { };
91struct multichar_dual_use_filter_tag
92    : filter_tag,
93      dual_use
94    { };
95
96    //
97    // Tags for standard streams and streambufs.
98    //
99
100struct std_io_tag : virtual localizable_tag { };
101struct istream_tag
102    : virtual input_seekable,
103      virtual device_tag,
104      virtual peekable_tag,
105      virtual std_io_tag
106    { };
107struct ostream_tag
108    : virtual output_seekable,
109      virtual device_tag,
110      virtual peekable_tag,
111      virtual std_io_tag
112    { };
113struct iostream_tag
114    : seekable_device_tag,
115      istream_tag,
116      ostream_tag
117    { };
118struct streambuf_tag
119    : seekable_device_tag,
120      peekable_tag,
121      std_io_tag
122    { };
123struct stringstream_tag
124    : dual_seekable,
125      device_tag,
126      std_io_tag
127    { };
128struct stringbuf_tag
129    : dual_seekable,
130      device_tag,
131      std_io_tag
132    { };
133
134namespace detail {
135
136struct linked_tag : streambuf_tag { };
137
138} // End namespace detail.
139
140} } // End namespaces iostreams, boost.
141
142#endif // #ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.