Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74372 - sandbox/stopwatches/boost/chrono/stopwatches/formatters
From: vicente.botet_at_[hidden]
Date: 2011-09-14 02:06:40


Author: viboes
Date: 2011-09-14 02:06:39 EDT (Wed, 14 Sep 2011)
New Revision: 74372
URL: http://svn.boost.org/trac/boost/changeset/74372

Log:
Stopwatches: Adding a parameterized duration_fmt manimulator
Text files modified:
   sandbox/stopwatches/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp | 12 +++++++++---
   sandbox/stopwatches/boost/chrono/stopwatches/formatters/oneshot_formatter.hpp | 4 +++-
   2 files changed, 12 insertions(+), 4 deletions(-)

Modified: sandbox/stopwatches/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp 2011-09-14 02:06:39 EDT (Wed, 14 Sep 2011)
@@ -45,18 +45,24 @@
             style_(symbol)
       {
       }
+ basic_elapsed_formatter(ostream_type& o) :
+ internal_fmt_(BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT_DEFAULT),
+ fmt_(internal_fmt_), precision_(3), os_(os),
+ style_(symbol)
+ {
+ }
       basic_elapsed_formatter(const char* fmt, ostream_type& os=std::cout) :
         internal_fmt_(fmt), fmt_(internal_fmt_), precision_(3), os_(os),
         style_(symbol)
       {
       }
- basic_elapsed_formatter(string_type const& fmt) :
- internal_fmt_(fmt), fmt_(internal_fmt_), precision_(3), os_(std::cout),
+ basic_elapsed_formatter(string_type const& fmt, ostream_type& os=std::cout) :
+ internal_fmt_(fmt), fmt_(internal_fmt_), precision_(3), os_(os),
         style_(symbol)
       {
       }
       basic_elapsed_formatter(format_type & fmt) :
- fmt_(fmt), precision_(3), os_(std::cout),
+ fmt_(fmt), precision_(3), os_(os),
         style_(symbol)
       {
       }

Modified: sandbox/stopwatches/boost/chrono/stopwatches/formatters/oneshot_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/formatters/oneshot_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/formatters/oneshot_formatter.hpp 2011-09-14 02:06:39 EDT (Wed, 14 Sep 2011)
@@ -18,8 +18,10 @@
 #include <cstring>
 #include <cassert>
 #include <boost/assert.hpp>
+#include <boost/chrono/stopwatches/formatters/duration_style.hpp>
+#include <boost/chrono/chrono_io.hpp>
 
-#define BOOST_CHRONO_STOPWATCHES_ONESHOOT_FORMAT_DEFAULT "%ds\n"
+#define BOOST_CHRONO_STOPWATCHES_ONESHOOT_FORMAT_DEFAULT "%d\n"
 
 namespace boost
 {


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