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 >= 40600) 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 >= 40600) 31 #pragma GCC diagnostic pop 33 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 35 #include <boost/mpl/bool.hpp> 40 namespace boost {
namespace gil {
namespace detail {
42 template<
typename P>
struct is_supported_path_spec : mpl::false_ {};
43 template<>
struct is_supported_path_spec<
std::string > : mpl::true_ {};
44 template<>
struct is_supported_path_spec< const std::string > : mpl::true_ {};
45 template<>
struct is_supported_path_spec< std::wstring > : mpl::true_ {};
46 template<>
struct is_supported_path_spec< const std::wstring > : mpl::true_ {};
47 template<>
struct is_supported_path_spec< const char* > : mpl::true_ {};
48 template<>
struct is_supported_path_spec< char* > : mpl::true_ {};
49 template<>
struct is_supported_path_spec< const wchar_t* > : mpl::true_ {};
50 template<>
struct is_supported_path_spec< wchar_t* > : mpl::true_ {};
52 template<
int i>
struct is_supported_path_spec<const char [i]> : mpl::true_ {};
53 template<
int i>
struct is_supported_path_spec<char [i]> : mpl::true_ {};
54 template<
int i>
struct is_supported_path_spec<const wchar_t [i]> : mpl::true_ {};
55 template<
int i>
struct is_supported_path_spec<wchar_t [i]> : mpl::true_ {};
57 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 58 template<>
struct is_supported_path_spec< filesystem::path > : mpl::true_ {};
59 template<>
struct is_supported_path_spec< const filesystem::path > : mpl::true_ {};
60 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 67 inline std::string convert_to_string( std::string
const& obj)
72 inline std::string convert_to_string( std::wstring
const& s )
74 std::size_t len = wcslen( s.c_str() );
75 char* c =
reinterpret_cast<char*
>( alloca( len ));
76 wcstombs( c, s.c_str(), len );
78 return std::string( c, c + len );
81 inline std::string convert_to_string(
const char* str )
83 return std::string( str );
86 inline std::string convert_to_string(
char* str )
88 return std::string( str );
91 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 92 inline std::string convert_to_string(
const filesystem::path& path )
94 return convert_to_string( path.string() );
96 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 102 inline const char* convert_to_native_string(
char* str )
107 inline const char* convert_to_native_string(
const char* str )
112 inline const char* convert_to_native_string(
const std::string& str )
117 inline const char* convert_to_native_string(
const wchar_t* str )
119 std::size_t len = wcslen( str ) + 1;
120 char* c =
new char[len];
121 wcstombs( c, str, len );
126 inline const char* convert_to_native_string(
const std::wstring& str )
128 std::size_t len = wcslen( str.c_str() ) + 1;
129 char* c =
new char[len];
130 wcstombs( c, str.c_str(), len );
Definition: algorithm.hpp:30
Definition: algorithm.hpp:127