/usr/include/boost/iostreams/detail/resolve.hpp is in libboost1.46-dev 1.46.1-7ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
// (C) Copyright 2003-2007 Jonathan Turkanis
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
// See http://www.boost.org/libs/iostreams for documentation.
#ifndef BOOST_IOSTREAMS_DETAIL_RESOLVE_HPP_INCLUDED
#define BOOST_IOSTREAMS_DETAIL_RESOLVE_HPP_INCLUDED
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/config.hpp> // partial spec, put size_t in std.
#include <cstddef> // std::size_t.
#include <boost/detail/is_incrementable.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/iostreams/detail/adapter/mode_adapter.hpp>
#include <boost/iostreams/detail/adapter/output_iterator_adapter.hpp>
#include <boost/iostreams/detail/adapter/range_adapter.hpp>
#include <boost/iostreams/detail/config/gcc.hpp>
#include <boost/iostreams/detail/config/overload_resolution.hpp>
#include <boost/iostreams/detail/config/wide_streams.hpp>
#include <boost/iostreams/detail/enable_if_stream.hpp>
#include <boost/iostreams/detail/is_dereferenceable.hpp>
#include <boost/iostreams/detail/is_iterator_range.hpp>
#include <boost/iostreams/detail/select.hpp>
#include <boost/iostreams/detail/wrap_unwrap.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/traits.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp> // true_.
#include <boost/mpl/if.hpp>
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# include <boost/range/iterator_range.hpp>
#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#include <boost/type_traits/is_array.hpp>
// Must come last.
#include <boost/iostreams/detail/config/disable_warnings.hpp> // VC7.1 C4224.
namespace boost { namespace iostreams { namespace detail {
//------------------Definition of resolve-------------------------------------//
#ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //-------------------------//
template<typename Mode, typename Ch, typename T>
struct resolve_traits {
typedef typename
mpl::if_<
boost::detail::is_incrementable<T>,
output_iterator_adapter<Mode, Ch, T>,
const T&
>::type type;
};
# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------------------//
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve( const T& t
BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)
// I suspect that the compilers which require this workaround may
// be correct, but I'm not sure why :(
#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(810)) ||\
BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) || \
BOOST_WORKAROUND(BOOST_IOSTREAMS_GCC, BOOST_TESTED_AT(400)) ||\
BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(1110))
/**/
, typename disable_if< is_iterator_range<T> >::type* = 0
#endif
)
{
typedef typename resolve_traits<Mode, Ch, T>::type return_type;
return return_type(t);
}
template<typename Mode, typename Ch, typename Tr>
mode_adapter< Mode, std::basic_streambuf<Ch, Tr> >
resolve(std::basic_streambuf<Ch, Tr>& sb)
{ return mode_adapter< Mode, std::basic_streambuf<Ch, Tr> >(wrap(sb)); }
template<typename Mode, typename Ch, typename Tr>
mode_adapter< Mode, std::basic_istream<Ch, Tr> >
resolve(std::basic_istream<Ch, Tr>& is)
{ return mode_adapter< Mode, std::basic_istream<Ch, Tr> >(wrap(is)); }
template<typename Mode, typename Ch, typename Tr>
mode_adapter< Mode, std::basic_ostream<Ch, Tr> >
resolve(std::basic_ostream<Ch, Tr>& os)
{ return mode_adapter< Mode, std::basic_ostream<Ch, Tr> >(wrap(os)); }
template<typename Mode, typename Ch, typename Tr>
mode_adapter< Mode, std::basic_iostream<Ch, Tr> >
resolve(std::basic_iostream<Ch, Tr>& io)
{ return mode_adapter< Mode, std::basic_iostream<Ch, Tr> >(wrap(io)); }
template<typename Mode, typename Ch, std::size_t N>
array_adapter<Mode, Ch> resolve(Ch (&array)[N])
{ return array_adapter<Mode, Ch>(array); }
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template<typename Mode, typename Ch, typename Iter>
range_adapter< Mode, boost::iterator_range<Iter> >
resolve(const boost::iterator_range<Iter>& rng)
{ return range_adapter< Mode, boost::iterator_range<Iter> >(rng); }
# endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------//
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve( const T& t
BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)
#if defined(__GNUC__)
, typename disable_if< is_iterator_range<T> >::type* = 0
#endif
)
{
typedef typename resolve_traits<Mode, Ch, T>::type return_type;
return return_type(t);
}
template<typename Mode, typename Ch>
mode_adapter<Mode, std::streambuf>
resolve(std::streambuf& sb)
{ return mode_adapter<Mode, std::streambuf>(wrap(sb)); }
template<typename Mode, typename Ch>
mode_adapter<Mode, std::istream>
resolve(std::istream& is)
{ return mode_adapter<Mode, std::istream>(wrap(is)); }
template<typename Mode, typename Ch>
mode_adapter<Mode, std::ostream>
resolve(std::ostream& os)
{ return mode_adapter<Mode, std::ostream>(wrap(os)); }
template<typename Mode, typename Ch>
mode_adapter<Mode, std::iostream>
resolve(std::iostream& io)
{ return mode_adapter<Mode, std::iostream>(wrap(io)); }
template<typename Mode, typename Ch, std::size_t N>
array_adapter<Mode, Ch> resolve(Ch (&array)[N])
{ return array_adapter<Mode, Ch>(array); }
template<typename Mode, typename Ch, typename Iter>
range_adapter< Mode, boost::iterator_range<Iter> >
resolve(const boost::iterator_range<Iter>& rng)
{ return range_adapter< Mode, boost::iterator_range<Iter> >(rng); }
# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------//
#else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //----------------//
template<typename Mode, typename Ch, typename T>
struct resolve_traits {
// Note: test for is_iterator_range must come before test for output
// iterator.
typedef typename
iostreams::select< // Disambiguation for Tru64.
is_std_io<T>,
mode_adapter<Mode, T>,
is_iterator_range<T>,
range_adapter<Mode, T>,
is_dereferenceable<T>,
output_iterator_adapter<Mode, Ch, T>,
is_array<T>,
array_adapter<Mode, T>,
else_,
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
const T&
#else
T
#endif
>::type type;
};
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve(const T& t, mpl::true_)
{ // Bad overload resolution.
typedef typename resolve_traits<Mode, Ch, T>::type return_type;
return return_type(wrap(const_cast<T&>(t)));
}
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve(const T& t, mpl::false_)
{
typedef typename resolve_traits<Mode, Ch, T>::type return_type;
return return_type(t);
}
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve(const T& t BOOST_IOSTREAMS_DISABLE_IF_STREAM(T))
{ return resolve<Mode, Ch>(t, is_std_io<T>()); }
# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \
!BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \
!defined(__GNUC__) // ---------------------------------------------------//
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve(T& t, mpl::true_)
{
typedef typename resolve_traits<Mode, Ch, T>::type return_type;
return return_type(wrap(t));
}
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve(T& t, mpl::false_)
{
typedef typename resolve_traits<Mode, Ch, T>::type return_type;
return return_type(t);
}
template<typename Mode, typename Ch, typename T>
typename resolve_traits<Mode, Ch, T>::type
resolve(T& t BOOST_IOSTREAMS_ENABLE_IF_STREAM(T))
{ return resolve<Mode, Ch>(t, is_std_io<T>()); }
# endif // Borland 5.x, VC6-7.0 or GCC 2.9x //--------------------------------//
#endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------//
} } } // End namespaces detail, iostreams, boost.
#include <boost/iostreams/detail/config/enable_warnings.hpp> // VC7.1 4224.
#endif // BOOST_IOSTREAMS_DETAIL_RESOLVE_HPP_INCLUDED
|