9#ifndef BOOST_GIL_IO_PATH_SPEC_HPP
10#define BOOST_GIL_IO_PATH_SPEC_HPP
12#include <boost/gil/io/detail/filesystem.hpp>
19namespace boost {
namespace gil {
namespace detail {
21template<
typename P>
struct is_supported_path_spec : std::false_type {};
22template<>
struct is_supported_path_spec< std::string > : std::true_type {};
23template<>
struct is_supported_path_spec< const std::string > : std::true_type {};
24template<>
struct is_supported_path_spec< std::wstring > : std::true_type {};
25template<>
struct is_supported_path_spec< const std::wstring > : std::true_type {};
26template<>
struct is_supported_path_spec< char const* > : std::true_type {};
27template<>
struct is_supported_path_spec< char* > : std::true_type {};
28template<>
struct is_supported_path_spec< const wchar_t* > : std::true_type {};
29template<>
struct is_supported_path_spec< wchar_t* > : std::true_type {};
31template<
int i>
struct is_supported_path_spec<const char [i]> : std::true_type {};
32template<
int i>
struct is_supported_path_spec<char [i]> : std::true_type {};
33template<
int i>
struct is_supported_path_spec<const wchar_t [i]> : std::true_type {};
34template<
int i>
struct is_supported_path_spec<wchar_t [i]> : std::true_type {};
36template<>
struct is_supported_path_spec<filesystem::path> : std::true_type {};
37template<>
struct is_supported_path_spec<filesystem::path const> : std::true_type {};
39inline std::string convert_to_string( std::string
const& obj)
44inline std::string convert_to_string( std::wstring
const& s )
46 std::mbstate_t state = std::mbstate_t();
47 const wchar_t* str = s.c_str();
48 const std::size_t len = std::wcsrtombs(
nullptr, &str, 0, &state);
49 std::string result(len,
'\0');
50 std::wcstombs( &result[0], s.c_str(), len );
55inline std::string convert_to_string(
char const* str )
57 return std::string( str );
60inline std::string convert_to_string(
char* str )
62 return std::string( str );
65inline std::string convert_to_string(filesystem::path
const& path)
67 return convert_to_string(path.string());
70inline char const* convert_to_native_string(
char* str )
75inline char const* convert_to_native_string(
char const* str )
80inline char const* convert_to_native_string(
const std::string& str )
85inline char const* convert_to_native_string(
const wchar_t* str )
87 std::mbstate_t state = std::mbstate_t();
88 const std::size_t len = std::wcsrtombs(
nullptr, &str, 0, &state) + 1;
89 char* c =
new char[len];
90 std::wcstombs( c, str, len );
95inline char const* convert_to_native_string( std::wstring
const& str )
97 std::mbstate_t state = std::mbstate_t();
98 const wchar_t* wstr = str.c_str();
99 const std::size_t len = std::wcsrtombs(
nullptr, &wstr, 0, &state) + 1;
100 char* c =
new char[len];
101 std::wcstombs( c, str.c_str(), len );
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition algorithm.hpp:36