Warning, file /include/boost/gil/io/make_writer.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_GIL_IO_MAKE_WRITER_HPP
0009 #define BOOST_GIL_IO_MAKE_WRITER_HPP
0010
0011 #include <boost/gil/detail/mp11.hpp>
0012 #include <boost/gil/io/get_writer.hpp>
0013
0014 #include <type_traits>
0015
0016 namespace boost { namespace gil {
0017
0018 template <typename String, typename FormatTag>
0019 inline
0020 auto make_writer(String const& file_name, image_write_info<FormatTag> const& info,
0021 typename std::enable_if
0022 <
0023 mp11::mp_and
0024 <
0025 detail::is_supported_path_spec<String>,
0026 is_format_tag<FormatTag>
0027 >::value>::type* = nullptr)
0028 -> typename get_writer<String, FormatTag>::type
0029 {
0030 typename get_write_device<String, FormatTag>::type device(
0031 detail::convert_to_native_string(file_name),
0032 typename detail::file_stream_device<FormatTag>::write_tag());
0033
0034 return typename get_writer<String, FormatTag>::type(device, info);
0035 }
0036
0037 template <typename FormatTag>
0038 inline
0039 auto make_writer(std::wstring const& file_name, image_write_info<FormatTag> const& info)
0040 -> typename get_writer<std::wstring, FormatTag>::type
0041 {
0042 const char* str = detail::convert_to_native_string( file_name );
0043
0044 typename get_write_device< std::wstring
0045 , FormatTag
0046 >::type device( str
0047 , typename detail::file_stream_device< FormatTag >::write_tag()
0048 );
0049
0050 delete[] str;
0051
0052 return typename get_writer< std::wstring
0053 , FormatTag
0054 >::type( device
0055 , info
0056 );
0057 }
0058
0059 template <typename FormatTag>
0060 inline
0061 auto make_writer(detail::filesystem::path const& path, image_write_info<FormatTag> const& info)
0062 -> typename get_writer<std::wstring, FormatTag>::type
0063 {
0064 return make_writer(path.wstring(), info);
0065 }
0066
0067 template <typename Device, typename FormatTag>
0068 inline
0069 auto make_writer(Device& file, image_write_info<FormatTag> const& info,
0070 typename std::enable_if
0071 <
0072 mp11::mp_and
0073 <
0074 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
0075 is_format_tag<FormatTag>
0076 >::value
0077 >::type* = nullptr)
0078 -> typename get_writer<Device, FormatTag>::type
0079 {
0080 typename get_write_device<Device, FormatTag>::type device(file);
0081 return typename get_writer<Device, FormatTag>::type(device, info);
0082 }
0083
0084
0085
0086 template <typename String, typename FormatTag>
0087 inline
0088 auto make_writer(String const& file_name, FormatTag const&,
0089 typename std::enable_if
0090 <
0091 mp11::mp_and
0092 <
0093 detail::is_supported_path_spec<String>,
0094 is_format_tag<FormatTag>
0095 >::value
0096 >::type* = nullptr)
0097 -> typename get_writer<String, FormatTag>::type
0098 {
0099 return make_writer(file_name, image_write_info<FormatTag>());
0100 }
0101
0102 template <typename FormatTag>
0103 inline
0104 auto make_writer(std::wstring const &file_name, FormatTag const&)
0105 -> typename get_writer<std::wstring, FormatTag>::type
0106 {
0107 return make_writer( file_name
0108 , image_write_info< FormatTag >()
0109 );
0110 }
0111
0112 template <typename FormatTag>
0113 inline
0114 auto make_writer(detail::filesystem::path const& path, FormatTag const& tag)
0115 -> typename get_writer<std::wstring, FormatTag>::type
0116 {
0117 return make_writer(path.wstring(), tag);
0118 }
0119
0120 template <typename Device, typename FormatTag>
0121 inline
0122 auto make_writer(Device& file, FormatTag const&,
0123 typename std::enable_if
0124 <
0125 mp11::mp_and
0126 <
0127 typename detail::is_adaptable_output_device<FormatTag, Device>::type,
0128 is_format_tag<FormatTag>
0129 >::value
0130 >::type* = nullptr)
0131 -> typename get_writer<Device, FormatTag>::type
0132 {
0133 return make_writer(file, image_write_info<FormatTag>());
0134 }
0135
0136 }}
0137
0138 #endif