8 #ifndef BOOST_GIL_IO_MAKE_WRITER_HPP     9 #define BOOST_GIL_IO_MAKE_WRITER_HPP    11 #include <boost/gil/detail/mp11.hpp>    12 #include <boost/gil/io/get_writer.hpp>    14 #include <type_traits>    16 namespace boost { 
namespace gil {
    18 template <
typename String, 
typename FormatTag>
    20 auto make_writer(String 
const& file_name, image_write_info<FormatTag> 
const& info,
    21     typename std::enable_if
    25             detail::is_supported_path_spec<String>,
    26             is_format_tag<FormatTag>
    27         >::value>::type*  = 
nullptr)
    28     -> 
typename get_writer<String, FormatTag>::type
    30     typename get_write_device<String, FormatTag>::type device(
    31     detail::convert_to_native_string(file_name),
    32     typename detail::file_stream_device<FormatTag>::write_tag());
    34     return typename get_writer<String, FormatTag>::type(device, info);
    37 template< 
typename FormatTag >
    39 typename get_writer< std::wstring
    42 make_writer( 
const std::wstring&                  file_name
    43            , 
const image_write_info< FormatTag >& info
    46     const char* str = detail::convert_to_native_string( file_name );
    48     typename get_write_device< std::wstring
    51                                   , 
typename detail::file_stream_device< FormatTag >::write_tag()
    56     return typename get_writer< std::wstring
    63 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    64 template< 
typename FormatTag >
    66 typename get_writer< std::wstring
    69 make_writer( 
const filesystem::path&              path
    70            , 
const image_write_info< FormatTag >& info
    73     return make_writer( path.wstring()
    77 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    79 template <
typename Device, 
typename FormatTag>
    81 auto make_writer(Device& file, image_write_info<FormatTag> 
const& info,
    82     typename std::enable_if
    86             typename detail::is_adaptable_output_device<FormatTag, Device>::type,
    87             is_format_tag<FormatTag>
    90     -> 
typename get_writer<Device, FormatTag>::type
    92     typename get_write_device<Device, FormatTag>::type device(file);
    93     return typename get_writer<Device, FormatTag>::type(device, info);
    98 template <
typename String, 
typename FormatTag>
   100 auto make_writer(String 
const& file_name, FormatTag 
const&,
   101     typename std::enable_if
   105             detail::is_supported_path_spec<String>,
   106             is_format_tag<FormatTag>
   109     -> 
typename get_writer<String, FormatTag>::type
   111     return make_writer(file_name, image_write_info<FormatTag>());
   114 template< 
typename FormatTag >
   116 typename get_writer< std::wstring
   119 make_writer( 
const std::wstring& file_name
   123     return make_writer( file_name
   124                       , image_write_info< FormatTag >()
   128 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT   129 template< 
typename FormatTag >
   131 typename get_writer< std::wstring
   134 make_writer( 
const filesystem::path& path
   135            , 
const FormatTag&        tag
   138     return make_writer( path.wstring()
   142 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT   144 template <
typename Device, 
typename FormatTag>
   146 auto make_writer(Device& file, FormatTag 
const&,
   147     typename std::enable_if
   151             typename detail::is_adaptable_output_device<FormatTag, Device>::type,
   152             is_format_tag<FormatTag>
   155     -> 
typename get_writer<Device, FormatTag>::type
   157     return make_writer(file, image_write_info<FormatTag>());