2 // Copyright 2012 Christian Henning
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #ifndef BOOST_GIL_IO_GET_WRITER_HPP
9 #define BOOST_GIL_IO_GET_WRITER_HPP
11 #include <boost/gil/detail/mp11.hpp>
12 #include <boost/gil/io/get_write_device.hpp>
14 #include <type_traits>
16 namespace boost { namespace gil {
18 /// \brief Helper metafunction to generate writer type.
19 template <typename T, typename FormatTag, class Enable = void>
23 template <typename String, typename FormatTag>
28 typename std::enable_if
32 detail::is_supported_path_spec<String>,
33 is_format_tag<FormatTag>
38 using device_t = typename get_write_device<String, FormatTag>::type;
39 using type = writer<device_t, FormatTag>;
42 template <typename Device, typename FormatTag>
47 typename std::enable_if
51 detail::is_adaptable_output_device<FormatTag, Device>,
52 is_format_tag<FormatTag>
57 using device_t = typename get_write_device<Device, FormatTag>::type;
58 using type = writer<device_t, FormatTag>;
61 /// \brief Helper metafunction to generate dynamic image writer type.
62 template <typename T, typename FormatTag, class Enable = void>
63 struct get_dynamic_image_writer {};
65 template <typename String, typename FormatTag>
66 struct get_dynamic_image_writer
70 typename std::enable_if
74 detail::is_supported_path_spec<String>,
75 is_format_tag<FormatTag>
80 using device_t = typename get_write_device<String, FormatTag>::type;
81 using type = dynamic_image_writer<device_t, FormatTag>;
84 template <typename Device, typename FormatTag>
85 struct get_dynamic_image_writer
89 typename std::enable_if
93 detail::is_write_device<FormatTag, Device>,
94 is_format_tag<FormatTag>
99 using device_t = typename get_write_device<Device, FormatTag>::type;
100 using type = dynamic_image_writer<device_t, FormatTag>;
103 }} // namespace boost::gil