From 8d152999d0ac5156be9698e299d253e5550995bf Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 21 Mar 2006 02:26:31 +0000 Subject: [PATCH 01/20] This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'. [SVN r33417] From 6b76d132800467bc6be08b4d9162983247bc9c6b Mon Sep 17 00:00:00 2001 From: Nicola Musatti Date: Thu, 27 Apr 2006 06:50:17 +0000 Subject: [PATCH 02/20] Fixed for BCB2006 [SVN r33835] --- include/boost/io/ios_state.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/io/ios_state.hpp b/include/boost/io/ios_state.hpp index 68a5a69..2d1625b 100644 --- a/include/boost/io/ios_state.hpp +++ b/include/boost/io/ios_state.hpp @@ -134,7 +134,11 @@ public: explicit basic_ios_exception_saver( state_type &s ) : s_save_( s ), a_save_( s.exceptions() ) {} +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + basic_ios_exception_saver( state_type &s, aspect_type a ) +#else basic_ios_exception_saver( state_type &s, aspect_type const &a ) +#endif : s_save_( s ), a_save_( s.exceptions() ) { s.exceptions(a); } ~basic_ios_exception_saver() From 93544845187e34da15b75cd0fe3126eeb57c8a3c Mon Sep 17 00:00:00 2001 From: Nicola Musatti Date: Tue, 6 Jun 2006 20:01:05 +0000 Subject: [PATCH 03/20] Added (forgotten) include for boost/detail/workaround.hpp [SVN r34200] --- include/boost/io/ios_state.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/io/ios_state.hpp b/include/boost/io/ios_state.hpp index 2d1625b..558646f 100644 --- a/include/boost/io/ios_state.hpp +++ b/include/boost/io/ios_state.hpp @@ -19,6 +19,7 @@ #include // for std::basic_streambuf #include // for std::char_traits +#include // for BOOST_WORKAROUND namespace boost { From 5e88f0cc3ba5f9d490002826f6ec159fb3211b97 Mon Sep 17 00:00:00 2001 From: Nicola Musatti Date: Tue, 6 Jun 2006 20:05:18 +0000 Subject: [PATCH 04/20] Merged fix from HEAD [SVN r34201] --- include/boost/io/ios_state.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/boost/io/ios_state.hpp b/include/boost/io/ios_state.hpp index 558646f..2e66094 100644 --- a/include/boost/io/ios_state.hpp +++ b/include/boost/io/ios_state.hpp @@ -10,6 +10,7 @@ #define BOOST_IO_IOS_STATE_HPP #include // self include +#include #include // for std::ios_base, std::basic_ios, etc. #ifndef BOOST_NO_STD_LOCALE @@ -19,8 +20,6 @@ #include // for std::basic_streambuf #include // for std::char_traits -#include // for BOOST_WORKAROUND - namespace boost { namespace io From 2217edb80bb70638b56ad09459bd23c5f3fea5d2 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 6 Nov 2006 17:10:46 +0000 Subject: [PATCH 05/20] Remove obsolete Boost.Build v1 files. [SVN r35880] --- test/Jamfile | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 test/Jamfile diff --git a/test/Jamfile b/test/Jamfile deleted file mode 100644 index 8dab248..0000000 --- a/test/Jamfile +++ /dev/null @@ -1,33 +0,0 @@ -# Boost.IO Library test Jamfile -# -# Copyright 2003 Daryle Walker. Use, modification, and distribution -# are subject to the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or a copy at -# .) -# -# See for the library's home page. -subproject libs/io/test ; - -import testing ; - -# Make tests run by default. -DEPENDS all : test ; - -{ - -test-suite "io" - : [ run ios_state_unit_test.cpp - @boost/libs/test/build/boost_unit_test_framework - : # args - : # input files - : std::locale-support - ] - - [ run ios_state_test.cpp - @boost/libs/test/build/boost_test_exec_monitor - : # args - : # input files - : std::locale-support - ] - ; -} From 06754cc5b624fe3744e926b34fe7f39424cc0fc1 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 7 Nov 2006 19:27:00 +0000 Subject: [PATCH 06/20] Merged copyright and license addition [SVN r35907] --- index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index dff3b20..debe825 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,11 @@ Automatic redirection failed, please go to -doc/index.html. +doc/index.html
+

© Copyright Beman Dawes, 2001

+

Distributed under the Boost Software License, Version 1.0. (See accompanying +file LICENSE_1_0.txt or copy +at www.boost.org/LICENSE_1_0.txt) +

\ No newline at end of file From d63ab99fa6ec39f64d4b1f8e73a5db557cf872e7 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Fri, 10 Nov 2006 19:59:52 +0000 Subject: [PATCH 07/20] Merge from HEAD. Allow building of shared versions of some Boost.Test libraries. Adjust tests to use always use static linking to Boost.Test, since linking to the shared version requires test changes. Patch from Juergen Hunold. [SVN r35990] --- test/Jamfile.v2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 30de868..14b3e5b 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -9,14 +9,14 @@ test-suite "io" : [ run ios_state_unit_test.cpp - ../../../libs/test/build//boost_unit_test_framework + ../../../libs/test/build//boost_unit_test_framework/static : # args : # input files # : std::locale-support ] [ run ios_state_test.cpp - ../../../libs/test/build//boost_test_exec_monitor + ../../../libs/test/build//boost_test_exec_monitor/static : # args : # input files # : std::locale-support From 1c8d616d16a0d334bad29c3500f0c714e1eeb9ee Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 24 Jul 2007 19:28:14 +0000 Subject: [PATCH 08/20] This commit was manufactured by cvs2svn to create tag 'Version_1_34_1'. [SVN r38286] From d9ae85cc234c3fce47f62eb08ae30017d1e704ac Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Fri, 5 Oct 2007 14:25:06 +0000 Subject: [PATCH 09/20] Starting point for releases [SVN r39706] From 57aec158b09f8e1803b3dfb0c28e4492c01ecd21 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:07:19 +0000 Subject: [PATCH 10/20] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41369] --- include/boost/io/ios_state.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/io/ios_state.hpp b/include/boost/io/ios_state.hpp index 2e66094..c9b4576 100644 --- a/include/boost/io/ios_state.hpp +++ b/include/boost/io/ios_state.hpp @@ -20,6 +20,7 @@ #include // for std::basic_streambuf #include // for std::char_traits + namespace boost { namespace io From d252d203333be9d28c7cfd8a5589312eb8af2a88 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:38:02 +0000 Subject: [PATCH 11/20] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41370] --- doc/index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/index.html b/doc/index.html index e2b8ea5..966c37b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -59,9 +59,8 @@ with/for the standard I/O library.

Revised: 26 Feb 2002

-

Copyright 2002 Boost.org. Use, -modification, and distribution are subject to the Boost Software -License, Version 1.0. (See accompanying file Copyright 2002 Daryle Walker. Use, modification, and distribution are +subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)

From a562c02c778dad123108adf0d9127ef4b712c8a6 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 15 Dec 2007 17:44:30 +0000 Subject: [PATCH 12/20] Merge some trivial MSVC warning fixes from Trunk. [SVN r42077] --- include/boost/io/ios_state.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/boost/io/ios_state.hpp b/include/boost/io/ios_state.hpp index c9b4576..9c45c0b 100644 --- a/include/boost/io/ios_state.hpp +++ b/include/boost/io/ios_state.hpp @@ -50,6 +50,8 @@ public: private: state_type & s_save_; aspect_type const a_save_; + + ios_flags_saver& operator=(const ios_flags_saver&); }; class ios_precision_saver @@ -73,6 +75,8 @@ public: private: state_type & s_save_; aspect_type const a_save_; + + ios_precision_saver& operator=(const ios_precision_saver&); }; class ios_width_saver @@ -96,6 +100,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + ios_width_saver& operator=(const ios_width_saver&); }; @@ -277,6 +282,8 @@ private: state_type & s_save_; aspect_type const a_save_; index_type const i_save_; + + ios_iword_saver& operator=(const ios_iword_saver&); }; class ios_pword_saver @@ -302,6 +309,8 @@ private: state_type & s_save_; aspect_type const a_save_; index_type const i_save_; + + ios_pword_saver operator=(const ios_pword_saver&); }; @@ -332,6 +341,8 @@ private: state_type::fmtflags const a1_save_; ::std::streamsize const a2_save_; ::std::streamsize const a3_save_; + + ios_base_all_saver& operator=(const ios_base_all_saver&); }; template < typename Ch, class Tr > @@ -408,6 +419,8 @@ private: index_type const i_save_; long const a1_save_; void * const a2_save_; + + ios_all_word_saver& operator=(const ios_all_word_saver&); }; From eea2bb328c7852c42e9dcba52eec1550f7781190 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 10 Feb 2008 16:39:38 +0000 Subject: [PATCH 13/20] Merged revisions 43206,43208-43213 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r43206 | danieljames | 2008-02-10 09:55:03 +0000 (Sun, 10 Feb 2008) | 1 line Fix some broken links. ........ r43209 | danieljames | 2008-02-10 14:56:22 +0000 (Sun, 10 Feb 2008) | 1 line Link to people pages on the website, as they've been removed from the download. ........ r43210 | danieljames | 2008-02-10 15:02:17 +0000 (Sun, 10 Feb 2008) | 1 line Point links to the pages that used to be in 'more' to the site. ........ r43212 | danieljames | 2008-02-10 16:10:16 +0000 (Sun, 10 Feb 2008) | 1 line Fix links on the home page as well. ........ r43213 | danieljames | 2008-02-10 16:21:22 +0000 (Sun, 10 Feb 2008) | 1 line Generated documentation which is no longer generated. ........ [SVN r43214] --- doc/index.html | 4 ++-- doc/ios_state.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/index.html b/doc/index.html index 966c37b..4885739 100644 --- a/doc/index.html +++ b/doc/index.html @@ -14,9 +14,9 @@ color="white">Home Libraries - People - FAQ More diff --git a/doc/ios_state.html b/doc/ios_state.html index 101524d..9be4fa2 100644 --- a/doc/ios_state.html +++ b/doc/ios_state.html @@ -434,7 +434,7 @@ int main()

Contributors

-
Daryle Walker +
Daryle Walker
Started the library. Contributed the initial versions of the format flags, precision, width, and user-defined format flags saver classes. Contributed the initial versions of the success From 9498b1b24188de52e2573cd9a5e494db5719c20a Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 24 Jan 2009 18:57:20 +0000 Subject: [PATCH 14/20] merge of cmake build files from trunk per beman [SVN r50756] --- CMakeLists.txt | 22 ++++++++++++++++++++++ module.cmake | 1 + test/CMakeLists.txt | 6 ++++++ 3 files changed, 29 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 module.cmake create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c402de4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +#---------------------------------------------------------------------------- +# This file was automatically generated from the original CMakeLists.txt file +# Add a variable to hold the headers for the library +set (lib_headers + io_fwd.hpp + io +) + +# Add a library target to the build system +boost_library_project( + io + # SRCDIRS + TESTDIRS test + HEADERS ${lib_headers} + # DOCDIRS + # DESCRIPTION + MODULARIZED + # AUTHORS + # MAINTAINERS +) + + diff --git a/module.cmake b/module.cmake new file mode 100644 index 0000000..fd1d4d9 --- /dev/null +++ b/module.cmake @@ -0,0 +1 @@ +boost_module(io DEPENDS detail) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..e3484d3 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,6 @@ +boost_additional_test_dependencies(io BOOST_DEPENDS test) + + +boost_test_run(ios_state_unit_test DEPENDS boost_unit_test_framework) +boost_test_run(ios_state_test DEPENDS boost_test_exec_monitor) + From 8631d8087c7cabb23fab17c8c245221611b0ac45 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Wed, 22 Jul 2009 21:51:01 +0000 Subject: [PATCH 15/20] Add basic copyright/license to keep cmake out of the inspection report [SVN r55095] --- CMakeLists.txt | 6 ++++++ test/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c402de4..a2d73a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# #---------------------------------------------------------------------------- # This file was automatically generated from the original CMakeLists.txt file # Add a variable to hold the headers for the library diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e3484d3..2f1cf09 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# boost_additional_test_dependencies(io BOOST_DEPENDS test) From 772d182b241ca91d715e4c80b44b1dc2e3c264d9 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 17 Oct 2009 01:10:45 +0000 Subject: [PATCH 16/20] rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release. [SVN r56941] --- CMakeLists.txt | 28 ---------------------------- module.cmake | 1 - test/CMakeLists.txt | 12 ------------ 3 files changed, 41 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 module.cmake delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a2d73a2..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -#---------------------------------------------------------------------------- -# This file was automatically generated from the original CMakeLists.txt file -# Add a variable to hold the headers for the library -set (lib_headers - io_fwd.hpp - io -) - -# Add a library target to the build system -boost_library_project( - io - # SRCDIRS - TESTDIRS test - HEADERS ${lib_headers} - # DOCDIRS - # DESCRIPTION - MODULARIZED - # AUTHORS - # MAINTAINERS -) - - diff --git a/module.cmake b/module.cmake deleted file mode 100644 index fd1d4d9..0000000 --- a/module.cmake +++ /dev/null @@ -1 +0,0 @@ -boost_module(io DEPENDS detail) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 2f1cf09..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -boost_additional_test_dependencies(io BOOST_DEPENDS test) - - -boost_test_run(ios_state_unit_test DEPENDS boost_unit_test_framework) -boost_test_run(ios_state_test DEPENDS boost_test_exec_monitor) - From 93932c0d55241c6d06a05b0270ca0d4a95a2f133 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 6 Jan 2010 08:55:23 +0000 Subject: [PATCH 17/20] Merge warning fix from trunk. Fixes #1414. [SVN r58747] --- include/boost/io/ios_state.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/boost/io/ios_state.hpp b/include/boost/io/ios_state.hpp index 9c45c0b..07cfb34 100644 --- a/include/boost/io/ios_state.hpp +++ b/include/boost/io/ios_state.hpp @@ -128,6 +128,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + basic_ios_iostate_saver& operator=(const basic_ios_iostate_saver&); }; template < typename Ch, class Tr > @@ -156,6 +157,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + basic_ios_exception_saver& operator=(const basic_ios_exception_saver&); }; template < typename Ch, class Tr > @@ -180,6 +182,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + basic_ios_tie_saver& operator=(const basic_ios_tie_saver&); }; template < typename Ch, class Tr > @@ -204,6 +207,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + basic_ios_rdbuf_saver& operator=(const basic_ios_rdbuf_saver&); }; template < typename Ch, class Tr > @@ -228,6 +232,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + basic_ios_fill_saver& operator=(const basic_ios_fill_saver&); }; #ifndef BOOST_NO_STD_LOCALE @@ -253,6 +258,7 @@ public: private: state_type & s_save_; aspect_type const a_save_; + basic_ios_locale_saver& operator=(const basic_ios_locale_saver&); }; #endif @@ -392,6 +398,8 @@ private: #ifndef BOOST_NO_STD_LOCALE ::std::locale const a9_save_; #endif + + basic_ios_all_saver& operator=(const basic_ios_all_saver&); }; class ios_all_word_saver From f5f8d961575d472424719888ccdf61b1fa3e9e37 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Fri, 14 Jan 2011 19:21:55 +0000 Subject: [PATCH 18/20] Merge from trunk [SVN r68159] --- doc/quoted_manip.html | 161 +++++++++++++++++++++++ include/boost/io/detail/quoted_manip.hpp | 4 +- test/Jamfile.v2 | 2 + test/ios_state_test.cpp | 8 +- test/ios_state_unit_test.cpp | 20 +-- test/quoted_manip_test.cpp | 133 +++++++++++++++++++ 6 files changed, 312 insertions(+), 16 deletions(-) create mode 100644 doc/quoted_manip.html create mode 100644 test/quoted_manip_test.cpp diff --git a/doc/quoted_manip.html b/doc/quoted_manip.html new file mode 100644 index 0000000..c3e7362 --- /dev/null +++ b/doc/quoted_manip.html @@ -0,0 +1,161 @@ + + + + + + Boost "quoted" I/O manipulator + + + + + + + + + + + + + +
boost.png (6897 bytes) +

"Quoted" + I/O Manipulators
+ for Strings

+
+ + + + + +
+

"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>

+ +

Introduction

+

C++ Standard library stream I/O for strings that contain embedded spaces +can produce unexpected results. For example,

+
+
std::stringstream ss;
+std::string original = "fooled you";
+std::string round_trip;
+
+ss << original;
+ss >> round_trip;
+
+std::cout << original;   // outputs: fooled you
+std::cout << round_trip; // outputs: fooled
+
+assert(original == round_trip); // assert will fire
+
+

The Boost quoted stream I/O manipulator places delimiters, defaulted +to the double-quote ("), around strings on output, and strips off +the delimiters on input. This ensures strings with embedded spaces round-trip as +desired. For example,

+
+
std::stringstream ss;
+std::string original = "fooled you";
+std::string round_trip;
+
+ss << quoted(original);
+ss >> quoted(round_trip);
+
+std::cout << quoted(original); // outputs: "fooled you"
+std::cout << round_trip;       // outputs: fooled you
+
+assert(original == round_trip); // assert will not fire
+
+

If the string contains the delimiter character, on output that character will +be preceded by an escape character, as will the escape character itself:

+
+
std::cout << quoted("'Jack & Jill'", '&', '\'');  // outputs: '&'Jack && Jill&''
+
+

Header <boost/io/quoted_manip.hpp> synopsis

+
namespace boost
+{
+  namespace io
+  {
+    // manipulator for const std::basic_string&
+
+    template <class Char, class Traits, class Alloc>
+    unspecified-type1 quoted(const std::basic_string<Char, Traits, Alloc>& string, Char escape='\\', Char delim='\"');
+
+    // manipulator for const C-string*
+
+    template <class Char>
+    unspecified-type2 quoted(const Char* string, Char escape='\\', Char delim='\"');
+
+    // manipulator for non-const std::basic_string&
+
+    template <class Char, class Traits, class Alloc>
+    unspecified-type3 quoted(std::basic_string<Char, Traits, Alloc>& string, Char escape='\\', Char delim='\"');
+  }
+}
+

unspecified_type1, unspecified_type2, +and unspecified_type3 are implementation supplied +types with implementation supplied operator<<:

+
+
template <class Char, class Traits>
+  std::basic_ostream<Char, Traits>&
+    operator<<(std::basic_ostream<Char, Traits>& os, const unspecified_typeN& proxy);
+

Effects: Inserts characters into os:

+
    +
  • delim.
  • +
  • Each character in string. If the character to be output is + equal to escape or delim, as determined by + operator==, first output escape.
  • +
  • delim.
  • +
+

Remarks: string, escape, and delim +have the type and value of the corresponding arguments of the call to the +quoted function that constructed proxy.

+

Returns: os.

+
+

unspecified_type3 is an implementation supplied +type with an implementation supplied operator>>:

+
+
template <class Char, class Traits>
+  std::basic_istream<Char, Traits>&
+    operator>>(std::basic_istream<Char, Traits>& is, const unspecified_type3& proxy);
+

Effects: Extracts characters from os:

+
    +
  • If the first character extracted is equal to delim, as determined by + operator==, then:
      +
    • Turn off the skipws flag.
    • +
    • string.clear()
    • +
    • Until an unescaped delim character is reached or + is.not_good(), extract + characters from os and append them to string, + except that if an escape is reached, ignore it and append the + next character to string.
    • +
    • Discard the final delim character.
    • +
    • Restore the skipws flag to its original value.
    • +
    +
  • +
  • Otherwise, os >> string.
  • +
+

Remarks: string, escape, and delim +have the type and value of the corresponding arguments of the call to the +quoted function that constructed proxy.

+

Returns: is.

+
+

Acknowledgements

+

The quoted() stream manipulator emerged from discussions on the +Boost developers mailing list. Participants included Beman Dawes, Rob Stewart, +Alexander Lamaison, Eric Niebler, Vicente Botet, Andrey Semashev, Phil Richards, +and Rob Murray. Eric Niebler's suggestions provided the basis for the name and +form of the templates.

+
+

© Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010

+

Distributed under the Boost Software License, Version 1.0. See +www.boost.org/LICENSE_1_0.txt

+

Revised +20 June 2010

+ + + \ No newline at end of file diff --git a/include/boost/io/detail/quoted_manip.hpp b/include/boost/io/detail/quoted_manip.hpp index 13cfc35..502f422 100644 --- a/include/boost/io/detail/quoted_manip.hpp +++ b/include/boost/io/detail/quoted_manip.hpp @@ -125,15 +125,15 @@ namespace boost std::basic_istream& operator>>(std::basic_istream& is, const quoted_proxy&, Char>& proxy) { + proxy.string.clear(); Char c; is >> c; if (c != proxy.delim) { - proxy.string = c; + is.unget(); is >> proxy.string; return is; } - proxy.string.clear(); { boost::io::ios_flags_saver ifs(is); is >> std::noskipws; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 14b3e5b..4b48bce 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -21,4 +21,6 @@ test-suite "io" : # input files # : std::locale-support ] + + [ run quoted_manip_test.cpp ] ; diff --git a/test/ios_state_test.cpp b/test/ios_state_test.cpp index 1f7fa84..0900de9 100644 --- a/test/ios_state_test.cpp +++ b/test/ios_state_test.cpp @@ -16,7 +16,7 @@ #include // for boost::io::ios_flags_saver, etc. #include // for std::size_t -#include // for std::setw +#include // for boost::detail::setw #include // for std::ios_base, std::streamsize, etc. #include // for std::cout, etc. #include // for std::istream @@ -143,7 +143,7 @@ saver_tests_1 { using std::locale; using std::ios_base; - using std::setw; + using boost::detail::setw; boost::io::ios_flags_saver const ifls( output ); boost::io::ios_precision_saver const iprs( output ); @@ -168,8 +168,8 @@ saver_tests_1 output.fill( '@' ); output.precision( 9 ); output << '\t' << test_string << '\n'; - output << '\t' << setw( 10 ) << test_num1 << '\n'; - output << '\t' << setw( 15 ) << test_num2 << '\n'; + output << '\t' << boost::detail::setw( 10 ) << test_num1 << '\n'; + output << '\t' << boost::detail::setw( 15 ) << test_num2 << '\n'; output.imbue( loc ); output << '\t' << test_bool << '\n'; diff --git a/test/ios_state_unit_test.cpp b/test/ios_state_unit_test.cpp index 72ce7b5..0d5969c 100644 --- a/test/ios_state_unit_test.cpp +++ b/test/ios_state_unit_test.cpp @@ -13,7 +13,7 @@ #include // for main, BOOST_CHECK, etc. #include // for NULL -#include // for std::setiosflags, etc. +#include // for boost::detail::setiosflags, etc. #include // for std::ios_base #include // for std::cout, std::cerr, etc. #include // for std::iostream @@ -77,7 +77,7 @@ ios_flags_saver_unit_test BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal), ss.flags() ); - ss << setiosflags( ios_base::unitbuf ); + ss << boost::detail::setiosflags( ios_base::unitbuf ); BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal | ios_base::unitbuf), ss.flags() ); } @@ -102,7 +102,7 @@ ios_precision_saver_unit_test BOOST_CHECK_EQUAL( 6, ss.precision() ); - ss << setprecision( 4 ); + ss << boost::detail::setprecision( 4 ); BOOST_CHECK_EQUAL( 4, ss.precision() ); } @@ -113,7 +113,7 @@ ios_precision_saver_unit_test BOOST_CHECK_EQUAL( 8, ss.precision() ); - ss << setprecision( 10 ); + ss << boost::detail::setprecision( 10 ); BOOST_CHECK_EQUAL( 10, ss.precision() ); } @@ -137,7 +137,7 @@ ios_width_saver_unit_test BOOST_CHECK_EQUAL( 0, ss.width() ); - ss << setw( 4 ); + ss << boost::detail::setw( 4 ); BOOST_CHECK_EQUAL( 4, ss.width() ); } @@ -148,7 +148,7 @@ ios_width_saver_unit_test BOOST_CHECK_EQUAL( 8, ss.width() ); - ss << setw( 10 ); + ss << boost::detail::setw( 10 ); BOOST_CHECK_EQUAL( 10, ss.width() ); } @@ -507,7 +507,7 @@ ios_base_all_saver_unit_test BOOST_CHECK_EQUAL( 6, ss.precision() ); BOOST_CHECK_EQUAL( 0, ss.width() ); - ss << hex << unitbuf << setprecision( 5 ) << setw( 7 ); + ss << hex << unitbuf << boost::detail::setprecision( 5 ) << boost::detail::setw( 7 ); BOOST_CHECK_EQUAL( (ios_base::unitbuf | ios_base::hex | ios_base::skipws), ss.flags() ); BOOST_CHECK_EQUAL( 5, ss.precision() ); @@ -560,10 +560,10 @@ ios_all_saver_unit_test ss << oct << showpos << noskipws; BOOST_CHECK_EQUAL( (ios_base::showpos | ios_base::oct), ss.flags() ); - ss << setprecision( 3 ); + ss << boost::detail::setprecision( 3 ); BOOST_CHECK_EQUAL( 3, ss.precision() ); - ss << setw( 9 ); + ss << boost::detail::setw( 9 ); BOOST_CHECK_EQUAL( 9, ss.width() ); ss.setstate( ios_base::eofbit ); @@ -586,7 +586,7 @@ ios_all_saver_unit_test ss.rdbuf( cerr.rdbuf() ); BOOST_CHECK_EQUAL( cerr.rdbuf(), ss.rdbuf() ); - ss << setfill( 'x' ); + ss << boost::detail::setfill( 'x' ); BOOST_CHECK_EQUAL( 'x', ss.fill() ); ss.imbue( locale(locale::classic(), new backward_bool_names) ); diff --git a/test/quoted_manip_test.cpp b/test/quoted_manip_test.cpp new file mode 100644 index 0000000..31c6f05 --- /dev/null +++ b/test/quoted_manip_test.cpp @@ -0,0 +1,133 @@ +// libs/io/test/quote_manip_test.cpp ----------------------------------------------- // + +// 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 + +// ---------------------------------------------------------------------------------- // + +#include +#include +#include +#include + +using boost::io::quoted; +using std::string; +using std::wstring; + +int main() +{ + + std::wstringstream wss; + + string r; // test results + + const string s0("foo"); + { + std::stringstream ss; + ss << quoted(s0); + ss >> r; + BOOST_TEST(r == "\"foo\""); + } + { + std::stringstream ss; + ss << quoted(s0); + ss >> quoted(r); + BOOST_TEST(r == "foo"); + } + + const string s0s("foo bar"); + { + std::stringstream ss; + ss << quoted(s0s); + ss >> r; + BOOST_TEST(r == "\"foo"); + } + { + std::stringstream ss; + ss << quoted(s0s); + ss >> quoted(r); + BOOST_TEST(r == "foo bar"); + } + + const string s1("foo\\bar, \" *"); + { + std::stringstream ss; + ss << quoted(s1); + ss >> r; + BOOST_TEST(r == "\"foo\\\\bar,"); + } + { + std::stringstream ss; + ss << quoted("foo\\bar, \" *"); + ss >> r; + BOOST_TEST(r == "\"foo\\\\bar,"); + } + { + std::stringstream ss; + ss << quoted(s1); + ss >> quoted(r); + BOOST_TEST(r == s1); + } + { + std::stringstream ss; + ss << quoted(s1.c_str()); + ss >> quoted(r); + BOOST_TEST(r == s1); + } + + string s2("'Jack & Jill'"); + { + std::stringstream ss; + ss << quoted(s2, '&', '\''); + ss >> quoted(r, '&', '\''); + BOOST_TEST(r == s2); + } + + wstring ws1(L"foo$bar, \" *"); + wstring wr; // test results + { + std::wstringstream wss; + wss << quoted(ws1, L'$'); + wss >> quoted(wr, L'$'); + BOOST_TEST(wr == ws1); + } + + const string s3("const string"); + { + std::stringstream ss; + ss << quoted(s3); + ss >> quoted(r); + BOOST_TEST(r == s3); + } + { + // missing end delimiter test + std::stringstream ss; + ss << "\"abc"; // load ss with faulty quoting + ss >> quoted(r); // this loops if istream error/eof not detected + BOOST_TEST(r == "abc"); + } + { + // no initial delmiter test + std::stringstream ss; + ss << "abc"; + ss >> quoted(r); + BOOST_TEST(r == "abc"); + } + { + // no initial delmiter, space in ss + std::stringstream ss; + ss << "abc def"; + ss >> quoted(r); + BOOST_TEST(r == "abc"); + } + + // these should fail to compile because the arguments are const: + // ss >> quoted(s1); + // ss >> quoted("foo"); + + return boost::report_errors(); +} From 59368c46a9596568a616c1f5bbb3049993525fbd Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Wed, 19 Jan 2011 17:37:43 +0000 Subject: [PATCH 19/20] Merge from trunk [SVN r68301] --- test/ios_state_test.cpp | 8 ++++---- test/ios_state_unit_test.cpp | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/ios_state_test.cpp b/test/ios_state_test.cpp index 0900de9..1f7fa84 100644 --- a/test/ios_state_test.cpp +++ b/test/ios_state_test.cpp @@ -16,7 +16,7 @@ #include // for boost::io::ios_flags_saver, etc. #include // for std::size_t -#include // for boost::detail::setw +#include // for std::setw #include // for std::ios_base, std::streamsize, etc. #include // for std::cout, etc. #include // for std::istream @@ -143,7 +143,7 @@ saver_tests_1 { using std::locale; using std::ios_base; - using boost::detail::setw; + using std::setw; boost::io::ios_flags_saver const ifls( output ); boost::io::ios_precision_saver const iprs( output ); @@ -168,8 +168,8 @@ saver_tests_1 output.fill( '@' ); output.precision( 9 ); output << '\t' << test_string << '\n'; - output << '\t' << boost::detail::setw( 10 ) << test_num1 << '\n'; - output << '\t' << boost::detail::setw( 15 ) << test_num2 << '\n'; + output << '\t' << setw( 10 ) << test_num1 << '\n'; + output << '\t' << setw( 15 ) << test_num2 << '\n'; output.imbue( loc ); output << '\t' << test_bool << '\n'; diff --git a/test/ios_state_unit_test.cpp b/test/ios_state_unit_test.cpp index 0d5969c..72ce7b5 100644 --- a/test/ios_state_unit_test.cpp +++ b/test/ios_state_unit_test.cpp @@ -13,7 +13,7 @@ #include // for main, BOOST_CHECK, etc. #include // for NULL -#include // for boost::detail::setiosflags, etc. +#include // for std::setiosflags, etc. #include // for std::ios_base #include // for std::cout, std::cerr, etc. #include // for std::iostream @@ -77,7 +77,7 @@ ios_flags_saver_unit_test BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal), ss.flags() ); - ss << boost::detail::setiosflags( ios_base::unitbuf ); + ss << setiosflags( ios_base::unitbuf ); BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal | ios_base::unitbuf), ss.flags() ); } @@ -102,7 +102,7 @@ ios_precision_saver_unit_test BOOST_CHECK_EQUAL( 6, ss.precision() ); - ss << boost::detail::setprecision( 4 ); + ss << setprecision( 4 ); BOOST_CHECK_EQUAL( 4, ss.precision() ); } @@ -113,7 +113,7 @@ ios_precision_saver_unit_test BOOST_CHECK_EQUAL( 8, ss.precision() ); - ss << boost::detail::setprecision( 10 ); + ss << setprecision( 10 ); BOOST_CHECK_EQUAL( 10, ss.precision() ); } @@ -137,7 +137,7 @@ ios_width_saver_unit_test BOOST_CHECK_EQUAL( 0, ss.width() ); - ss << boost::detail::setw( 4 ); + ss << setw( 4 ); BOOST_CHECK_EQUAL( 4, ss.width() ); } @@ -148,7 +148,7 @@ ios_width_saver_unit_test BOOST_CHECK_EQUAL( 8, ss.width() ); - ss << boost::detail::setw( 10 ); + ss << setw( 10 ); BOOST_CHECK_EQUAL( 10, ss.width() ); } @@ -507,7 +507,7 @@ ios_base_all_saver_unit_test BOOST_CHECK_EQUAL( 6, ss.precision() ); BOOST_CHECK_EQUAL( 0, ss.width() ); - ss << hex << unitbuf << boost::detail::setprecision( 5 ) << boost::detail::setw( 7 ); + ss << hex << unitbuf << setprecision( 5 ) << setw( 7 ); BOOST_CHECK_EQUAL( (ios_base::unitbuf | ios_base::hex | ios_base::skipws), ss.flags() ); BOOST_CHECK_EQUAL( 5, ss.precision() ); @@ -560,10 +560,10 @@ ios_all_saver_unit_test ss << oct << showpos << noskipws; BOOST_CHECK_EQUAL( (ios_base::showpos | ios_base::oct), ss.flags() ); - ss << boost::detail::setprecision( 3 ); + ss << setprecision( 3 ); BOOST_CHECK_EQUAL( 3, ss.precision() ); - ss << boost::detail::setw( 9 ); + ss << setw( 9 ); BOOST_CHECK_EQUAL( 9, ss.width() ); ss.setstate( ios_base::eofbit ); @@ -586,7 +586,7 @@ ios_all_saver_unit_test ss.rdbuf( cerr.rdbuf() ); BOOST_CHECK_EQUAL( cerr.rdbuf(), ss.rdbuf() ); - ss << boost::detail::setfill( 'x' ); + ss << setfill( 'x' ); BOOST_CHECK_EQUAL( 'x', ss.fill() ); ss.imbue( locale(locale::classic(), new backward_bool_names) ); From 182290cf767d235988215ec9e2871988036b5b58 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Mon, 15 Feb 2021 20:48:26 -0500 Subject: [PATCH 20/20] Update Appveyor configuration --- .appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index 220fc08..c9ba24a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -14,10 +14,13 @@ environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 TOOLSET: msvc-9.0 + ADDRMD: 32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 TOOLSET: msvc-10.0 + ADDRMD: 32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 TOOLSET: msvc-11.0 + ADDRMD: 32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 TOOLSET: msvc-12.0 ADDRMD: 32,64