| 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 | #ifndef BOOST_IOSTREAMS_OUTPUT_SEQUENCE_HPP_INCLUDED | 
|---|
| 8 | #define BOOST_IOSTREAMS_OUTPUT_SEQUENCE_HPP_INCLUDED | 
|---|
| 9 |  | 
|---|
| 10 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) | 
|---|
| 11 | # pragma once | 
|---|
| 12 | #endif | 
|---|
| 13 |  | 
|---|
| 14 | #include <utility>           // pair. | 
|---|
| 15 | #include <boost/config.hpp>  // DEDUCED_TYPENAME, MSVC. | 
|---|
| 16 | #include <boost/detail/workaround.hpp> | 
|---|
| 17 | #include <boost/iostreams/detail/wrap_unwrap.hpp> | 
|---|
| 18 | #include <boost/iostreams/traits.hpp> | 
|---|
| 19 | #include <boost/mpl/if.hpp> | 
|---|
| 20 |  | 
|---|
| 21 | // Must come last. | 
|---|
| 22 | #include <boost/iostreams/detail/config/disable_warnings.hpp> | 
|---|
| 23 |  | 
|---|
| 24 | namespace boost { namespace iostreams { | 
|---|
| 25 |  | 
|---|
| 26 | namespace detail { | 
|---|
| 27 |  | 
|---|
| 28 | template<typename T> | 
|---|
| 29 | struct output_sequence_impl; | 
|---|
| 30 |  | 
|---|
| 31 | } // End namespace detail. | 
|---|
| 32 |  | 
|---|
| 33 | template<typename T> | 
|---|
| 34 | inline std::pair< | 
|---|
| 35 |     BOOST_DEDUCED_TYPENAME char_type_of<T>::type*, | 
|---|
| 36 |     BOOST_DEDUCED_TYPENAME char_type_of<T>::type* | 
|---|
| 37 | > | 
|---|
| 38 | output_sequence(T& t) | 
|---|
| 39 | { return detail::output_sequence_impl<T>::output_sequence(t); } | 
|---|
| 40 |  | 
|---|
| 41 | namespace detail { | 
|---|
| 42 |  | 
|---|
| 43 | //------------------Definition of output_sequence_impl------------------------// | 
|---|
| 44 |  | 
|---|
| 45 | template<typename T> | 
|---|
| 46 | struct output_sequence_impl | 
|---|
| 47 |     : mpl::if_< | 
|---|
| 48 |           detail::is_custom<T>, | 
|---|
| 49 |           operations<T>, | 
|---|
| 50 |           output_sequence_impl<direct_tag> | 
|---|
| 51 |       >::type | 
|---|
| 52 |     { }; | 
|---|
| 53 |  | 
|---|
| 54 | template<> | 
|---|
| 55 | struct output_sequence_impl<direct_tag> { | 
|---|
| 56 |     template<typename U> | 
|---|
| 57 |     static std::pair< | 
|---|
| 58 |         BOOST_DEDUCED_TYPENAME char_type_of<U>::type*, | 
|---|
| 59 |         BOOST_DEDUCED_TYPENAME char_type_of<U>::type* | 
|---|
| 60 |     > | 
|---|
| 61 |     output_sequence(U& u) { return u.output_sequence(); } | 
|---|
| 62 | }; | 
|---|
| 63 |  | 
|---|
| 64 | } // End namespace detail. | 
|---|
| 65 |  | 
|---|
| 66 | } } // End namespaces iostreams, boost. | 
|---|
| 67 |  | 
|---|
| 68 | #include <boost/iostreams/detail/config/enable_warnings.hpp> | 
|---|
| 69 |  | 
|---|
| 70 | #endif // #ifndef BOOST_IOSTREAMS_OUTPUT_SEQUENCE_HPP_INCLUDED | 
|---|