update boost
This commit is contained in:
@@ -17,10 +17,9 @@
|
||||
#include <boost/gil/io/error.hpp>
|
||||
#include <boost/gil/io/typedefs.hpp>
|
||||
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -33,9 +32,8 @@ struct property_base
|
||||
using type = Property;
|
||||
};
|
||||
|
||||
template<typename FormatTag> struct is_format_tag : is_base_and_derived< format_tag
|
||||
, FormatTag
|
||||
> {};
|
||||
template<typename FormatTag>
|
||||
struct is_format_tag : std::is_base_of<format_tag, FormatTag> {};
|
||||
|
||||
struct image_read_settings_base
|
||||
{
|
||||
@@ -46,8 +44,8 @@ protected:
|
||||
, _dim ( 0, 0 )
|
||||
{}
|
||||
|
||||
image_read_settings_base( const point_t& top_left
|
||||
, const point_t& dim
|
||||
image_read_settings_base( point_t const& top_left
|
||||
, point_t const& dim
|
||||
)
|
||||
: _top_left( top_left )
|
||||
, _dim ( dim )
|
||||
@@ -56,8 +54,8 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
void set( const point_t& top_left
|
||||
, const point_t& dim
|
||||
void set( point_t const& top_left
|
||||
, point_t const& dim
|
||||
)
|
||||
{
|
||||
_top_left = top_left;
|
||||
@@ -71,7 +69,7 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Boolean meta function, mpl::true_ if the pixel type \a PixelType is supported
|
||||
* Boolean meta function, std::true_type if the pixel type \a PixelType is supported
|
||||
* by the image format identified with \a FormatTag.
|
||||
* \todo the name is_supported is to generic, pick something more IO realted.
|
||||
*/
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
#define BOOST_GIL_IO_CONVERSION_POLICIES_HPP
|
||||
|
||||
#include <boost/gil/image_view_factory.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/error.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{namespace gil{ namespace detail {
|
||||
namespace boost{ namespace gil { namespace detail {
|
||||
|
||||
struct read_and_no_convert
|
||||
{
|
||||
@@ -27,7 +28,7 @@ public:
|
||||
InIterator const& /*begin*/, InIterator const& /*end*/ , OutIterator /*out*/,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::not_
|
||||
mp11::mp_not
|
||||
<
|
||||
pixels_are_compatible
|
||||
<
|
||||
@@ -93,10 +94,10 @@ public:
|
||||
/// is_read_only metafunction
|
||||
/// \brief Determines if reader type is read only ( no conversion ).
|
||||
template< typename Conversion_Policy >
|
||||
struct is_read_only : mpl::false_ {};
|
||||
struct is_read_only : std::false_type {};
|
||||
|
||||
template<>
|
||||
struct is_read_only< detail::read_and_no_convert > : mpl::true_ {};
|
||||
struct is_read_only<detail::read_and_no_convert> : std::true_type {};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace gil
|
||||
|
||||
100
linx64/include/boost/gil/io/detail/dynamic.hpp
Normal file
100
linx64/include/boost/gil/io/detail/dynamic.hpp
Normal file
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// Copyright 2005-2007 Adobe Systems Incorporated
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_IO_DETAIL_DYNAMIC_HPP
|
||||
#define BOOST_GIL_IO_DETAIL_DYNAMIC_HPP
|
||||
|
||||
#include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/error.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
template <long N>
|
||||
struct construct_matched_t
|
||||
{
|
||||
template <typename ...Images, typename Pred>
|
||||
static bool apply(any_image<Images...>& img, Pred pred)
|
||||
{
|
||||
if (pred.template apply<mp11::mp_at_c<any_image<Images...>, N-1>>())
|
||||
{
|
||||
using image_t = mp11::mp_at_c<any_image<Images...>, N-1>;
|
||||
image_t x;
|
||||
img = std::move(x);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return construct_matched_t<N-1>::apply(img, pred);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct construct_matched_t<0>
|
||||
{
|
||||
template <typename ...Images, typename Pred>
|
||||
static bool apply(any_image<Images...>&, Pred) { return false; }
|
||||
};
|
||||
|
||||
// A function object that can be passed to variant2::visit.
|
||||
// Given a predicate IsSupported taking a view type and returning an boolean integral coonstant,
|
||||
// calls the apply method of OpClass with the view if the given view IsSupported, or throws an exception otherwise
|
||||
template <typename IsSupported, typename OpClass>
|
||||
class dynamic_io_fnobj
|
||||
{
|
||||
private:
|
||||
OpClass* _op;
|
||||
|
||||
template <typename View>
|
||||
void apply(View const& view, std::true_type) { _op->apply(view); }
|
||||
|
||||
template <typename View, typename Info>
|
||||
void apply(View const& view, Info const & info, const std::true_type) { _op->apply(view, info); }
|
||||
|
||||
template <typename View>
|
||||
void apply(View const& /* view */, std::false_type)
|
||||
{
|
||||
io_error("dynamic_io: unsupported view type for the given file format");
|
||||
}
|
||||
|
||||
template <typename View, typename Info >
|
||||
void apply(View const& /* view */, Info const& /* info */, const std::false_type)
|
||||
{
|
||||
io_error("dynamic_io: unsupported view type for the given file format");
|
||||
}
|
||||
|
||||
public:
|
||||
dynamic_io_fnobj(OpClass* op) : _op(op) {}
|
||||
|
||||
using result_type = void;
|
||||
|
||||
template <typename View>
|
||||
void operator()(View const& view)
|
||||
{
|
||||
apply(view, typename IsSupported::template apply<View>::type());
|
||||
}
|
||||
|
||||
template <typename View, typename Info>
|
||||
void operator()(View const& view, Info const& info)
|
||||
{
|
||||
apply(view, info, typename IsSupported::template apply<View>::type());
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Within the any_image, constructs an image with the given dimensions
|
||||
/// and a type that satisfies the given predicate
|
||||
template <typename ...Images, typename Pred>
|
||||
inline bool construct_matched(any_image<Images...>& img, Pred pred)
|
||||
{
|
||||
constexpr auto size = mp11::mp_size<any_image<Images...>>::value;
|
||||
return construct_matched_t<size>::apply(img, pred);
|
||||
}
|
||||
|
||||
} } } // namespace boost::gil::detail
|
||||
|
||||
#endif
|
||||
65
linx64/include/boost/gil/io/detail/filesystem.hpp
Normal file
65
linx64/include/boost/gil/io/detail/filesystem.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright 2022 Mateusz Loskot <mateusz at loskot dot net>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_IO_DETAIL_FILESYSTEM_HPP
|
||||
#define BOOST_GIL_IO_DETAIL_FILESYSTEM_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_GIL_IO_USE_BOOST_FILESYSTEM) && !defined(BOOST_NO_CXX17_HDR_FILESYSTEM)
|
||||
#if defined(__cpp_lib_filesystem)
|
||||
#include <filesystem>
|
||||
#define BOOST_GIL_IO_USE_STD_FILESYSTEM
|
||||
#elif defined(__cpp_lib_experimental_filesystem)
|
||||
#include <experimental/filesystem>
|
||||
#define BOOST_GIL_IO_USE_STD_FILESYSTEM
|
||||
#define BOOST_GIL_IO_USE_STD_EXPERIMENTAL_FILESYSTEM
|
||||
#endif
|
||||
#endif // !BOOST_GIL_IO_USE_BOOST_FILESYSTEM && !BOOST_NO_CXX17_HDR_FILESYSTEM
|
||||
|
||||
#if !defined(BOOST_GIL_IO_USE_STD_FILESYSTEM)
|
||||
// Disable warning: conversion to 'std::atomic<int>::__integral_type {aka int}' from 'long int' may alter its value
|
||||
#if defined(BOOST_CLANG)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif
|
||||
|
||||
#define BOOST_FILESYSTEM_VERSION 3
|
||||
#include <boost/filesystem.hpp>
|
||||
#define BOOST_GIL_IO_USE_BOOST_FILESYSTEM
|
||||
|
||||
#if defined(BOOST_CLANG)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
#if defined(BOOST_GIL_IO_USE_STD_EXPERIMENTAL_FILESYSTEM)
|
||||
namespace filesystem = std::experimental::filesystem;
|
||||
#elif defined(BOOST_GIL_IO_USE_STD_FILESYSTEM)
|
||||
namespace filesystem = std::filesystem;
|
||||
#else
|
||||
#if !defined(BOOST_GIL_IO_USE_BOOST_FILESYSTEM)
|
||||
#error "Boost.Filesystem is required if C++17 <filesystem> is not available"
|
||||
#endif
|
||||
namespace filesystem = boost::filesystem;
|
||||
#endif
|
||||
|
||||
}}} // namespace boost::gil::detail
|
||||
|
||||
#endif
|
||||
@@ -8,11 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_DEVICE_HPP
|
||||
#define BOOST_GIL_IO_DEVICE_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/base.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
@@ -63,19 +61,10 @@ public:
|
||||
/// Constructor
|
||||
///
|
||||
file_stream_device( const std::string& file_name
|
||||
, read_tag = read_tag()
|
||||
, read_tag tag = read_tag()
|
||||
)
|
||||
{
|
||||
FILE* file = nullptr;
|
||||
|
||||
io_error_if( ( file = fopen( file_name.c_str(), "rb" )) == nullptr
|
||||
, "file_stream_device: failed to open file"
|
||||
);
|
||||
|
||||
_file = file_ptr_t( file
|
||||
, file_deleter
|
||||
);
|
||||
}
|
||||
: file_stream_device(file_name.c_str(), tag)
|
||||
{}
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
@@ -87,7 +76,7 @@ public:
|
||||
FILE* file = nullptr;
|
||||
|
||||
io_error_if( ( file = fopen( file_name, "rb" )) == nullptr
|
||||
, "file_stream_device: failed to open file"
|
||||
, "file_stream_device: failed to open file for reading"
|
||||
);
|
||||
|
||||
_file = file_ptr_t( file
|
||||
@@ -99,19 +88,10 @@ public:
|
||||
/// Constructor
|
||||
///
|
||||
file_stream_device( const std::string& file_name
|
||||
, write_tag
|
||||
, write_tag tag
|
||||
)
|
||||
{
|
||||
FILE* file = nullptr;
|
||||
|
||||
io_error_if( ( file = fopen( file_name.c_str(), "wb" )) == nullptr
|
||||
, "file_stream_device: failed to open file"
|
||||
);
|
||||
|
||||
_file = file_ptr_t( file
|
||||
, file_deleter
|
||||
);
|
||||
}
|
||||
: file_stream_device(file_name.c_str(), tag)
|
||||
{}
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
@@ -123,7 +103,7 @@ public:
|
||||
FILE* file = nullptr;
|
||||
|
||||
io_error_if( ( file = fopen( file_name, "wb" )) == nullptr
|
||||
, "file_stream_device: failed to open file"
|
||||
, "file_stream_device: failed to open file for writing"
|
||||
);
|
||||
|
||||
_file = file_ptr_t( file
|
||||
@@ -140,8 +120,8 @@ public:
|
||||
)
|
||||
{}
|
||||
|
||||
FILE* get() { return _file.get(); }
|
||||
const FILE* get() const { return _file.get(); }
|
||||
auto get() -> FILE* { return _file.get(); }
|
||||
auto get() const -> FILE const* { return _file.get(); }
|
||||
|
||||
int getc_unchecked()
|
||||
{
|
||||
@@ -152,16 +132,15 @@ public:
|
||||
{
|
||||
int ch;
|
||||
|
||||
if(( ch = std::getc( get() )) == EOF )
|
||||
io_error( "file_stream_device: unexpected EOF" );
|
||||
io_error_if( ( ch = std::getc( get() )) == EOF
|
||||
, "file_stream_device: unexpected EOF"
|
||||
);
|
||||
|
||||
return ( char ) ch;
|
||||
}
|
||||
|
||||
///@todo: change byte_t* to void*
|
||||
std::size_t read( byte_t* data
|
||||
, std::size_t count
|
||||
)
|
||||
auto read(byte_t* data, std::size_t count) -> std::size_t
|
||||
{
|
||||
std::size_t num_elements = fread( data
|
||||
, 1
|
||||
@@ -170,29 +149,27 @@ public:
|
||||
);
|
||||
|
||||
///@todo: add compiler symbol to turn error checking on and off.
|
||||
if(ferror( get() ))
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
}
|
||||
io_error_if( ferror( get() )
|
||||
, "file_stream_device: file read error"
|
||||
);
|
||||
|
||||
//libjpeg sometimes reads blocks in 4096 bytes even when the file is smaller than that.
|
||||
//assert( num_elements == count );
|
||||
BOOST_ASSERT(num_elements > 0 );
|
||||
|
||||
//return value indicates how much was actually read
|
||||
//returning less than "count" is not an error
|
||||
return num_elements;
|
||||
}
|
||||
|
||||
/// Reads array
|
||||
template< typename T
|
||||
, int N
|
||||
>
|
||||
std::size_t read( T (&buf)[N] )
|
||||
template< typename T, int N>
|
||||
void read( T (&buf)[N] )
|
||||
{
|
||||
return read( buf, N );
|
||||
io_error_if( read( buf, N ) < N
|
||||
, "file_stream_device: file read error"
|
||||
);
|
||||
}
|
||||
|
||||
/// Reads byte
|
||||
uint8_t read_uint8() throw()
|
||||
uint8_t read_uint8()
|
||||
{
|
||||
byte_t m[1];
|
||||
|
||||
@@ -201,7 +178,7 @@ public:
|
||||
}
|
||||
|
||||
/// Reads 16 bit little endian integer
|
||||
uint16_t read_uint16() throw()
|
||||
uint16_t read_uint16()
|
||||
{
|
||||
byte_t m[2];
|
||||
|
||||
@@ -210,7 +187,7 @@ public:
|
||||
}
|
||||
|
||||
/// Reads 32 bit little endian integer
|
||||
uint32_t read_uint32() throw()
|
||||
uint32_t read_uint32()
|
||||
{
|
||||
byte_t m[4];
|
||||
|
||||
@@ -220,10 +197,7 @@ public:
|
||||
|
||||
/// Writes number of elements from a buffer
|
||||
template < typename T >
|
||||
std::size_t write( const T* buf
|
||||
, std::size_t count
|
||||
)
|
||||
throw()
|
||||
auto write(T const* buf, std::size_t count) -> std::size_t
|
||||
{
|
||||
std::size_t num_elements = fwrite( buf
|
||||
, buff_item<T>::size
|
||||
@@ -231,7 +205,8 @@ public:
|
||||
, get()
|
||||
);
|
||||
|
||||
BOOST_ASSERT(num_elements == count);
|
||||
//return value indicates how much was actually written
|
||||
//returning less than "count" is not an error
|
||||
return num_elements;
|
||||
}
|
||||
|
||||
@@ -239,20 +214,23 @@ public:
|
||||
template < typename T
|
||||
, std::size_t N
|
||||
>
|
||||
std::size_t write( const T (&buf)[N] ) throw()
|
||||
void write( const T (&buf)[N] )
|
||||
{
|
||||
return write( buf, N );
|
||||
io_error_if( write( buf, N ) < N
|
||||
, "file_stream_device: file write error"
|
||||
);
|
||||
return ;
|
||||
}
|
||||
|
||||
/// Writes byte
|
||||
void write_uint8( uint8_t x ) throw()
|
||||
void write_uint8( uint8_t x )
|
||||
{
|
||||
byte_t m[1] = { x };
|
||||
write(m);
|
||||
}
|
||||
|
||||
/// Writes 16 bit little endian integer
|
||||
void write_uint16( uint16_t x ) throw()
|
||||
void write_uint16( uint16_t x )
|
||||
{
|
||||
byte_t m[2];
|
||||
|
||||
@@ -263,7 +241,7 @@ public:
|
||||
}
|
||||
|
||||
/// Writes 32 bit little endian integer
|
||||
void write_uint32( uint32_t x ) throw()
|
||||
void write_uint32( uint32_t x )
|
||||
{
|
||||
byte_t m[4];
|
||||
|
||||
@@ -281,7 +259,7 @@ public:
|
||||
, count
|
||||
, whence
|
||||
) != 0
|
||||
, "file read error"
|
||||
, "file_stream_device: file seek error"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -290,7 +268,7 @@ public:
|
||||
long int pos = ftell( get() );
|
||||
|
||||
io_error_if( pos == -1L
|
||||
, "file read error"
|
||||
, "file_stream_device: file position error"
|
||||
);
|
||||
|
||||
return pos;
|
||||
@@ -310,8 +288,9 @@ public:
|
||||
, get()
|
||||
);
|
||||
|
||||
BOOST_ASSERT(num_elements == line.size());
|
||||
boost::ignore_unused(num_elements);
|
||||
io_error_if( num_elements < line.size()
|
||||
, "file_stream_device: line print error"
|
||||
);
|
||||
}
|
||||
|
||||
int error()
|
||||
@@ -345,11 +324,10 @@ public:
|
||||
istream_device( std::istream& in )
|
||||
: _in( in )
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
// does the file exists?
|
||||
io_error("Stream is not valid.");
|
||||
}
|
||||
// does the file exists?
|
||||
io_error_if( !in
|
||||
, "istream_device: Stream is not valid."
|
||||
);
|
||||
}
|
||||
|
||||
int getc_unchecked()
|
||||
@@ -361,8 +339,9 @@ public:
|
||||
{
|
||||
int ch;
|
||||
|
||||
if(( ch = _in.get() ) == EOF )
|
||||
io_error( "file_stream_device: unexpected EOF" );
|
||||
io_error_if( ( ch = _in.get() ) == EOF
|
||||
, "istream_device: unexpected EOF"
|
||||
);
|
||||
|
||||
return ( char ) ch;
|
||||
}
|
||||
@@ -388,16 +367,14 @@ public:
|
||||
}
|
||||
|
||||
/// Reads array
|
||||
template< typename T
|
||||
, int N
|
||||
>
|
||||
size_t read( T (&buf)[N] )
|
||||
template<typename T, int N>
|
||||
void read(T (&buf)[N])
|
||||
{
|
||||
return read( buf, N );
|
||||
read(buf, N);
|
||||
}
|
||||
|
||||
/// Reads byte
|
||||
uint8_t read_uint8() throw()
|
||||
uint8_t read_uint8()
|
||||
{
|
||||
byte_t m[1];
|
||||
|
||||
@@ -406,7 +383,7 @@ public:
|
||||
}
|
||||
|
||||
/// Reads 16 bit little endian integer
|
||||
uint16_t read_uint16() throw()
|
||||
uint16_t read_uint16()
|
||||
{
|
||||
byte_t m[2];
|
||||
|
||||
@@ -415,7 +392,7 @@ public:
|
||||
}
|
||||
|
||||
/// Reads 32 bit little endian integer
|
||||
uint32_t read_uint32() throw()
|
||||
uint32_t read_uint32()
|
||||
{
|
||||
byte_t m[4];
|
||||
|
||||
@@ -434,7 +411,7 @@ public:
|
||||
|
||||
void write(const byte_t*, std::size_t)
|
||||
{
|
||||
io_error( "Bad io error." );
|
||||
io_error( "istream_device: Bad io error." );
|
||||
}
|
||||
|
||||
void flush() {}
|
||||
@@ -458,7 +435,7 @@ public:
|
||||
|
||||
std::size_t read(byte_t *, std::size_t)
|
||||
{
|
||||
io_error( "Bad io error." );
|
||||
io_error( "ostream_device: Bad io error." );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -485,20 +462,20 @@ public:
|
||||
template < typename T
|
||||
, std::size_t N
|
||||
>
|
||||
void write( const T (&buf)[N] ) throw()
|
||||
void write( const T (&buf)[N] )
|
||||
{
|
||||
write( buf, N );
|
||||
}
|
||||
|
||||
/// Writes byte
|
||||
void write_uint8( uint8_t x ) throw()
|
||||
void write_uint8( uint8_t x )
|
||||
{
|
||||
byte_t m[1] = { x };
|
||||
write(m);
|
||||
}
|
||||
|
||||
/// Writes 16 bit little endian integer
|
||||
void write_uint16( uint16_t x ) throw()
|
||||
void write_uint16( uint16_t x )
|
||||
{
|
||||
byte_t m[2];
|
||||
|
||||
@@ -509,7 +486,7 @@ public:
|
||||
}
|
||||
|
||||
/// Writes 32 bit little endian integer
|
||||
void write_uint32( uint32_t x ) throw()
|
||||
void write_uint32( uint32_t x )
|
||||
{
|
||||
byte_t m[4];
|
||||
|
||||
@@ -544,15 +521,15 @@ private:
|
||||
* Metafunction to detect input devices.
|
||||
* Should be replaced by an external facility in the future.
|
||||
*/
|
||||
template< typename IODevice > struct is_input_device : mpl::false_{};
|
||||
template< typename FormatTag > struct is_input_device< file_stream_device< FormatTag > > : mpl::true_{};
|
||||
template< typename FormatTag > struct is_input_device< istream_device< FormatTag > > : mpl::true_{};
|
||||
template< typename IODevice > struct is_input_device : std::false_type{};
|
||||
template< typename FormatTag > struct is_input_device< file_stream_device< FormatTag > > : std::true_type{};
|
||||
template< typename FormatTag > struct is_input_device< istream_device< FormatTag > > : std::true_type{};
|
||||
|
||||
template< typename FormatTag
|
||||
, typename T
|
||||
, typename D = void
|
||||
>
|
||||
struct is_adaptable_input_device : mpl::false_{};
|
||||
struct is_adaptable_input_device : std::false_type{};
|
||||
|
||||
template <typename FormatTag, typename T>
|
||||
struct is_adaptable_input_device
|
||||
@@ -561,13 +538,13 @@ struct is_adaptable_input_device
|
||||
T,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::or_
|
||||
mp11::mp_or
|
||||
<
|
||||
is_base_and_derived<std::istream, T>,
|
||||
is_same<std::istream, T>
|
||||
std::is_base_of<std::istream, T>,
|
||||
std::is_same<std::istream, T>
|
||||
>::value
|
||||
>::type
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{
|
||||
using device_type = istream_device<FormatTag>;
|
||||
};
|
||||
@@ -577,7 +554,7 @@ struct is_adaptable_input_device< FormatTag
|
||||
, FILE*
|
||||
, void
|
||||
>
|
||||
: mpl::true_
|
||||
: std::true_type
|
||||
{
|
||||
using device_type = file_stream_device<FormatTag>;
|
||||
};
|
||||
@@ -589,7 +566,7 @@ template< typename FormatTag
|
||||
, typename T
|
||||
, typename D = void
|
||||
>
|
||||
struct is_read_device : mpl::false_
|
||||
struct is_read_device : std::false_type
|
||||
{};
|
||||
|
||||
template <typename FormatTag, typename T>
|
||||
@@ -599,13 +576,13 @@ struct is_read_device
|
||||
T,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::or_
|
||||
mp11::mp_or
|
||||
<
|
||||
is_input_device<FormatTag>,
|
||||
is_adaptable_input_device<FormatTag, T>
|
||||
>::value
|
||||
>::type
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
@@ -614,16 +591,16 @@ struct is_read_device
|
||||
* Metafunction to detect output devices.
|
||||
* Should be replaced by an external facility in the future.
|
||||
*/
|
||||
template<typename IODevice> struct is_output_device : mpl::false_{};
|
||||
template<typename IODevice> struct is_output_device : std::false_type{};
|
||||
|
||||
template< typename FormatTag > struct is_output_device< file_stream_device< FormatTag > > : mpl::true_{};
|
||||
template< typename FormatTag > struct is_output_device< ostream_device < FormatTag > > : mpl::true_{};
|
||||
template< typename FormatTag > struct is_output_device< file_stream_device< FormatTag > > : std::true_type{};
|
||||
template< typename FormatTag > struct is_output_device< ostream_device < FormatTag > > : std::true_type{};
|
||||
|
||||
template< typename FormatTag
|
||||
, typename IODevice
|
||||
, typename D = void
|
||||
>
|
||||
struct is_adaptable_output_device : mpl::false_ {};
|
||||
struct is_adaptable_output_device : std::false_type {};
|
||||
|
||||
template <typename FormatTag, typename T>
|
||||
struct is_adaptable_output_device
|
||||
@@ -632,19 +609,19 @@ struct is_adaptable_output_device
|
||||
T,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::or_
|
||||
mp11::mp_or
|
||||
<
|
||||
is_base_and_derived<std::ostream, T>,
|
||||
is_same<std::ostream, T>
|
||||
std::is_base_of<std::ostream, T>,
|
||||
std::is_same<std::ostream, T>
|
||||
>::value
|
||||
>::type
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{
|
||||
using device_type = ostream_device<FormatTag>;
|
||||
};
|
||||
|
||||
template<typename FormatTag> struct is_adaptable_output_device<FormatTag,FILE*,void>
|
||||
: mpl::true_
|
||||
: std::true_type
|
||||
{
|
||||
using device_type = file_stream_device<FormatTag>;
|
||||
};
|
||||
@@ -657,7 +634,7 @@ template< typename FormatTag
|
||||
, typename T
|
||||
, typename D = void
|
||||
>
|
||||
struct is_write_device : mpl::false_
|
||||
struct is_write_device : std::false_type
|
||||
{};
|
||||
|
||||
template <typename FormatTag, typename T>
|
||||
@@ -667,13 +644,13 @@ struct is_write_device
|
||||
T,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::or_
|
||||
mp11::mp_or
|
||||
<
|
||||
is_output_device<FormatTag>,
|
||||
is_adaptable_output_device<FormatTag, T>
|
||||
>::value
|
||||
>::type
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
@@ -691,7 +668,7 @@ template< typename Device, typename FormatTag, typename Log = no_log > class dyn
|
||||
namespace detail {
|
||||
|
||||
template< typename T >
|
||||
struct is_reader : mpl::false_
|
||||
struct is_reader : std::false_type
|
||||
{};
|
||||
|
||||
template< typename Device
|
||||
@@ -702,11 +679,11 @@ struct is_reader< reader< Device
|
||||
, FormatTag
|
||||
, ConversionPolicy
|
||||
>
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{};
|
||||
|
||||
template< typename T >
|
||||
struct is_dynamic_image_reader : mpl::false_
|
||||
struct is_dynamic_image_reader : std::false_type
|
||||
{};
|
||||
|
||||
template< typename Device
|
||||
@@ -715,11 +692,11 @@ template< typename Device
|
||||
struct is_dynamic_image_reader< dynamic_image_reader< Device
|
||||
, FormatTag
|
||||
>
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{};
|
||||
|
||||
template< typename T >
|
||||
struct is_writer : mpl::false_
|
||||
struct is_writer : std::false_type
|
||||
{};
|
||||
|
||||
template< typename Device
|
||||
@@ -728,11 +705,11 @@ template< typename Device
|
||||
struct is_writer< writer< Device
|
||||
, FormatTag
|
||||
>
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{};
|
||||
|
||||
template< typename T >
|
||||
struct is_dynamic_image_writer : mpl::false_
|
||||
struct is_dynamic_image_writer : std::false_type
|
||||
{};
|
||||
|
||||
template< typename Device
|
||||
@@ -741,7 +718,7 @@ template< typename Device
|
||||
struct is_dynamic_image_writer< dynamic_image_writer< Device
|
||||
, FormatTag
|
||||
>
|
||||
> : mpl::true_
|
||||
> : std::true_type
|
||||
{};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
//
|
||||
// Copyright 2005-2007 Adobe Systems Incorporated
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP
|
||||
#define BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP
|
||||
|
||||
#include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
|
||||
|
||||
#include <boost/gil/io/error.hpp>
|
||||
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <long N>
|
||||
struct construct_matched_t {
|
||||
template <typename Images,typename Pred>
|
||||
static bool apply(any_image<Images>& im,Pred pred) {
|
||||
if (pred.template apply<typename mpl::at_c<Images,N-1>::type>()) {
|
||||
typename mpl::at_c<Images,N-1>::type x;
|
||||
im = std::move(x);
|
||||
return true;
|
||||
} else return construct_matched_t<N-1>::apply(im,pred);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct construct_matched_t<0> {
|
||||
template <typename Images,typename Pred>
|
||||
static bool apply(any_image<Images>&,Pred) {return false;}
|
||||
};
|
||||
|
||||
// A function object that can be passed to apply_operation.
|
||||
// Given a predicate IsSupported taking a view type and returning an MPL boolean,
|
||||
// calls the apply method of OpClass with the view if the given view IsSupported, or throws an exception otherwise
|
||||
template <typename IsSupported, typename OpClass>
|
||||
class dynamic_io_fnobj {
|
||||
OpClass* _op;
|
||||
|
||||
template <typename View>
|
||||
void apply(const View& view,mpl::true_ ) {_op->apply(view);}
|
||||
|
||||
template <typename View, typename Info >
|
||||
void apply( const View& view
|
||||
, const Info& info
|
||||
, const mpl::true_
|
||||
)
|
||||
{
|
||||
_op->apply( view, info );
|
||||
}
|
||||
|
||||
template <typename View>
|
||||
void apply(const View& /* view */ ,mpl::false_) {io_error("dynamic_io: unsupported view type for the given file format");}
|
||||
|
||||
template <typename View, typename Info >
|
||||
void apply( const View& /* view */
|
||||
, const Info& /* info */
|
||||
, const mpl::false_
|
||||
)
|
||||
{
|
||||
io_error( "dynamic_io: unsupported view type for the given file format" );
|
||||
}
|
||||
|
||||
public:
|
||||
dynamic_io_fnobj(OpClass* op) : _op(op) {}
|
||||
|
||||
using result_type = void;
|
||||
|
||||
template <typename View>
|
||||
void operator()(const View& view) {apply(view,typename IsSupported::template apply<View>::type());}
|
||||
|
||||
template< typename View, typename Info >
|
||||
void operator()(const View& view, const Info& info )
|
||||
{
|
||||
apply( view
|
||||
, info
|
||||
, typename IsSupported::template apply< View >::type()
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief Within the any_image, constructs an image with the given dimensions
|
||||
/// and a type that satisfies the given predicate
|
||||
template <typename Images,typename Pred>
|
||||
inline bool construct_matched(any_image<Images>& im,Pred pred) {
|
||||
return detail::construct_matched_t<mpl::size<Images>::value>::apply(im,pred);
|
||||
}
|
||||
|
||||
} } // namespace boost::gil
|
||||
|
||||
#endif
|
||||
@@ -8,11 +8,10 @@
|
||||
#ifndef BOOST_GIL_IO_GET_READ_DEVICE_HPP
|
||||
#define BOOST_GIL_IO_GET_READ_DEVICE_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -31,7 +30,7 @@ struct get_read_device
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -53,7 +52,7 @@ struct get_read_device
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
#define BOOST_GIL_IO_GET_READER_HPP
|
||||
|
||||
#include <boost/gil/io/get_read_device.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -34,7 +33,7 @@ struct get_reader
|
||||
ConversionPolicy,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -54,7 +53,7 @@ struct get_reader
|
||||
ConversionPolicy,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -79,7 +78,7 @@ struct get_dynamic_image_reader
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -98,7 +97,7 @@ struct get_dynamic_image_reader
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -123,7 +122,7 @@ struct get_reader_backend
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -142,7 +141,7 @@ struct get_reader_backend
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
#ifndef BOOST_GIL_IO_GET_WRITE_DEVICE_HPP
|
||||
#define BOOST_GIL_IO_GET_WRITE_DEVICE_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -27,7 +26,7 @@ struct get_write_device
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_output_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -46,7 +45,7 @@ struct get_write_device
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_GET_WRITER_HPP
|
||||
#define BOOST_GIL_IO_GET_WRITER_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_write_device.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -28,7 +27,7 @@ struct get_writer
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -47,7 +46,7 @@ struct get_writer
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_output_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -70,7 +69,7 @@ struct get_dynamic_image_writer
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -89,7 +88,7 @@ struct get_dynamic_image_writer
|
||||
FormatTag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_write_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
#ifndef BOOST_GIL_IO_MAKE_BACKEND_HPP
|
||||
#define BOOST_GIL_IO_MAKE_BACKEND_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -23,7 +22,7 @@ auto make_reader_backend(
|
||||
String const& file_name, image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -56,24 +55,22 @@ auto make_reader_backend(
|
||||
return reader_backend<device_t, FormatTag>(device, settings);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
auto make_reader_backend(
|
||||
filesystem::path const& path,
|
||||
detail::filesystem::path const& path,
|
||||
image_read_settings<FormatTag> const& settings)
|
||||
-> typename get_reader_backend<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_reader_backend(path.wstring(), settings);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_reader_backend(Device& io_dev, image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -92,7 +89,7 @@ inline
|
||||
auto make_reader_backend(String const& file_name, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -108,7 +105,7 @@ inline
|
||||
auto make_reader_backend(Device& io_dev, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_READER_HPP
|
||||
#define BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_READER_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -22,7 +21,7 @@ auto make_dynamic_image_reader(
|
||||
String const& file_name, image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -55,16 +54,14 @@ auto make_dynamic_image_reader(
|
||||
typename get_dynamic_image_reader<std::wstring, FormatTag>::type(device, settings);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
auto make_dynamic_image_reader(
|
||||
filesystem::path const& path, image_read_settings<FormatTag> const& settings)
|
||||
detail::filesystem::path const& path, image_read_settings<FormatTag> const& settings)
|
||||
-> typename get_dynamic_image_reader<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_dynamic_image_reader(path.wstring(), settings);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
@@ -72,7 +69,7 @@ auto make_dynamic_image_reader(
|
||||
Device& file, image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -91,7 +88,7 @@ inline
|
||||
auto make_dynamic_image_reader(String const& file_name, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -110,22 +107,20 @@ auto make_dynamic_image_reader(std::wstring const& file_name, FormatTag const&)
|
||||
return make_dynamic_image_reader(file_name, image_read_settings<FormatTag>());
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
auto make_dynamic_image_reader(filesystem::path const& path, FormatTag const&)
|
||||
auto make_dynamic_image_reader(detail::filesystem::path const& path, FormatTag const&)
|
||||
-> typename get_dynamic_image_reader<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_dynamic_image_reader(path.wstring(), image_read_settings<FormatTag>());
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_dynamic_image_reader(Device& file, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_WRITER_HPP
|
||||
#define BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_WRITER_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_writer.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -22,7 +21,7 @@ auto make_dynamic_image_writer(
|
||||
String const& file_name, image_write_info<FormatTag> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -40,12 +39,8 @@ auto make_dynamic_image_writer(
|
||||
|
||||
template< typename FormatTag >
|
||||
inline
|
||||
typename get_dynamic_image_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_dynamic_image_writer( const std::wstring& file_name
|
||||
, const image_write_info< FormatTag >& info
|
||||
)
|
||||
auto make_dynamic_image_writer(std::wstring const& file_name, image_write_info<FormatTag> const& info)
|
||||
-> typename get_dynamic_image_writer< std::wstring, FormatTag>::type
|
||||
{
|
||||
const char* str = detail::convert_to_native_string( file_name );
|
||||
|
||||
@@ -64,28 +59,20 @@ make_dynamic_image_writer( const std::wstring& file_name
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_dynamic_image_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_dynamic_image_writer( const filesystem::path& path
|
||||
, const image_write_info< FormatTag >& info
|
||||
)
|
||||
auto make_dynamic_image_writer(detail::filesystem::path const& path, image_write_info<FormatTag> const& info)
|
||||
-> typename get_dynamic_image_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_dynamic_image_writer( path.wstring()
|
||||
, info
|
||||
);
|
||||
return make_dynamic_image_writer(path.wstring(), info);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_dynamic_image_writer(Device& file, image_write_info<FormatTag> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_adaptable_output_device<FormatTag, Device>::type,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -104,7 +91,7 @@ inline
|
||||
auto make_dynamic_image_writer(String const& file_name, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -115,43 +102,30 @@ auto make_dynamic_image_writer(String const& file_name, FormatTag const&,
|
||||
return make_dynamic_image_writer(file_name, image_write_info<FormatTag>());
|
||||
}
|
||||
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_dynamic_image_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_dynamic_image_writer( const std::wstring& file_name
|
||||
, const FormatTag&
|
||||
)
|
||||
auto make_dynamic_image_writer(std::wstring const& file_name, FormatTag const&)
|
||||
-> typename get_dynamic_image_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_dynamic_image_writer( file_name
|
||||
, image_write_info< FormatTag >()
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_dynamic_image_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_dynamic_image_writer( const filesystem::path& path
|
||||
, const FormatTag&
|
||||
)
|
||||
auto make_dynamic_image_writer(detail::filesystem::path const& path, FormatTag const&)
|
||||
-> typename get_dynamic_image_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_dynamic_image_writer( path.wstring()
|
||||
, image_write_info< FormatTag >()
|
||||
);
|
||||
return make_dynamic_image_writer(path.wstring(), image_write_info<FormatTag>());
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_dynamic_image_writer(Device& file, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_adaptable_output_device<FormatTag, Device>::type,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_MAKE_READER_HPP
|
||||
#define BOOST_GIL_IO_MAKE_READER_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -24,7 +23,7 @@ auto make_reader(
|
||||
ConversionPolicy const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -40,18 +39,10 @@ auto make_reader(
|
||||
typename get_reader<String, FormatTag, ConversionPolicy>::type(device, settings);
|
||||
}
|
||||
|
||||
template< typename FormatTag
|
||||
, typename ConversionPolicy
|
||||
>
|
||||
template <typename FormatTag, typename ConversionPolicy>
|
||||
inline
|
||||
typename get_reader< std::wstring
|
||||
, FormatTag
|
||||
, ConversionPolicy
|
||||
>::type
|
||||
make_reader( const std::wstring& file_name
|
||||
, const image_read_settings< FormatTag >& settings
|
||||
, const ConversionPolicy&
|
||||
)
|
||||
auto make_reader(std::wstring const &file_name, image_read_settings<FormatTag> const& settings, ConversionPolicy const&)
|
||||
-> typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
|
||||
{
|
||||
const char* str = detail::convert_to_native_string( file_name );
|
||||
|
||||
@@ -71,26 +62,13 @@ make_reader( const std::wstring& file_name
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag
|
||||
, typename ConversionPolicy
|
||||
>
|
||||
template <typename FormatTag, typename ConversionPolicy>
|
||||
inline
|
||||
typename get_reader< std::wstring
|
||||
, FormatTag
|
||||
, ConversionPolicy
|
||||
>::type
|
||||
make_reader( const filesystem::path& path
|
||||
, const image_read_settings< FormatTag >& settings
|
||||
, const ConversionPolicy& cc
|
||||
)
|
||||
auto make_reader(detail::filesystem::path const& path, image_read_settings<FormatTag> const& settings, ConversionPolicy const& cc)
|
||||
-> typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
|
||||
{
|
||||
return make_reader( path.wstring()
|
||||
, settings
|
||||
, cc
|
||||
);
|
||||
return make_reader(path.wstring(), settings, cc);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag, typename ConversionPolicy>
|
||||
inline
|
||||
@@ -100,7 +78,7 @@ auto make_reader(
|
||||
ConversionPolicy const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -124,7 +102,7 @@ auto make_reader(
|
||||
ConversionPolicy const& cc,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -135,18 +113,10 @@ auto make_reader(
|
||||
return make_reader(file_name, image_read_settings<FormatTag>(), cc);
|
||||
}
|
||||
|
||||
template< typename FormatTag
|
||||
, typename ConversionPolicy
|
||||
>
|
||||
template <typename FormatTag, typename ConversionPolicy>
|
||||
inline
|
||||
typename get_reader< std::wstring
|
||||
, FormatTag
|
||||
, ConversionPolicy
|
||||
>::type
|
||||
make_reader( const std::wstring& file_name
|
||||
, const FormatTag&
|
||||
, const ConversionPolicy& cc
|
||||
)
|
||||
auto make_reader(std::wstring const &file_name, FormatTag const&, ConversionPolicy const& cc)
|
||||
-> typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
|
||||
{
|
||||
return make_reader( file_name
|
||||
, image_read_settings< FormatTag >()
|
||||
@@ -154,26 +124,13 @@ make_reader( const std::wstring& file_name
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag
|
||||
, typename ConversionPolicy
|
||||
>
|
||||
template <typename FormatTag, typename ConversionPolicy>
|
||||
inline
|
||||
typename get_reader< std::wstring
|
||||
, FormatTag
|
||||
, ConversionPolicy
|
||||
>::type
|
||||
make_reader( const filesystem::path& path
|
||||
, const FormatTag&
|
||||
, const ConversionPolicy& cc
|
||||
)
|
||||
auto make_reader(detail::filesystem::path const& path, FormatTag const&, ConversionPolicy const& cc)
|
||||
-> typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
|
||||
{
|
||||
return make_reader( path.wstring()
|
||||
, image_read_settings< FormatTag >()
|
||||
, cc
|
||||
);
|
||||
return make_reader(path.wstring(), image_read_settings<FormatTag>(), cc);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag, typename ConversionPolicy>
|
||||
inline
|
||||
@@ -183,7 +140,7 @@ auto make_reader(
|
||||
ConversionPolicy const& cc,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_MAKE_SCANLINE_READER_HPP
|
||||
#define BOOST_GIL_IO_MAKE_SCANLINE_READER_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -21,7 +20,7 @@ inline
|
||||
auto make_scanline_reader(String const& file_name, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -38,14 +37,10 @@ auto make_scanline_reader(String const& file_name, FormatTag const&,
|
||||
device, image_read_settings<FormatTag>());
|
||||
}
|
||||
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_scanline_reader< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_scanline_reader( const std::wstring& file_name
|
||||
, FormatTag const&
|
||||
)
|
||||
auto make_scanline_reader(std::wstring const& file_name, FormatTag const&)
|
||||
-> typename get_scanline_reader<std::wstring, FormatTag>::type
|
||||
{
|
||||
const char* str = detail::convert_to_native_string( file_name );
|
||||
|
||||
@@ -64,28 +59,20 @@ make_scanline_reader( const std::wstring& file_name
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_scanline_reader< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_scanline_reader( const filesystem::path& path
|
||||
, FormatTag const&
|
||||
)
|
||||
auto make_scanline_reader(detail::filesystem::path const& path, FormatTag const&)
|
||||
-> typename get_scanline_reader<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_scanline_reader( path.wstring()
|
||||
, image_read_settings< FormatTag >()
|
||||
);
|
||||
return make_scanline_reader(path.wstring(), image_read_settings<FormatTag>());
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_scanline_reader(Device& io_dev, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#ifndef BOOST_GIL_IO_MAKE_WRITER_HPP
|
||||
#define BOOST_GIL_IO_MAKE_WRITER_HPP
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/get_writer.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -21,7 +20,7 @@ inline
|
||||
auto make_writer(String const& file_name, image_write_info<FormatTag> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -35,14 +34,10 @@ auto make_writer(String const& file_name, image_write_info<FormatTag> const& inf
|
||||
return typename get_writer<String, FormatTag>::type(device, info);
|
||||
}
|
||||
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_writer( const std::wstring& file_name
|
||||
, const image_write_info< FormatTag >& info
|
||||
)
|
||||
auto make_writer(std::wstring const& file_name, image_write_info<FormatTag> const& info)
|
||||
-> typename get_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
const char* str = detail::convert_to_native_string( file_name );
|
||||
|
||||
@@ -61,28 +56,20 @@ make_writer( const std::wstring& file_name
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_writer( const filesystem::path& path
|
||||
, const image_write_info< FormatTag >& info
|
||||
)
|
||||
auto make_writer(detail::filesystem::path const& path, image_write_info<FormatTag> const& info)
|
||||
-> typename get_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_writer( path.wstring()
|
||||
, info
|
||||
);
|
||||
return make_writer(path.wstring(), info);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_writer(Device& file, image_write_info<FormatTag> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_adaptable_output_device<FormatTag, Device>::type,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -101,7 +88,7 @@ inline
|
||||
auto make_writer(String const& file_name, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -112,42 +99,30 @@ auto make_writer(String const& file_name, FormatTag const&,
|
||||
return make_writer(file_name, image_write_info<FormatTag>());
|
||||
}
|
||||
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_writer( const std::wstring& file_name
|
||||
, const FormatTag&
|
||||
)
|
||||
auto make_writer(std::wstring const &file_name, FormatTag const&)
|
||||
-> typename get_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_writer( file_name
|
||||
, image_write_info< FormatTag >()
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template< typename FormatTag >
|
||||
template <typename FormatTag>
|
||||
inline
|
||||
typename get_writer< std::wstring
|
||||
, FormatTag
|
||||
>::type
|
||||
make_writer( const filesystem::path& path
|
||||
, const FormatTag& tag
|
||||
)
|
||||
auto make_writer(detail::filesystem::path const& path, FormatTag const& tag)
|
||||
-> typename get_writer<std::wstring, FormatTag>::type
|
||||
{
|
||||
return make_writer( path.wstring()
|
||||
, tag
|
||||
);
|
||||
return make_writer(path.wstring(), tag);
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
template <typename Device, typename FormatTag>
|
||||
inline
|
||||
auto make_writer(Device& file, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_adaptable_output_device<FormatTag, Device>::type,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -8,61 +8,31 @@
|
||||
#ifndef BOOST_GIL_IO_PATH_SPEC_HPP
|
||||
#define BOOST_GIL_IO_PATH_SPEC_HPP
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
// Disable warning: conversion to 'std::atomic<int>::__integral_type {aka int}' from 'long int' may alter its value
|
||||
#if defined(BOOST_CLANG)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif
|
||||
|
||||
#define BOOST_FILESYSTEM_VERSION 3
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#if defined(BOOST_CLANG)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
#include <boost/mpl/bool.hpp> // for complete types of true_ and false_
|
||||
#include <boost/gil/io/detail/filesystem.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
template<typename P> struct is_supported_path_spec : mpl::false_ {};
|
||||
template<> struct is_supported_path_spec< std::string > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< const std::string > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< std::wstring > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< const std::wstring > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< const char* > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< char* > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< const wchar_t* > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< wchar_t* > : mpl::true_ {};
|
||||
template<typename P> struct is_supported_path_spec : std::false_type {};
|
||||
template<> struct is_supported_path_spec< std::string > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< const std::string > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< std::wstring > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< const std::wstring > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< char const* > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< char* > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< const wchar_t* > : std::true_type {};
|
||||
template<> struct is_supported_path_spec< wchar_t* > : std::true_type {};
|
||||
|
||||
template<int i> struct is_supported_path_spec<const char [i]> : mpl::true_ {};
|
||||
template<int i> struct is_supported_path_spec<char [i]> : mpl::true_ {};
|
||||
template<int i> struct is_supported_path_spec<const wchar_t [i]> : mpl::true_ {};
|
||||
template<int i> struct is_supported_path_spec<wchar_t [i]> : mpl::true_ {};
|
||||
template<int i> struct is_supported_path_spec<const char [i]> : std::true_type {};
|
||||
template<int i> struct is_supported_path_spec<char [i]> : std::true_type {};
|
||||
template<int i> struct is_supported_path_spec<const wchar_t [i]> : std::true_type {};
|
||||
template<int i> struct is_supported_path_spec<wchar_t [i]> : std::true_type {};
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
template<> struct is_supported_path_spec< filesystem::path > : mpl::true_ {};
|
||||
template<> struct is_supported_path_spec< const filesystem::path > : mpl::true_ {};
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
|
||||
///
|
||||
/// convert_to_string
|
||||
///
|
||||
template<> struct is_supported_path_spec<filesystem::path> : std::true_type {};
|
||||
template<> struct is_supported_path_spec<filesystem::path const> : std::true_type {};
|
||||
|
||||
inline std::string convert_to_string( std::string const& obj)
|
||||
{
|
||||
@@ -78,7 +48,7 @@ inline std::string convert_to_string( std::wstring const& s )
|
||||
return std::string( c, c + len );
|
||||
}
|
||||
|
||||
inline std::string convert_to_string( const char* str )
|
||||
inline std::string convert_to_string( char const* str )
|
||||
{
|
||||
return std::string( str );
|
||||
}
|
||||
@@ -88,33 +58,27 @@ inline std::string convert_to_string( char* str )
|
||||
return std::string( str );
|
||||
}
|
||||
|
||||
#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
inline std::string convert_to_string( const filesystem::path& path )
|
||||
inline std::string convert_to_string(filesystem::path const& path)
|
||||
{
|
||||
return convert_to_string( path.string() );
|
||||
return convert_to_string(path.string());
|
||||
}
|
||||
#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
|
||||
|
||||
///
|
||||
/// convert_to_native_string
|
||||
///
|
||||
|
||||
inline const char* convert_to_native_string( char* str )
|
||||
inline char const* convert_to_native_string( char* str )
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
inline const char* convert_to_native_string( const char* str )
|
||||
inline char const* convert_to_native_string( char const* str )
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
inline const char* convert_to_native_string( const std::string& str )
|
||||
inline char const* convert_to_native_string( const std::string& str )
|
||||
{
|
||||
return str.c_str();
|
||||
}
|
||||
|
||||
inline const char* convert_to_native_string( const wchar_t* str )
|
||||
inline char const* convert_to_native_string( const wchar_t* str )
|
||||
{
|
||||
std::size_t len = wcslen( str ) + 1;
|
||||
char* c = new char[len];
|
||||
@@ -123,7 +87,7 @@ inline const char* convert_to_native_string( const wchar_t* str )
|
||||
return c;
|
||||
}
|
||||
|
||||
inline const char* convert_to_native_string( const std::wstring& str )
|
||||
inline char const* convert_to_native_string( std::wstring const& str )
|
||||
{
|
||||
std::size_t len = wcslen( str.c_str() ) + 1;
|
||||
char* c = new char[len];
|
||||
@@ -132,8 +96,6 @@ inline const char* convert_to_native_string( const std::wstring& str )
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
}}} // namespace boost::gil::detail
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -34,7 +32,7 @@ inline
|
||||
void read_and_convert_image(Reader& reader, Image& img,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_reader<Reader>,
|
||||
is_format_tag<typename Reader::format_tag_t>
|
||||
@@ -60,7 +58,7 @@ void read_and_convert_image(
|
||||
ColorConverter const& cc,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -89,7 +87,7 @@ void read_and_convert_image(
|
||||
ColorConverter const& cc,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -118,7 +116,7 @@ void read_and_convert_image(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -147,7 +145,7 @@ void read_and_convert_image(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -173,7 +171,7 @@ inline void read_and_convert_image(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -199,7 +197,7 @@ inline void read_and_convert_image(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -226,7 +224,7 @@ void read_and_convert_image(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -252,7 +250,7 @@ inline void read_and_convert_image(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -34,7 +32,7 @@ inline
|
||||
void read_and_convert_view(Reader& reader, View const& view,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_reader<Reader>,
|
||||
is_format_tag<typename Reader::format_tag_t>
|
||||
@@ -61,7 +59,7 @@ void read_and_convert_view(
|
||||
ColorConverter const& cc,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -90,7 +88,7 @@ void read_and_convert_view(
|
||||
ColorConverter const& cc,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -119,7 +117,7 @@ void read_and_convert_view(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -148,7 +146,7 @@ void read_and_convert_view(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -175,7 +173,7 @@ void read_and_convert_view(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -202,7 +200,7 @@ void read_and_convert_view(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -229,7 +227,7 @@ void read_and_convert_view(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -256,7 +254,7 @@ void read_and_convert_view(
|
||||
FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -34,7 +32,7 @@ inline
|
||||
void read_image(Reader reader, Image& img,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_reader<Reader>,
|
||||
is_format_tag<typename Reader::format_tag_t>,
|
||||
@@ -63,7 +61,7 @@ void read_image(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>,
|
||||
@@ -92,7 +90,7 @@ inline
|
||||
void read_image(Device& file, Image& img, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>,
|
||||
@@ -124,7 +122,7 @@ void read_image(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>,
|
||||
@@ -153,7 +151,7 @@ inline
|
||||
void read_image(String const& file_name, Image& img, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_<detail::is_supported_path_spec<String>,
|
||||
mp11::mp_and<detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>,
|
||||
is_read_supported
|
||||
<
|
||||
@@ -172,12 +170,12 @@ void read_image(String const& file_name, Image& img, FormatTag const& tag,
|
||||
|
||||
///
|
||||
|
||||
template <typename Reader, typename Images>
|
||||
template <typename Reader, typename ...Images>
|
||||
inline
|
||||
void read_image(Reader& reader, any_image<Images>& images,
|
||||
void read_image(Reader& reader, any_image<Images...>& images,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_dynamic_image_reader<Reader>,
|
||||
is_format_tag<typename Reader::format_tag_t>
|
||||
@@ -189,18 +187,18 @@ void read_image(Reader& reader, any_image<Images>& images,
|
||||
|
||||
/// \brief Reads an image without conversion. Image memory is allocated.
|
||||
/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
|
||||
/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
|
||||
/// \param images Dynamic image (mp11::mp_list). See boost::gil::dynamic_image extension.
|
||||
/// \param settings Specifies read settings depending on the image format.
|
||||
/// \throw std::ios_base::failure
|
||||
template <typename Device, typename Images, typename FormatTag>
|
||||
template <typename Device, typename ...Images, typename FormatTag>
|
||||
inline
|
||||
void read_image(
|
||||
Device& file,
|
||||
any_image<Images>& images,
|
||||
any_image<Images...>& images,
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -215,15 +213,15 @@ void read_image(
|
||||
|
||||
/// \brief Reads an image without conversion. Image memory is allocated.
|
||||
/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
|
||||
/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
|
||||
/// \param images Dynamic image (mp11::mp_list). See boost::gil::dynamic_image extension.
|
||||
/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
|
||||
/// \throw std::ios_base::failure
|
||||
template <typename Device, typename Images, typename FormatTag>
|
||||
template <typename Device, typename ...Images, typename FormatTag>
|
||||
inline
|
||||
void read_image(Device& file, any_image<Images>& images, FormatTag const& tag,
|
||||
void read_image(Device& file, any_image<Images...>& images, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -238,18 +236,18 @@ void read_image(Device& file, any_image<Images>& images, FormatTag const& tag,
|
||||
|
||||
/// \brief Reads an image without conversion. Image memory is allocated.
|
||||
/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
|
||||
/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
|
||||
/// \param images Dynamic image (mp11::mp_list). See boost::gil::dynamic_image extension.
|
||||
/// \param settings Specifies read settings depending on the image format.
|
||||
/// \throw std::ios_base::failure
|
||||
template <typename String, typename Images, typename FormatTag>
|
||||
template <typename String, typename ...Images, typename FormatTag>
|
||||
inline
|
||||
void read_image(
|
||||
String const& file_name,
|
||||
any_image<Images>& images,
|
||||
any_image<Images...>& images,
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -264,15 +262,15 @@ void read_image(
|
||||
|
||||
/// \brief Reads an image without conversion. Image memory is allocated.
|
||||
/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
|
||||
/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
|
||||
/// \param images Dynamic image (mp11::mp_list). See boost::gil::dynamic_image extension.
|
||||
/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
|
||||
/// \throw std::ios_base::failure
|
||||
template <typename String, typename Images, typename FormatTag>
|
||||
template <typename String, typename ...Images, typename FormatTag>
|
||||
inline
|
||||
void read_image(String const& file_name, any_image<Images>& images, FormatTag const& tag,
|
||||
void read_image(String const& file_name, any_image<Images...>& images, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_supported_path_spec<String>,
|
||||
is_format_tag<FormatTag>
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -32,7 +30,7 @@ inline
|
||||
auto read_image_info(Device& file, image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -53,7 +51,7 @@ inline
|
||||
auto read_image_info(Device& file, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_adaptable_input_device<FormatTag, Device>,
|
||||
is_format_tag<FormatTag>
|
||||
@@ -75,7 +73,7 @@ auto read_image_info(
|
||||
String const& file_name, image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
@@ -96,7 +94,7 @@ inline
|
||||
auto read_image_info(String const& file_name, FormatTag const&,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
is_format_tag<FormatTag>,
|
||||
detail::is_supported_path_spec<String>
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -33,7 +31,7 @@ inline
|
||||
void read_view(Reader reader, View const& view,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_reader<Reader>,
|
||||
typename is_format_tag<typename Reader::format_tag_t>::type,
|
||||
@@ -63,7 +61,7 @@ void read_view(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
@@ -92,7 +90,7 @@ inline
|
||||
void read_view(Device& file, View const& view, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
detail::is_read_device<FormatTag, Device>,
|
||||
@@ -123,7 +121,7 @@ void read_view(
|
||||
image_read_settings<FormatTag> const& settings,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_supported_path_spec<String>::type,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
@@ -152,7 +150,7 @@ inline
|
||||
void read_view(String const& file_name, View const& view, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_supported_path_spec<String>::type,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void setup( const point_t& /* dim */ )
|
||||
void setup( point_t const& /* dim */ )
|
||||
{
|
||||
//check_coordinates( dim );
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
//}
|
||||
}
|
||||
|
||||
void check_coordinates( const point_t& /* dim */ )
|
||||
void check_coordinates( point_t const& /* dim */ )
|
||||
{
|
||||
//using int_t = point_t::value_type;
|
||||
|
||||
|
||||
@@ -13,10 +13,9 @@
|
||||
#include <boost/gil/extension/toolbox/metafunctions/is_homogeneous.hpp>
|
||||
#include <boost/gil/extension/toolbox/metafunctions/pixel_bit_size.hpp>
|
||||
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
#include <boost/gil/io/typedefs.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
@@ -108,7 +107,7 @@ struct row_buffer_helper
|
||||
Pixel,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename is_bit_aligned<Pixel>::type,
|
||||
typename is_homogeneous<Pixel>::type
|
||||
|
||||
@@ -25,34 +25,23 @@ namespace boost { namespace gil {
|
||||
#endif
|
||||
|
||||
/// Input iterator to read images.
|
||||
template< typename Reader >
|
||||
class scanline_read_iterator : public boost::iterator_facade< scanline_read_iterator< Reader >
|
||||
, byte_t*
|
||||
, std::input_iterator_tag
|
||||
>
|
||||
template <typename Reader>
|
||||
class scanline_read_iterator
|
||||
: public boost::iterator_facade<scanline_read_iterator<Reader>, byte_t*, std::input_iterator_tag>
|
||||
{
|
||||
private:
|
||||
|
||||
using base_t = boost::iterator_facade
|
||||
<
|
||||
scanline_read_iterator<Reader>,
|
||||
byte_t*,
|
||||
std::input_iterator_tag
|
||||
>;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
scanline_read_iterator( Reader& reader
|
||||
, int pos = 0
|
||||
)
|
||||
: _pos( pos )
|
||||
, _read_scanline( true )
|
||||
, _skip_scanline( true )
|
||||
, _reader( reader )
|
||||
scanline_read_iterator(Reader& reader, int pos = 0)
|
||||
: reader_(reader), pos_(pos)
|
||||
{
|
||||
_buffer = std::make_shared< buffer_t >( buffer_t( _reader._scanline_length ));
|
||||
_buffer_start = &_buffer->front();
|
||||
buffer_ = std::make_shared<buffer_t>(buffer_t(reader_._scanline_length));
|
||||
buffer_start_ = &buffer_->front();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -60,52 +49,45 @@ private:
|
||||
|
||||
void increment()
|
||||
{
|
||||
if( _skip_scanline == true )
|
||||
if (skip_scanline_)
|
||||
{
|
||||
_reader.skip( _buffer_start
|
||||
, _pos
|
||||
);
|
||||
reader_.skip(buffer_start_, pos_);
|
||||
}
|
||||
|
||||
++_pos;
|
||||
++pos_;
|
||||
|
||||
_skip_scanline = true;
|
||||
_read_scanline = true;
|
||||
skip_scanline_ = true;
|
||||
read_scanline_ = true;
|
||||
}
|
||||
|
||||
bool equal( const scanline_read_iterator& rhs ) const
|
||||
bool equal(scanline_read_iterator const& rhs) const
|
||||
{
|
||||
return _pos == rhs._pos;
|
||||
return pos_ == rhs.pos_;
|
||||
}
|
||||
|
||||
typename base_t::reference dereference() const
|
||||
{
|
||||
if( _read_scanline == true )
|
||||
if (read_scanline_)
|
||||
{
|
||||
_reader.read( _buffer_start
|
||||
, _pos
|
||||
);
|
||||
reader_.read(buffer_start_, pos_);
|
||||
}
|
||||
skip_scanline_ = false;
|
||||
read_scanline_ = false;
|
||||
|
||||
_skip_scanline = false;
|
||||
_read_scanline = false;
|
||||
|
||||
return _buffer_start;
|
||||
return buffer_start_;
|
||||
}
|
||||
|
||||
private:
|
||||
Reader& _reader;
|
||||
Reader& reader_;
|
||||
|
||||
mutable int _pos;
|
||||
mutable int pos_ = 0;
|
||||
mutable bool read_scanline_ = true;
|
||||
mutable bool skip_scanline_ = true;
|
||||
|
||||
mutable bool _read_scanline;
|
||||
mutable bool _skip_scanline;
|
||||
|
||||
using buffer_t = std::vector<byte_t>;
|
||||
using buffer_t = std::vector<byte_t>;
|
||||
using buffer_ptr_t = std::shared_ptr<buffer_t>;
|
||||
|
||||
buffer_ptr_t _buffer;
|
||||
mutable byte_t* _buffer_start;
|
||||
buffer_ptr_t buffer_;
|
||||
mutable byte_t* buffer_start_ = nullptr;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
#include <boost/gil/point.hpp>
|
||||
#include <boost/gil/utilities.hpp>
|
||||
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
@@ -32,8 +31,8 @@ using byte_vector_t = std::vector<byte_t>;
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<> struct is_floating_point<gil::float32_t> : mpl::true_ {};
|
||||
template<> struct is_floating_point<gil::float64_t> : mpl::true_ {};
|
||||
template<> struct is_floating_point<gil::float32_t> : std::true_type {};
|
||||
template<> struct is_floating_point<gil::float64_t> : std::true_type {};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/get_writer.hpp>
|
||||
#include <boost/gil/io/path_spec.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -27,7 +25,7 @@ inline
|
||||
void write_view(Writer& writer, View const& view,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_writer<Writer>::type,
|
||||
typename is_format_tag<typename Writer::format_tag_t>::type,
|
||||
@@ -48,7 +46,7 @@ inline
|
||||
void write_view(Device& device, View const& view, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_write_device<FormatTag, Device>::type,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
@@ -71,7 +69,7 @@ inline
|
||||
void write_view(String const& file_name, View const& view, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_supported_path_spec<String>::type,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
@@ -95,7 +93,7 @@ void write_view(
|
||||
Device& device, View const& view, image_write_info<FormatTag, Log> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_write_device<FormatTag, Device>::type,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
@@ -119,7 +117,7 @@ void write_view(
|
||||
String const& file_name, View const& view, image_write_info<FormatTag, Log> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_supported_path_spec<String>::type,
|
||||
typename is_format_tag<FormatTag>::type,
|
||||
@@ -139,12 +137,12 @@ void write_view(
|
||||
////////////////////////////////////// dynamic_image
|
||||
|
||||
// without image_write_info
|
||||
template <typename Writer, typename Views>
|
||||
template <typename Writer, typename ...Views>
|
||||
inline
|
||||
void write_view(Writer& writer, any_image_view<Views> const& view,
|
||||
void write_view(Writer& writer, any_image_view<Views...> const& view,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_dynamic_image_writer<Writer>::type,
|
||||
typename is_format_tag<typename Writer::format_tag_t>::type
|
||||
@@ -155,13 +153,13 @@ void write_view(Writer& writer, any_image_view<Views> const& view,
|
||||
}
|
||||
|
||||
// without image_write_info
|
||||
template <typename Device, typename Views, typename FormatTag>
|
||||
template <typename Device, typename ...Views, typename FormatTag>
|
||||
inline
|
||||
void write_view(
|
||||
Device& device, any_image_view<Views> const& views, FormatTag const& tag,
|
||||
Device& device, any_image_view<Views...> const& views, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_write_device<FormatTag, Device>::type,
|
||||
typename is_format_tag<FormatTag>::type
|
||||
@@ -173,13 +171,13 @@ void write_view(
|
||||
write_view(writer, views);
|
||||
}
|
||||
|
||||
template <typename String, typename Views, typename FormatTag>
|
||||
template <typename String, typename ...Views, typename FormatTag>
|
||||
inline
|
||||
void write_view(
|
||||
String const& file_name, any_image_view<Views> const& views, FormatTag const& tag,
|
||||
String const& file_name, any_image_view<Views...> const& views, FormatTag const& tag,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_supported_path_spec<String>::type,
|
||||
typename is_format_tag<FormatTag>::type
|
||||
@@ -193,13 +191,13 @@ void write_view(
|
||||
|
||||
// with image_write_info
|
||||
/// \ingroup IO
|
||||
template <typename Device, typename Views, typename FormatTag, typename Log>
|
||||
template <typename Device, typename ...Views, typename FormatTag, typename Log>
|
||||
inline
|
||||
void write_view(
|
||||
Device& device, any_image_view<Views> const& views, image_write_info<FormatTag, Log> const& info,
|
||||
Device& device, any_image_view<Views...> const& views, image_write_info<FormatTag, Log> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_write_device<FormatTag, Device>::type,
|
||||
typename is_format_tag<FormatTag>::type
|
||||
@@ -211,13 +209,13 @@ void write_view(
|
||||
write_view(writer, views);
|
||||
}
|
||||
|
||||
template <typename String, typename Views, typename FormatTag, typename Log>
|
||||
template <typename String, typename ...Views, typename FormatTag, typename Log>
|
||||
inline
|
||||
void write_view(
|
||||
String const& file_name, any_image_view<Views> const& views, image_write_info<FormatTag, Log> const& info,
|
||||
String const& file_name, any_image_view<Views...> const& views, image_write_info<FormatTag, Log> const& info,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
typename detail::is_supported_path_spec<String>::type,
|
||||
typename is_format_tag<FormatTag>::type
|
||||
|
||||
Reference in New Issue
Block a user