8 #ifndef BOOST_GIL_IO_PATH_SPEC_HPP
9 #define BOOST_GIL_IO_PATH_SPEC_HPP
11 #include <boost/gil/io/detail/filesystem.hpp>
15 #include <type_traits>
17 namespace boost {
namespace gil {
namespace detail {
19 template<
typename P>
struct is_supported_path_spec : std::false_type {};
20 template<>
struct is_supported_path_spec< std::string > : std::true_type {};
21 template<>
struct is_supported_path_spec< const std::string > : std::true_type {};
22 template<>
struct is_supported_path_spec< std::wstring > : std::true_type {};
23 template<>
struct is_supported_path_spec< const std::wstring > : std::true_type {};
24 template<>
struct is_supported_path_spec< char const* > : std::true_type {};
25 template<>
struct is_supported_path_spec< char* > : std::true_type {};
26 template<>
struct is_supported_path_spec< const wchar_t* > : std::true_type {};
27 template<>
struct is_supported_path_spec< wchar_t* > : std::true_type {};
29 template<
int i>
struct is_supported_path_spec<const char [i]> : std::true_type {};
30 template<
int i>
struct is_supported_path_spec<char [i]> : std::true_type {};
31 template<
int i>
struct is_supported_path_spec<const wchar_t [i]> : std::true_type {};
32 template<
int i>
struct is_supported_path_spec<wchar_t [i]> : std::true_type {};
34 template<>
struct is_supported_path_spec<filesystem::path> : std::true_type {};
35 template<>
struct is_supported_path_spec<filesystem::path const> : std::true_type {};
37 inline std::string convert_to_string( std::string
const& obj)
42 inline std::string convert_to_string( std::wstring
const& s )
44 std::size_t len = wcslen( s.c_str() );
45 char* c =
reinterpret_cast<char*
>( alloca( len ));
46 wcstombs( c, s.c_str(), len );
48 return std::string( c, c + len );
51 inline std::string convert_to_string(
char const* str )
53 return std::string( str );
56 inline std::string convert_to_string(
char* str )
58 return std::string( str );
61 inline std::string convert_to_string(filesystem::path
const& path)
63 return convert_to_string(path.string());
66 inline char const* convert_to_native_string(
char* str )
71 inline char const* convert_to_native_string(
char const* str )
76 inline char const* convert_to_native_string(
const std::string& str )
81 inline char const* convert_to_native_string(
const wchar_t* str )
83 std::size_t len = wcslen( str ) + 1;
84 char* c =
new char[len];
85 wcstombs( c, str, len );
90 inline char const* convert_to_native_string( std::wstring
const& str )
92 std::size_t len = wcslen( str.c_str() ) + 1;
93 char* c =
new char[len];
94 wcstombs( c, str.c_str(), len );
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36