annotate DEPENDENCIES/generic/include/boost/iostreams/detail/push.hpp @ 125:34e428693f5d vext

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