diff --git a/include/boost/io/quoted.hpp b/include/boost/io/quoted.hpp index 44570e2..7f67917 100644 --- a/include/boost/io/quoted.hpp +++ b/include/boost/io/quoted.hpp @@ -20,19 +20,10 @@ namespace io { namespace detail { template -class quoted_proxy { -public: - quoted_proxy(String string_, Char escape_, Char delim_) - : string(string_) - , escape(escape_) - , delim(delim_) { } - +struct quoted_proxy { String string; Char escape; Char delim; - -private: - quoted_proxy& operator=(const quoted_proxy&); }; template @@ -74,35 +65,35 @@ quoted_output(std::basic_ostream& os, template inline std::basic_ostream& operator<<(std::basic_ostream& os, - const quoted_proxy&, + const quoted_proxy*, Char>& proxy) { - return boost::io::detail::quoted_output(os, proxy.string, proxy.escape, + return boost::io::detail::quoted_output(os, *proxy.string, proxy.escape, proxy.delim); } template inline std::basic_ostream& operator<<(std::basic_ostream& os, - const quoted_proxy&, Char>& proxy) + const quoted_proxy*, Char>& proxy) { - return boost::io::detail::quoted_output(os, proxy.string, proxy.escape, + return boost::io::detail::quoted_output(os, *proxy.string, proxy.escape, proxy.delim); } template inline std::basic_istream& operator>>(std::basic_istream& is, - const quoted_proxy&, Char>& proxy) + const quoted_proxy*, Char>& proxy) { - proxy.string.clear(); + proxy.string->clear(); Char ch; if (!(is >> ch).good()) { return is; } if (ch != proxy.delim) { is.unget(); - is >> proxy.string; + is >> *proxy.string; return is; } { @@ -112,7 +103,7 @@ operator>>(std::basic_istream& is, if (ch == proxy.escape && !(is >> ch).good()) { break; } - proxy.string.push_back(ch); + proxy.string->push_back(ch); } } return is; @@ -121,29 +112,32 @@ operator>>(std::basic_istream& is, } /* detail */ template -inline detail::quoted_proxy&, +inline detail::quoted_proxy*, Char> quoted(const std::basic_string& s, Char escape='\\', Char delim='\"') { - return detail::quoted_proxy&, - Char>(s, escape, delim); + detail::quoted_proxy*, + Char> proxy = { &s, escape, delim }; + return proxy; } template -inline detail::quoted_proxy&, Char> +inline detail::quoted_proxy*, Char> quoted(std::basic_string& s, Char escape='\\', Char delim='\"') { - return detail::quoted_proxy&, - Char>(s, escape, delim); + detail::quoted_proxy*, + Char> proxy = { &s, escape, delim }; + return proxy; } template inline detail::quoted_proxy quoted(const Char* s, Char escape='\\', Char delim='\"') { - return detail::quoted_proxy(s, escape, delim); + detail::quoted_proxy proxy = { s, escape, delim }; + return proxy; } } /* io */