Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/iostreams/detail/push.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 #ifndef BOOST_IOSTREAMS_DETAIL_PUSH_HPP_INCLUDED | |
9 #define BOOST_IOSTREAMS_DETAIL_PUSH_HPP_INCLUDED | |
10 | |
11 #if defined(_MSC_VER) && (_MSC_VER >= 1020) | |
12 # pragma once | |
13 #endif | |
14 | |
15 #include <boost/config.hpp> // BOOST_MSVC. | |
16 #include <boost/detail/workaround.hpp> | |
17 #include <boost/iostreams/categories.hpp> | |
18 #include <boost/iostreams/categories.hpp> | |
19 #include <boost/iostreams/detail/adapter/range_adapter.hpp> | |
20 #include <boost/iostreams/detail/config/wide_streams.hpp> | |
21 #include <boost/iostreams/detail/enable_if_stream.hpp> | |
22 #include <boost/iostreams/pipeline.hpp> | |
23 #include <boost/iostreams/detail/push_params.hpp> | |
24 #include <boost/iostreams/detail/resolve.hpp> | |
25 #include <boost/mpl/bool.hpp> | |
26 #include <boost/preprocessor/cat.hpp> | |
27 #include <boost/preprocessor/control/iif.hpp> | |
28 #include <boost/static_assert.hpp> | |
29 #include <boost/type_traits/is_convertible.hpp> | |
30 | |
31 // | |
32 // Macro: BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name, mode, ch, helper). | |
33 // Description: Defines overloads with name 'name' which forward to a function | |
34 // 'helper' which takes a filter or devide by const reference. | |
35 // | |
36 #define BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name, mode, ch, helper) \ | |
37 BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, 0, ?) \ | |
38 /**/ | |
39 | |
40 // | |
41 // Macro: BOOST_IOSTREAMS_DEFINE_PUSH(name, mode, ch, helper). | |
42 // Description: Defines constructors which forward to a function | |
43 // 'helper' which takes a filter or device by const reference. | |
44 // | |
45 #define BOOST_IOSTREAMS_DEFINE_PUSH(name, mode, ch, helper) \ | |
46 BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, 1, void) \ | |
47 /**/ | |
48 | |
49 //--------------------Definition of BOOST_IOSTREAMS_DEFINE_PUSH_IMPL----------// | |
50 | |
51 #define BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, arg, helper, has_return) \ | |
52 this->helper( ::boost::iostreams::detail::resolve<mode, ch>(arg) \ | |
53 BOOST_IOSTREAMS_PUSH_ARGS() ); \ | |
54 /**/ | |
55 | |
56 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ | |
57 !BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ | |
58 /**/ | |
59 # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES | |
60 # define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ | |
61 template<typename CharType, typename TraitsType> \ | |
62 BOOST_PP_IIF(has_return, result, explicit) \ | |
63 name(::std::basic_streambuf<CharType, TraitsType>& sb BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
64 { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, sb, helper, has_return); } \ | |
65 template<typename CharType, typename TraitsType> \ | |
66 BOOST_PP_IIF(has_return, result, explicit) \ | |
67 name(::std::basic_istream<CharType, TraitsType>& is BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
68 { BOOST_STATIC_ASSERT((!is_convertible<mode, output>::value)); \ | |
69 BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, is, helper, has_return); } \ | |
70 template<typename CharType, typename TraitsType> \ | |
71 BOOST_PP_IIF(has_return, result, explicit) \ | |
72 name(::std::basic_ostream<CharType, TraitsType>& os BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
73 { BOOST_STATIC_ASSERT((!is_convertible<mode, input>::value)); \ | |
74 BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, os, helper, has_return); } \ | |
75 template<typename CharType, typename TraitsType> \ | |
76 BOOST_PP_IIF(has_return, result, explicit) \ | |
77 name(::std::basic_iostream<CharType, TraitsType>& io BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
78 { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, io, helper, has_return); } \ | |
79 template<typename Iter> \ | |
80 BOOST_PP_IIF(has_return, result, explicit) \ | |
81 name(const iterator_range<Iter>& rng BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
82 { BOOST_PP_EXPR_IF(has_return, return) \ | |
83 this->helper( ::boost::iostreams::detail::range_adapter< \ | |
84 mode, iterator_range<Iter> \ | |
85 >(rng) \ | |
86 BOOST_IOSTREAMS_PUSH_ARGS() ); } \ | |
87 template<typename Pipeline, typename Concept> \ | |
88 BOOST_PP_IIF(has_return, result, explicit) \ | |
89 name(const ::boost::iostreams::pipeline<Pipeline, Concept>& p) \ | |
90 { p.push(*this); } \ | |
91 template<typename T> \ | |
92 BOOST_PP_IIF(has_return, result, explicit) \ | |
93 name(const T& t BOOST_IOSTREAMS_PUSH_PARAMS() BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) \ | |
94 { this->helper( ::boost::iostreams::detail::resolve<mode, ch>(t) \ | |
95 BOOST_IOSTREAMS_PUSH_ARGS() ); } \ | |
96 /**/ | |
97 # else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES | |
98 # define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ | |
99 BOOST_PP_IF(has_return, result, explicit) \ | |
100 name(::std::streambuf& sb BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
101 { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, sb, helper, has_return); } \ | |
102 BOOST_PP_IF(has_return, result, explicit) \ | |
103 name(::std::istream& is BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
104 { BOOST_STATIC_ASSERT((!is_convertible<mode, output>::value)); \ | |
105 BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, is, helper, has_return); } \ | |
106 BOOST_PP_IF(has_return, result, explicit) \ | |
107 name(::std::ostream& os BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
108 { BOOST_STATIC_ASSERT((!is_convertible<mode, input>::value)); \ | |
109 BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, os, helper, has_return); } \ | |
110 BOOST_PP_IF(has_return, result, explicit) \ | |
111 name(::std::iostream& io BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
112 { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, io, helper, has_return); } \ | |
113 template<typename Iter> \ | |
114 BOOST_PP_IF(has_return, result, explicit) \ | |
115 name(const iterator_range<Iter>& rng BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
116 { BOOST_PP_EXPR_IF(has_return, return) \ | |
117 this->helper( ::boost::iostreams::detail::range_adapter< \ | |
118 mode, iterator_range<Iter> \ | |
119 >(rng) \ | |
120 BOOST_IOSTREAMS_PUSH_ARGS() ); } \ | |
121 template<typename Pipeline, typename Concept> \ | |
122 BOOST_PP_IF(has_return, result, explicit) \ | |
123 name(const ::boost::iostreams::pipeline<Pipeline, Concept>& p) \ | |
124 { p.push(*this); } \ | |
125 template<typename T> \ | |
126 BOOST_PP_EXPR_IF(has_return, result) \ | |
127 name(const T& t BOOST_IOSTREAMS_PUSH_PARAMS() BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) \ | |
128 { this->helper( ::boost::iostreams::detail::resolve<mode, ch>(t) \ | |
129 BOOST_IOSTREAMS_PUSH_ARGS() ); } \ | |
130 /**/ | |
131 # endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES | |
132 #else // #if VC6, VC7.0, Borland 5.x | |
133 # define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ | |
134 template<typename T> \ | |
135 void BOOST_PP_CAT(name, _msvc_impl) \ | |
136 ( ::boost::mpl::true_, const T& t BOOST_IOSTREAMS_PUSH_PARAMS() ) \ | |
137 { t.push(*this); } \ | |
138 template<typename T> \ | |
139 void BOOST_PP_CAT(name, _msvc_impl) \ | |
140 ( ::boost::mpl::false_, const T& t BOOST_IOSTREAMS_PUSH_PARAMS() ) \ | |
141 { this->helper( ::boost::iostreams::detail::resolve<mode, ch>(t) \ | |
142 BOOST_IOSTREAMS_PUSH_ARGS() ); } \ | |
143 template<typename T> \ | |
144 BOOST_PP_IF(has_return, result, explicit) \ | |
145 name(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()) \ | |
146 { \ | |
147 this->BOOST_PP_CAT(name, _msvc_impl) \ | |
148 ( ::boost::iostreams::detail::is_pipeline<T>(), \ | |
149 t BOOST_IOSTREAMS_PUSH_ARGS() ); \ | |
150 } \ | |
151 /**/ | |
152 #endif // #if VC6, VC7.0, Borland 5.x | |
153 | |
154 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_PUSH_HPP_INCLUDED |