Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:44:33

0001 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
0002 // (C) Copyright 2003-2007 Jonathan Turkanis
0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
0005 
0006 // See http://www.boost.org/libs/iostreams for documentation.
0007 
0008 #ifndef BOOST_IOSTREAMS_IMBUE_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_IMBUE_HPP_INCLUDED
0010 
0011 #if defined(_MSC_VER)
0012 # pragma once
0013 #endif
0014 
0015 #include <boost/config.hpp>  // DEDUCED_TYPENAME, MSVC.
0016 #include <boost/detail/workaround.hpp>
0017 #include <boost/iostreams/detail/dispatch.hpp>
0018 #include <boost/iostreams/detail/streambuf.hpp>
0019 #include <boost/iostreams/detail/wrap_unwrap.hpp>
0020 #include <boost/iostreams/operations_fwd.hpp>
0021 #include <boost/mpl/if.hpp>
0022 
0023 // Must come last.
0024 #include <boost/iostreams/detail/config/disable_warnings.hpp>
0025 
0026 namespace boost { namespace iostreams { 
0027 
0028 namespace detail {
0029 
0030 // Implementation templates for simulated tag dispatch.
0031 template<typename T> 
0032 struct imbue_impl;
0033 
0034 } // End namespace detail.
0035 
0036 template<typename T, typename Locale>
0037 void imbue(T& t, const Locale& loc)
0038 { detail::imbue_impl<T>::imbue(detail::unwrap(t), loc); }
0039 
0040 namespace detail {
0041 
0042 //------------------Definition of imbue_impl----------------------------------//
0043 
0044 template<typename T>
0045 struct imbue_impl
0046     : mpl::if_<
0047           is_custom<T>,
0048           operations<T>,
0049           imbue_impl<
0050               BOOST_DEDUCED_TYPENAME
0051               dispatch<
0052                   T, streambuf_tag, localizable_tag, any_tag
0053               >::type
0054           >
0055       >::type
0056     { };
0057 
0058 template<>
0059 struct imbue_impl<any_tag> {
0060     template<typename T, typename Locale>
0061     static void imbue(T&, const Locale&) { }
0062 };
0063 
0064 template<>
0065 struct imbue_impl<streambuf_tag> {
0066     template<typename T, typename Locale>
0067     static void imbue(T& t, const Locale& loc) { t.pubimbue(loc); }
0068 };
0069 
0070 template<>
0071 struct imbue_impl<localizable_tag> {
0072     template<typename T, typename Locale>
0073     static void imbue(T& t, const Locale& loc) { t.imbue(loc); }
0074 };
0075 
0076 } // End namespace detail.
0077 
0078 } } // End namespaces iostreams, boost.
0079 
0080 #include <boost/iostreams/detail/config/enable_warnings.hpp>
0081 
0082 #endif // #ifndef BOOST_IOSTREAMS_IMBUE_HPP_INCLUDED