7#ifndef BOOST_NOWIDE_QUOTED_HPP_INCLUDED
8#define BOOST_NOWIDE_QUOTED_HPP_INCLUDED
11#include <boost/nowide/detail/is_path.hpp>
12#include <boost/nowide/utf/convert.hpp>
18#if defined(__cpp_lib_quoted_string_io) && __cpp_lib_quoted_string_io >= 201304
27 using remove_cvref_t =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
43#ifdef BOOST_NOWIDE_DOXYGEN
46 detail::enable_if_path_t<detail::remove_cvref_t<Path>, detail::quoted<Path&>>
56 detail::enable_if_path_t<detail::remove_cvref_t<Path>, detail::quoted<const Path&>> quoted(
const Path& path)
62 template<
typename CharOut,
64 typename =
typename std::enable_if<!std::is_same<CharOut, CharIn>::value>::type>
65 std::basic_string<CharOut> maybe_convert_string(
const std::basic_string<CharIn>& s)
67 return utf::convert_string<CharOut>(s);
69 template<
typename Char>
70 const std::basic_string<Char>& maybe_convert_string(
const std::basic_string<Char>& s)
76 using requires_non_const =
77 typename std::enable_if<!std::is_const<typename std::remove_reference<T>::type>::value>::type;
83 template<
typename CharType>
84 friend std::basic_ostream<CharType>& operator<<(std::basic_ostream<CharType>& out,
const quoted& path)
86 return out << std::quoted(maybe_convert_string<CharType>(path.value.native()));
89 template<
typename CharType,
class Path2 = Path,
typename = requires_non_const<Path2>>
90 friend std::basic_istream<CharType>& operator>>(std::basic_istream<CharType>& in,
const quoted& path)
92 std::basic_string<CharType> value;
93 using PlainPath = remove_cvref_t<Path>;
94 if(in >> std::quoted(value))
95 path.value = PlainPath(maybe_convert_string<typename PlainPath::value_type>(value));
105#elif defined(BOOST_PRAGMA_MESSAGE)
106BOOST_PRAGMA_MESSAGE(
"To use boost::nowide::quoted at least C++14 is required.")