Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56166 - in sandbox/explore: boost/explore libs/explore/test
From: jeff_at_[hidden]
Date: 2009-09-12 22:14:37


Author: jefffaust
Date: 2009-09-12 22:14:36 EDT (Sat, 12 Sep 2009)
New Revision: 56166
URL: http://svn.boost.org/trac/boost/changeset/56166

Log:
Give quote_strings, no_quote_strings the same interface as boolalpha, noboolalpha.
Text files modified:
   sandbox/explore/boost/explore/manipulators.hpp | 29 +++++++++++++----------------
   sandbox/explore/libs/explore/test/quote_strings.cpp | 6 +++---
   2 files changed, 16 insertions(+), 19 deletions(-)

Modified: sandbox/explore/boost/explore/manipulators.hpp
==============================================================================
--- sandbox/explore/boost/explore/manipulators.hpp (original)
+++ sandbox/explore/boost/explore/manipulators.hpp 2009-09-12 22:14:36 EDT (Sat, 12 Sep 2009)
@@ -177,11 +177,6 @@
         {
             explore::get_stream_state<container_common_stream_state>(ostr)->set_itemwidth(sz);
         }
-
- void quotestringsFn(std::ios_base& ostr, bool qs)
- {
- explore::get_stream_state<container_common_stream_state>(ostr)->set_quote_strings(qs);
- }
     }
     
     template<typename Elem>
@@ -288,17 +283,19 @@
     {
         return explore::get_stream_state<container_common_stream_state>(ostr)->itemwidth();
     }
-
- detail::manipfunc<bool> quote_strings()
- {
- return detail::manipfunc<bool>(detail::quotestringsFn, true);
- }
-
- detail::manipfunc<bool> no_quote_strings()
- {
- return detail::manipfunc<bool>(detail::quotestringsFn, false);
- }
-
+
+ std::ios_base& quote_strings(std::ios_base& ios)
+ {
+ get_stream_state<container_common_stream_state>(ios)->set_quote_strings(true);
+ return ios;
+ }
+
+ std::ios_base& no_quote_strings(std::ios_base& ios)
+ {
+ get_stream_state<container_common_stream_state>(ios)->set_quote_strings(false);
+ return ios;
+ }
+
     template<typename Elem, typename Tr>
     bool get_quote_strings(std::basic_ostream<Elem, Tr>& ostr)
     {

Modified: sandbox/explore/libs/explore/test/quote_strings.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/quote_strings.cpp (original)
+++ sandbox/explore/libs/explore/test/quote_strings.cpp 2009-09-12 22:14:36 EDT (Sat, 12 Sep 2009)
@@ -31,9 +31,9 @@
 
     reset(str_out);
 
- str_out << quote_strings() << mis;
+ str_out << quote_strings << mis;
     BOOST_CHECK_EQUAL(output(str_out), "[1:\"first\", 2:\"second\"]");
- str_out << no_quote_strings() << mis;
+ str_out << no_quote_strings << mis;
     BOOST_CHECK_EQUAL(output(str_out), "[1:\"first\", 2:\"second\"][1:first, 2:second]");
 }
 
@@ -47,7 +47,7 @@
     std::vector<string_type> vs;
     vs.push_back(str_to<C>("1234"));
     vs.push_back(str_to<C>("5678"));
- str_out << quote_strings() << item_width(7) << vs;
+ str_out << quote_strings << item_width(7) << vs;
 
     BOOST_CHECK_EQUAL(output(str_out), "[ \"1234\", \"5678\"]");
 }


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