1 /*============================================================================== 2 Copyright (c) 2001-2010 Joel de Guzman 3 Copyright (c) 2010 Thomas Heller 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #ifndef BOOST_PHOENIX_OPERATOR_IO_HPP 9 #define BOOST_PHOENIX_OPERATOR_IO_HPP 10 11 #include <iosfwd> 12 13 #include <boost/phoenix/core/limits.hpp> 14 #include <boost/fusion/sequence/intrinsic/at.hpp> 15 #include <boost/phoenix/core/domain.hpp> 16 #include <boost/proto/make_expr.hpp> 17 #include <boost/proto/tags.hpp> 18 #include <boost/proto/operators.hpp> 19 20 namespace boost { namespace phoenix 21 { 22 namespace detail 23 { 24 typedef std::ios_base& (*iomanip_type)(std::ios_base&); 25 typedef std::istream& (*imanip_type)(std::istream&); 26 typedef std::ostream& (*omanip_type)(std::ostream&); 27 } 28 29 ///////////////////////////////////////////////////////////////////////////// 30 // 31 // overloads for I/O manipulators. 32 // 33 ///////////////////////////////////////////////////////////////////////////// 34 template <typename Expr> 35 inline 36 typename proto::result_of::make_expr< 37 proto::tag::shift_left 38 , phoenix_domain 39 , actor<Expr> 40 , detail::iomanip_type 41 >::type const operator <<(actor<Expr> const & a0,detail::iomanip_type a1)42 operator<<(actor<Expr> const& a0, detail::iomanip_type a1) 43 { 44 return proto::make_expr< 45 proto::tag::shift_left, phoenix_domain>(a0, a1); 46 } 47 48 template <typename Expr> 49 inline 50 typename proto::result_of::make_expr< 51 proto::tag::shift_left 52 , phoenix_domain 53 , actor<Expr> 54 , detail::omanip_type 55 >::type const operator <<(actor<Expr> const & a0,detail::omanip_type a1)56 operator<<(actor<Expr> const& a0, detail::omanip_type a1) 57 { 58 return proto::make_expr< 59 proto::tag::shift_left, phoenix_domain>(a0, a1); 60 } 61 62 template <typename Expr> 63 inline 64 typename proto::result_of::make_expr< 65 proto::tag::shift_right 66 , phoenix_domain 67 , actor<Expr> 68 , detail::iomanip_type 69 >::type const operator >>(actor<Expr> const & a0,detail::iomanip_type a1)70 operator>>(actor<Expr> const& a0, detail::iomanip_type a1) 71 { 72 return proto::make_expr< 73 proto::tag::shift_right, phoenix_domain>(a0, a1); 74 } 75 76 template <typename Expr> 77 inline 78 typename proto::result_of::make_expr< 79 proto::tag::shift_right 80 , phoenix_domain 81 , actor<Expr> 82 , detail::imanip_type 83 >::type const operator >>(actor<Expr> const & a0,detail::imanip_type a1)84 operator>>(actor<Expr> const& a0, detail::imanip_type a1) 85 { 86 return proto::make_expr< 87 proto::tag::shift_right, phoenix_domain>(a0, a1); 88 } 89 90 using proto::exprns_::operator<<; 91 using proto::exprns_::operator>>; 92 }} 93 94 #endif 95