8 #ifndef BOOST_GIL_IO_PATH_SPEC_HPP     9 #define BOOST_GIL_IO_PATH_SPEC_HPP    11 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    13 #if defined(BOOST_CLANG)    14 #pragma clang diagnostic push    15 #pragma clang diagnostic ignored "-Wshorten-64-to-32"    18 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)    19 #pragma GCC diagnostic push    20 #pragma GCC diagnostic ignored "-Wconversion"    23 #define BOOST_FILESYSTEM_VERSION 3    24 #include <boost/filesystem/path.hpp>    26 #if defined(BOOST_CLANG)    27 #pragma clang diagnostic pop    30 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)    31 #pragma GCC diagnostic pop    33 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    37 #include <type_traits>    39 namespace boost { 
namespace gil { 
namespace detail {
    41 template<
typename P> 
struct is_supported_path_spec              : std::false_type {};
    42 template<> 
struct is_supported_path_spec< std::string >         : std::true_type {};
    43 template<> 
struct is_supported_path_spec< const std::string >   : std::true_type {};
    44 template<> 
struct is_supported_path_spec< std::wstring >        : std::true_type {};
    45 template<> 
struct is_supported_path_spec< const std::wstring >  : std::true_type {};
    46 template<> 
struct is_supported_path_spec< const char* >         : std::true_type {};
    47 template<> 
struct is_supported_path_spec< char* >               : std::true_type {};
    48 template<> 
struct is_supported_path_spec< const wchar_t* >      : std::true_type {};
    49 template<> 
struct is_supported_path_spec< wchar_t* >            : std::true_type {};
    51 template<
int i> 
struct is_supported_path_spec<const char [i]>       : std::true_type {};
    52 template<
int i> 
struct is_supported_path_spec<char [i]>             : std::true_type {};
    53 template<
int i> 
struct is_supported_path_spec<const wchar_t [i]>    : std::true_type {};
    54 template<
int i> 
struct is_supported_path_spec<wchar_t [i]>          : std::true_type {};
    56 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    57 template<> 
struct is_supported_path_spec< filesystem::path > : std::true_type {};
    58 template<> 
struct is_supported_path_spec< const filesystem::path > : std::true_type {};
    59 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    66 inline std::string convert_to_string( std::string 
const& obj)
    71 inline std::string convert_to_string( std::wstring 
const& s )
    73     std::size_t len = wcslen( s.c_str() );
    74     char* c = reinterpret_cast<char*>( alloca( len ));
    75     wcstombs( c, s.c_str(), len );
    77     return std::string( c, c + len );
    80 inline std::string convert_to_string( 
const char* str )
    82     return std::string( str );
    85 inline std::string convert_to_string( 
char* str )
    87     return std::string( str );
    90 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT    91 inline std::string convert_to_string( 
const filesystem::path& path )
    93     return convert_to_string( path.string() );
    95 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT   101 inline const char* convert_to_native_string( 
char* str )
   106 inline const char* convert_to_native_string( 
const char* str )
   111 inline const char* convert_to_native_string( 
const std::string& str )
   116 inline const char* convert_to_native_string( 
const wchar_t* str )
   118     std::size_t len = wcslen( str ) + 1;
   119     char* c = 
new char[len];
   120     wcstombs( c, str, len );
   125 inline const char* convert_to_native_string( 
const std::wstring& str )
   127     std::size_t len = wcslen( str.c_str() ) + 1;
   128     char* c = 
new char[len];
   129     wcstombs( c, str.c_str(), len );