$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r63136 - in trunk: boost/filesystem/v3 libs/filesystem/v3/doc libs/filesystem/v3/test libs/filesystem/v3/test/msvc libs/io/doc
From: bdawes_at_[hidden]
Date: 2010-06-20 09:41:27
Author: bemandawes
Date: 2010-06-20 09:41:26 EDT (Sun, 20 Jun 2010)
New Revision: 63136
URL: http://svn.boost.org/trac/boost/changeset/63136
Log:
Use boost::io::quoted I/O manipulator as a better solution to embedded spaces. See #3863
Text files modified: 
   trunk/boost/filesystem/v3/path.hpp                   |    35 ++++++++++++------------------          
   trunk/libs/filesystem/v3/doc/reference.html          |    46 +++++++++++++++++---------------------- 
   trunk/libs/filesystem/v3/test/msvc/filesystem-v3.sln |    10 ++++++++                                
   trunk/libs/filesystem/v3/test/path_unit_test.cpp     |    10 ++++++++                                
   trunk/libs/io/doc/quoted_manip.html                  |     5 +--                                     
   5 files changed, 56 insertions(+), 50 deletions(-)
Modified: trunk/boost/filesystem/v3/path.hpp
==============================================================================
--- trunk/boost/filesystem/v3/path.hpp	(original)
+++ trunk/boost/filesystem/v3/path.hpp	2010-06-20 09:41:26 EDT (Sun, 20 Jun 2010)
@@ -21,11 +21,12 @@
 #include <boost/system/system_error.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/io/detail/quoted_manip.hpp>
 #include <boost/static_assert.hpp>
 #include <string>
 #include <iterator>
 #include <cstring>
-#include <iosfwd>    // needed by basic_path inserter and extractor
+#include <iosfwd>
 #include <stdexcept>
 #include <cassert>
 #include <locale>
@@ -542,35 +543,27 @@
   inline path operator/(const path& lhs, const path& rhs)  { return path(lhs) /= rhs; }
 
   //  inserters and extractors
+  //    use boost::io::quoted() to handle spaces in paths
+  //    use '&' as escape character to ease use for Windows paths
 
-  inline std::ostream& operator<<(std::ostream & os, const path& p)
+  template <class Char, class Traits>
+  inline std::basic_ostream<Char, Traits>&
+  operator<<(std::basic_ostream<Char, Traits>& os, const path& p)
   {
-    os << p.string();
-    return os;
+    return os
+      << boost::io::quoted(p.string<std::basic_string<Char> >(), static_cast<Char>('&'));
   }
   
-  inline std::wostream& operator<<(std::wostream & os, const path& p)
+  template <class Char, class Traits>
+  inline std::basic_istream<Char, Traits>&
+  operator>>(std::basic_istream<Char, Traits>& is, path& p)
   {
-    os << p.wstring();
-    return os;
-  }
-  
-  inline std::istream& operator>>(std::istream & is, path& p)
-  {
-    std::string str;
-    std::getline(is, str);  // See ticket #3863
+    std::basic_string<Char> str;
+    is >> boost::io::quoted(str, static_cast<Char>('&'));
     p = str;
     return is;
   }
   
-  inline std::wistream& operator>>(std::wistream & is, path& p)
-  {
-    std::wstring str;
-    std::getline(is, str);  // See ticket #3863
-    p = str;
-    return is;
-  }
-
   //  name_checks
 
   BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name);
Modified: trunk/libs/filesystem/v3/doc/reference.html
==============================================================================
--- trunk/libs/filesystem/v3/doc/reference.html	(original)
+++ trunk/libs/filesystem/v3/doc/reference.html	2010-06-20 09:41:26 EDT (Sun, 20 Jun 2010)
@@ -1177,36 +1177,30 @@
 <blockquote>
   <p><i>Returns:</i> <code>path(lhs) /= rhs</code>.</p>
 </blockquote>
-<h3> <a name="path-non-member-operators"><code><font size="4">path</font></code></a><a name="path-inserter-extractor"><span style="background-color: #FFFFFF"> inserters 
-  and extractor</span></a><span style="background-color: #FFFFFF">s</span></h3>
-<pre>std::ostream& operator<<(std::ostream & os, const path& p);</pre>
+<h3> <a name="path-non-member-operators"><code><font size="4">path</font></code></a><a name="path-inserter-extractor"><span style="background-color: #FFFFFF"> inserter 
+  and extractor</span></a></h3>
+<p> The inserter and extractor delimit the string with double-quotes (<code>"</code>) 
+to ensure that paths with embedded spaces will round trip correctly. Ampersand (<code>&</code>) 
+is used as an escape character, so the path can itself contain double quotes.</p>
+<pre>template <class Char, class Traits>
+std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const path& p)
+</pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF"> 
-  <code>os << p.string();</code></span></p>
+  <code>os << <a href="../../../io/doc/quoted_manip.html">
+  boost::io::quoted</a>(p.string<std::basic_string<Char>>(), static_cast<Char>('&'));</code></span></p>
   <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
   </span> <code><span style="background-color: #FFFFFF">os</span></code></p>
 </blockquote>
-<pre>std::wostream& operator<<(std::wostream & os, const path& p);</pre>
-<blockquote style="font-size: 10pt">
-  <p style="font-size: 10pt"><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF"> 
-  <code>os << p.wstring();</code></span></p>
-  <p style="font-size: 10pt"><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
-  </span><code><span style="background-color: #FFFFFF">os</span></code></p>
-</blockquote>
-<pre>std::istream& operator>>(std::istream & is, path& p);</pre>
-<blockquote>
-  <p><span style="background-color: #FFFFFF"><i>Effects: </i>
-      <code>  std::string str;<br>
-        is >> str;<br>
-        p = str;</code></span></p>
-  <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
-  </span> <code><span style="background-color: #FFFFFF">is</span></code></p>
-  </blockquote>
-<pre>std::wistream& operator>>(std::wistream & is, path& p);</pre>
-<blockquote>
-  <p><span style="background-color: #FFFFFF"><i>Effects: </i>
-      <code>  std::wstring str;<br>
-        is >> str;<br>
+<pre>template <class Char, class Traits>
+inline std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& is, path& p)
+</pre>
+<blockquote>
+  <p><span style="background-color: #FFFFFF"><i>Effects:  </i>
+      <code> std::basic_string<Char> str;<br>
+        is >>
+  boost::io::quoted(str, 
+  static_cast<Char>('&'));<br>
         p = str;</code></span></p>
   <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
   </span> <code><span style="background-color: #FFFFFF">is</span></code></p>
@@ -3074,7 +3068,7 @@
 <p>Distributed under the Boost Software License, Version 1.0. See
 <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->04 June 2010<!--webbot bot="Timestamp" endspan i-checksum="17550" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->20 June 2010<!--webbot bot="Timestamp" endspan i-checksum="17544" --></p>
 
 </body>
 
Modified: trunk/libs/filesystem/v3/test/msvc/filesystem-v3.sln
==============================================================================
--- trunk/libs/filesystem/v3/test/msvc/filesystem-v3.sln	(original)
+++ trunk/libs/filesystem/v3/test/msvc/filesystem-v3.sln	2010-06-20 09:41:26 EDT (Sun, 20 Jun 2010)
@@ -86,6 +86,12 @@
                 {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
         EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hebrew_example", "hebrew_example\hebrew_example.vcproj", "{F9F236A2-8B57-415A-8397-7145144400F5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+		{FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+	EndProjectSection
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -152,6 +158,10 @@
                 {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Debug|Win32.Build.0 = Debug|Win32
                 {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.ActiveCfg = Release|Win32
                 {256EA89A-E073-4CE8-B675-BE2FBC6B2691}.Release|Win32.Build.0 = Release|Win32
+		{F9F236A2-8B57-415A-8397-7145144400F5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F9F236A2-8B57-415A-8397-7145144400F5}.Debug|Win32.Build.0 = Debug|Win32
+		{F9F236A2-8B57-415A-8397-7145144400F5}.Release|Win32.ActiveCfg = Release|Win32
+		{F9F236A2-8B57-415A-8397-7145144400F5}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE
Modified: trunk/libs/filesystem/v3/test/path_unit_test.cpp
==============================================================================
--- trunk/libs/filesystem/v3/test/path_unit_test.cpp	(original)
+++ trunk/libs/filesystem/v3/test/path_unit_test.cpp	2010-06-20 09:41:26 EDT (Sun, 20 Jun 2010)
@@ -398,6 +398,16 @@
     ss << p1;
     ss >> p2;
     CHECK(p1 == p2);
+
+    path wp1(L"foo bar");
+    path wp2;
+
+    std::wstringstream wss;
+
+    CHECK(wp1 != wp2);
+    wss << wp1;
+    wss >> wp2;
+    CHECK(wp1 == wp2);
   }
 
   //  test_other_non_members  ----------------------------------------------------------//
Modified: trunk/libs/io/doc/quoted_manip.html
==============================================================================
--- trunk/libs/io/doc/quoted_manip.html	(original)
+++ trunk/libs/io/doc/quoted_manip.html	2010-06-20 09:41:26 EDT (Sun, 20 Jun 2010)
@@ -33,8 +33,7 @@
     <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>
+    header file is currently located in <boost/io/detail/quoted_manip.hpp></b></td>
   </tr>
 </table>
 
@@ -156,7 +155,7 @@
 <p>Distributed under the Boost Software License, Version 1.0. See
 <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->19 June 2010<!--webbot bot="Timestamp" endspan i-checksum="17561" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->20 June 2010<!--webbot bot="Timestamp" endspan i-checksum="17544" --></p>
 
 </body>
 </html>
\ No newline at end of file