|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63100 - in branches/filesystem3: boost/io boost/io/detail libs/io/doc
From: bdawes_at_[hidden]
Date: 2010-06-19 10:55:02
Author: bemandawes
Date: 2010-06-19 10:55:01 EDT (Sat, 19 Jun 2010)
New Revision: 63100
URL: http://svn.boost.org/trac/boost/changeset/63100
Log:
Move header to detail in preparation for merge to trunk
Added:
branches/filesystem3/boost/io/detail/
branches/filesystem3/boost/io/detail/quoted_manip.hpp
- copied unchanged from r63099, /branches/filesystem3/boost/io/quoted_manip.hpp
Removed:
branches/filesystem3/boost/io/quoted_manip.hpp
Text files modified:
branches/filesystem3/libs/io/doc/quoted_manip.html | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
Deleted: branches/filesystem3/boost/io/quoted_manip.hpp
==============================================================================
--- branches/filesystem3/boost/io/quoted_manip.hpp 2010-06-19 10:55:01 EDT (Sat, 19 Jun 2010)
+++ (empty file)
@@ -1,185 +0,0 @@
-// boost/io/quoted_manip.hpp ---------------------------------------------------------//
-
-// Copyright Beman Dawes 2010
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// Library home page http://www.boost.org/libs/io
-
-//--------------------------------------------------------------------------------------//
-
-#ifndef BOOST_IO_QUOTED_MANIP
-#define BOOST_IO_QUOTED_MANIP
-
-#include <iosfwd>
-#include <ios>
-#include <string>
-#include <iterator>
-#include <boost/io/ios_state.hpp>
-
-namespace boost
-{
- namespace io
- {
- namespace detail { template <class String, class Char> struct quoted_proxy; }
-
- // ------------ public interface ------------------------------------------------//
-
- // manipulator for const std::basic_string&
- template <class Char, class Traits, class Alloc>
- detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>
- quoted(const std::basic_string<Char, Traits, Alloc>& s,
- Char escape='\\', Char delim='\"');
-
- // manipulator for non-const std::basic_string&
- template <class Char, class Traits, class Alloc>
- detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> &, Char>
- quoted(std::basic_string<Char, Traits, Alloc>& s,
- Char escape='\\', Char delim='\"');
-
- // manipulator for const C-string*
- template <class Char>
- detail::quoted_proxy<const Char*, Char>
- quoted(const Char* s, Char escape='\\', Char delim='\"');
-
- // ----------- implementation details -------------------------------------------//
-
- namespace detail
- {
- // proxy used as an argument pack
- template <class String, class Char>
- struct quoted_proxy
- {
- String string;
- Char escape;
- Char delim;
-
- quoted_proxy(String s_, Char escape_, Char delim_)
- : string(s_), escape(escape_), delim(delim_) {}
- };
-
- // abstract away difference between proxies with const or non-const basic_strings
- template <class Char, class Traits, class Alloc>
- std::basic_ostream<Char, Traits>&
- basic_string_inserter_imp(std::basic_ostream<Char, Traits>& os,
- std::basic_string<Char, Traits, Alloc> const & string, Char escape, Char delim)
- {
- os << delim;
- std::basic_string<Char, Traits, Alloc>::const_iterator end_it = string.end();
- for (std::basic_string<Char, Traits, Alloc>::const_iterator it = string.begin();
- it != end_it;
- ++it )
- {
- if (*it == delim || *it == escape)
- os << escape;
- os << *it;
- }
- os << delim;
- return os;
- }
-
- // inserter for const std::basic_string& proxies
- template <class Char, class Traits, class Alloc>
- inline
- std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os,
- const quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>& proxy)
- {
- return basic_string_inserter_imp(os, proxy.string, proxy.escape, proxy.delim);
- }
-
- // inserter for non-const std::basic_string& proxies
- template <class Char, class Traits, class Alloc>
- inline
- std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os,
- const quoted_proxy<std::basic_string<Char, Traits, Alloc>&, Char>& proxy)
- {
- return basic_string_inserter_imp(os, proxy.string, proxy.escape, proxy.delim);
- }
-
- // inserter for const C-string* proxies
- template <class Char, class Traits>
- std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os,
- const quoted_proxy<const Char*, Char>& proxy)
- {
- os << proxy.delim;
- for (const Char* it = proxy.string;
- *it;
- ++it )
- {
- if (*it == proxy.delim || *it == proxy.escape)
- os << proxy.escape;
- os << *it;
- }
- os << proxy.delim;
- return os;
- }
-
- // extractor for non-const std::basic_string& proxies
- template <class Char, class Traits, class Alloc>
- std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& is,
- const quoted_proxy<std::basic_string<Char, Traits, Alloc>&, Char>& proxy)
- {
- Char c;
- is >> c;
- if (c != proxy.delim)
- {
- proxy.string = c;
- is >> proxy.string;
- return is;
- }
- proxy.string.clear();
- {
- boost::io::ios_flags_saver ifs(is);
- is >> std::noskipws;
- for (;;)
- {
- is >> c;
- if (!is.good()) // cope with I/O errors or end-of-file
- break;
- if (c == proxy.escape)
- {
- is >> c;
- if (!is.good()) // cope with I/O errors or end-of-file
- break;
- }
- else if (c == proxy.delim)
- break;
- proxy.string += c;
- }
- }
- return is;
- }
-
- } // namespace detail
-
- // manipulator implementation for const std::basic_string&
- template <class Char, class Traits, class Alloc>
- inline detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>
- quoted(const std::basic_string<Char, Traits, Alloc>& s, Char escape, Char delim)
- {
- return detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>
- (s, escape, delim);
- }
-
- // manipulator implementation for non-const std::basic_string&
- template <class Char, class Traits, class Alloc>
- inline detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> &, Char>
- quoted(std::basic_string<Char, Traits, Alloc>& s, Char escape, Char delim)
- {
- return detail::quoted_proxy<std::basic_string<Char, Traits, Alloc>&, Char>
- (s, escape, delim);
- }
-
- // manipulator implementation for const C-string*
- template <class Char>
- inline detail::quoted_proxy<const Char*, Char>
- quoted(const Char* s, Char escape, Char delim)
- {
- return detail::quoted_proxy<const Char*, Char> (s, escape, delim);
- }
-
- } // namespace io
-} // namespace boost
-
-#endif // BOOST_IO_QUOTED_MANIP
Modified: branches/filesystem3/libs/io/doc/quoted_manip.html
==============================================================================
--- branches/filesystem3/libs/io/doc/quoted_manip.html (original)
+++ branches/filesystem3/libs/io/doc/quoted_manip.html 2010-06-19 10:55:01 EDT (Sat, 19 Jun 2010)
@@ -20,13 +20,24 @@
width="300" height="86" border="0" /></a></td>
<td>
<h1 align="center">"Quoted"
- I/O Manipulator<br>
+ I/O Manipulators<br>
for Strings</h1>
</td>
</tr>
</tbody>
</table>
+<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
+ <tr>
+ <td>
+ <p align="center"><b>"Quoted"
+ I/O Manipulators
+ for Strings are not yet accepted into Boost as public components. Thus the
+ header file is currently located in <boost/io/detail/quoted_manip.hpp>, and
+ this documentation page is not linked to from official documentation.</b></td>
+ </tr>
+</table>
+
<h2>Introduction</h2>
<p>C++ Standard library stream I/O for strings that contain embedded spaces
can produce unexpected results. For example,</p>
@@ -65,7 +76,7 @@
<blockquote>
<pre>std::cout << quoted("'Jack & Jill'", '&', '\''); // outputs: '&'Jack && Jill&''</pre>
</blockquote>
-<h2>Header <boost/io/quoted_manip.hpp> synopsis</h2>
+<h2>Header <boost/io/quoted_manip.hpp> synopsis</h2>
<pre>namespace boost
{
namespace io
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk