summaryrefslogtreecommitdiff
path: root/boost/gil/extension/io/tiff/detail/is_allowed.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/gil/extension/io/tiff/detail/is_allowed.hpp')
-rw-r--r--boost/gil/extension/io/tiff/detail/is_allowed.hpp121
1 files changed, 81 insertions, 40 deletions
diff --git a/boost/gil/extension/io/tiff/detail/is_allowed.hpp b/boost/gil/extension/io/tiff/detail/is_allowed.hpp
index 417a467c98..58747aa6b3 100644
--- a/boost/gil/extension/io/tiff/detail/is_allowed.hpp
+++ b/boost/gil/extension/io/tiff/detail/is_allowed.hpp
@@ -8,57 +8,100 @@
#ifndef BOOST_GIL_EXTENSION_IO_TIFF_DETAIL_IS_ALLOWED_HPP
#define BOOST_GIL_EXTENSION_IO_TIFF_DETAIL_IS_ALLOWED_HPP
+#include <boost/gil/extension/io/tiff/tags.hpp>
#include <boost/gil/io/base.hpp>
#include <boost/mpl/for_each.hpp>
+#include <type_traits>
+
namespace boost { namespace gil { namespace detail {
-typedef std::vector< tiff_bits_per_sample::type > channel_sizes_t;
+using channel_sizes_t = std::vector<tiff_bits_per_sample::type>;
-template< typename View, typename Channel, typename Enable = void > struct Format_Type {};
+template <typename View, typename Channel, typename Enable = void>
+struct Format_Type {};
// is_bit_aligned< View >
-template< typename View, typename Channel > struct Format_Type< View
- , Channel
- , typename boost::enable_if< typename is_bit_aligned< typename get_pixel_type< View >::type >::type >::type
- >
+template <typename View, typename Channel>
+struct Format_Type
+<
+ View,
+ Channel,
+ typename std::enable_if
+ <
+ is_bit_aligned
+ <
+ typename get_pixel_type<View>::type
+ >::value
+ >::type
+>
{
static const int value = SAMPLEFORMAT_UINT;
};
// is_not_bit_aligned< View > && is_unsigned< Channel >
-template< typename View, typename Channel > struct Format_Type< View
- , Channel
- , typename boost::enable_if< mpl::and_< mpl::not_< typename is_bit_aligned< typename get_pixel_type< View >::type >::type >
- , is_unsigned< Channel >
- >
- >::type
- >
+template <typename View, typename Channel>
+struct Format_Type
+<
+ View,
+ Channel,
+ typename std::enable_if
+ <
+ mpl::and_
+ <
+ mpl::not_
+ <
+ typename is_bit_aligned<typename get_pixel_type<View>::type>::type
+ >,
+ is_unsigned<Channel>
+ >::value
+ >::type
+>
{
static const int value = SAMPLEFORMAT_UINT;
};
// is_not_bit_aligned< View > && is_signed< Channel >
-template< typename View, typename Channel > struct Format_Type< View
- , Channel
- , typename boost::enable_if< mpl::and_< mpl::not_< typename is_bit_aligned< typename get_pixel_type< View >::type >::type >
- , is_signed< Channel >
- >
- >::type
- >
+template <typename View, typename Channel>
+struct Format_Type
+<
+ View,
+ Channel,
+ typename std::enable_if
+ <
+ mpl::and_
+ <
+ mpl::not_
+ <
+ typename is_bit_aligned<typename get_pixel_type<View>::type>::type
+ >,
+ is_signed<Channel>
+ >::value
+ >::type
+>
{
static const int value = SAMPLEFORMAT_INT;
};
// is_not_bit_aligned< View > && is_floating_point< Channel >
-template< typename View, typename Channel > struct Format_Type< View
- , Channel
- , typename boost::enable_if< mpl::and_< mpl::not_< typename is_bit_aligned< typename get_pixel_type< View >::type >::type >
- , is_floating_point< Channel >
- >
- >::type
- >
+template <typename View, typename Channel>
+struct Format_Type
+<
+ View,
+ Channel,
+ typename std::enable_if
+ <
+ mpl::and_
+ <
+ mpl::not_
+ <
+ typename is_bit_aligned<typename get_pixel_type<View>::type>::type
+ >,
+ is_floating_point<Channel>
+ >::value
+ >::type
+>
{
static const int value = SAMPLEFORMAT_IEEEFP;
};
@@ -98,9 +141,8 @@ bool compare_channel_sizes( const channel_sizes_t& channel_sizes // in bits
, mpl::true_ // is_homogeneous
)
{
- typedef typename View::value_type pixel_t;
- typedef typename channel_traits<
- typename element_type< pixel_t >::type >::value_type channel_t;
+ using pixel_t = typename View::value_type;
+ using channel_t = typename channel_traits<typename element_type<pixel_t>::type>::value_type;
unsigned int s = detail::unsigned_integral_num_bits< channel_t >::value;
@@ -114,9 +156,9 @@ bool compare_channel_sizes( const channel_sizes_t& channel_sizes // in bits
, mpl::true_ // is_homogeneous
)
{
- typedef typename View::reference ref_t;
+ using ref_t = typename View::reference;
- typedef typename channel_traits< typename element_type< ref_t >::type >::value_type channel_t;
+ using channel_t = typename channel_traits<typename element_type<ref_t>::type>::value_type;
channel_t c;
unsigned int s = detail::unsigned_integral_num_bits< channel_t >::value;
@@ -148,10 +190,10 @@ template< typename T >
struct channel_sizes_type {};
template< typename B, typename C, typename L, bool M >
-struct channel_sizes_type< bit_aligned_pixel_reference< B, C, L, M > > { typedef C type; };
+struct channel_sizes_type< bit_aligned_pixel_reference< B, C, L, M > > { using type = C; };
template< typename B, typename C, typename L, bool M >
-struct channel_sizes_type< const bit_aligned_pixel_reference< B, C, L, M > > { typedef C type; };
+struct channel_sizes_type< const bit_aligned_pixel_reference< B, C, L, M > > { using type = C; };
template< typename View >
bool compare_channel_sizes( channel_sizes_t& channel_sizes // in bits
@@ -161,8 +203,8 @@ bool compare_channel_sizes( channel_sizes_t& channel_sizes // in bits
{
// loop through all channels and compare
- typedef typename View::reference ref_t;
- typedef typename channel_sizes_type< ref_t >::type cs_t;
+ using ref_t = typename View::reference;
+ using cs_t = typename channel_sizes_type<ref_t>::type;
compare_channel_sizes_fn fn( &channel_sizes.front() );
mpl::for_each< cs_t >( fn );
@@ -179,11 +221,10 @@ bool is_allowed( const image_read_info< tiff_tag >& info
, info._bits_per_sample
);
- typedef typename get_pixel_type< View >::type pixel_t;
- typedef typename channel_traits<
- typename element_type< pixel_t >::type >::value_type channel_t;
+ using pixel_t = typename get_pixel_type<View>::type;
+ using channel_t = typename channel_traits<typename element_type<pixel_t>::type>::value_type;
- typedef typename num_channels< pixel_t >::value_type num_channel_t;
+ using num_channel_t = typename num_channels<pixel_t>::value_type;
const num_channel_t dst_samples_per_pixel = num_channels< pixel_t >::value;