Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75419 - trunk/boost/chrono/io
From: vicente.botet_at_[hidden]
Date: 2011-11-08 17:58:18


Author: viboes
Date: 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
New Revision: 75419
URL: http://svn.boost.org/trac/boost/changeset/75419

Log:
Chrono: Removed unused files io/duration_unit_string.hpp and io/translate.hpp
Removed:
   trunk/boost/chrono/io/duration_unit_string.hpp
   trunk/boost/chrono/io/translate.hpp
Text files modified:
   trunk/boost/chrono/io/duration_get.hpp | 3 +--
   trunk/boost/chrono/io/duration_io.hpp | 1 -
   trunk/boost/chrono/io/time_point_io.hpp | 2 +-
   trunk/boost/chrono/io/time_point_put.hpp | 32 ++++++++++++++++++++++++++++++++
   trunk/boost/chrono/io/time_point_units.hpp | 9 +++++++++
   5 files changed, 43 insertions(+), 4 deletions(-)

Modified: trunk/boost/chrono/io/duration_get.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_get.hpp (original)
+++ trunk/boost/chrono/io/duration_get.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
@@ -211,7 +211,7 @@
                     return s;
                   }
                   unit_found=true;
- s = get_unit<Rep>(s, end, ios, err, rt);
+ s = get_unit(s, end, ios, err, rt);
                   if ( err & (std::ios_base::badbit |std::ios_base::failbit) )
                   {
                     return s;
@@ -352,7 +352,6 @@
        * @Effects Calls do_put_unit(s, ios, d).
        * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name
        */
- template <typename Rep>
       iter_type get_unit(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err,
           detail::rt_ratio &rt) const
       {

Modified: trunk/boost/chrono/io/duration_io.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_io.hpp (original)
+++ trunk/boost/chrono/io/duration_io.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
@@ -15,7 +15,6 @@
 #include <boost/chrono/chrono.hpp>
 #include <boost/ratio/ratio_io.hpp>
 #include <boost/chrono/io/duration_style.hpp>
-#include <boost/chrono/io/duration_unit_string.hpp>
 #include <boost/chrono/io/ios_base_state.hpp>
 #include <boost/chrono/io/duration_put.hpp>
 #include <boost/chrono/io/duration_get.hpp>

Deleted: trunk/boost/chrono/io/duration_unit_string.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_unit_string.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
+++ (empty file)
@@ -1,218 +0,0 @@
-//
-// (C) Copyright Howard Hinnant
-// (C) Copyright 2010-2011 Vicente J. Botet Escriba
-// Use, modification and distribution are subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt).
-//
-
-#ifndef BOOST_CHRONO_IO_DURATION_UNIT_STRING_HPP
-#define BOOST_CHRONO_IO_DURATION_UNIT_STRING_HPP
-
-#include <boost/chrono/config.hpp>
-#include <boost/chrono/duration.hpp>
-#include <boost/ratio/ratio_io.hpp>
-#include <boost/chrono/io/duration_style.hpp>
-#include <boost/chrono/io/translate.hpp>
-#include <boost/chrono/io/duration_units.hpp>
-
-#include <string>
-#include <locale>
-
-namespace boost
-{
- template <>
- struct ratio_string_is_localizable<ratio<60> > : true_type
- {
- };
-
- template <>
- struct ratio_string_id<ratio<60> > : integral_constant<int, 60>
- {
- };
-
- template <>
- struct ratio_string_is_localizable<ratio<3600> > : true_type
- {
- };
-
- template <>
- struct ratio_string_id<ratio<3600> > : integral_constant<int, 3600>
- {
- };
-
- namespace chrono
- {
-
- template <class CharT>
- struct value
- {
- static std::basic_string<CharT> name()
- {
- static const CharT u[] =
- { '%', '1', '%', ' ' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- };
- template <class CharT>
- struct period
- {
- static std::basic_string<CharT> name()
- {
- static const CharT u[] =
- { '%', '2', '%' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- };
-
- template <class Period, class CharT>
- struct duration_unit_strings
- {
- static std::basic_string<CharT> plural()
- {
- static const CharT u[] =
- { 's', 'e', 'c', 'o', 'n', 'd', 's' };
- static const std::basic_string<CharT> suffix(u, u + sizeof (u) / sizeof (u[0]));
- return ::boost::ratio_string<Period, CharT>::prefix() + suffix;
- }
- static std::basic_string<CharT> singular()
- {
- static const CharT u[] =
- { 's', 'e', 'c', 'o', 'n', 'd' };
- static const std::basic_string<CharT> suffix(u, u + sizeof (u) / sizeof (u[0]));
- return ::boost::ratio_string<Period, CharT>::prefix() + suffix;
- }
- static std::basic_string<CharT> symbol()
- {
- static const std::basic_string<CharT> str(1, 's');
- return ::boost::ratio_string<Period, CharT>::symbol() + str;
- }
- };
-
- template <class CharT>
- struct duration_unit_strings<ratio<1> , CharT>
- {
- static std::basic_string<CharT> plural()
- {
- static const CharT u[] =
- { 's', 'e', 'c', 'o', 'n', 'd', 's' };
- static const std::basic_string<CharT> suffix(u, u + sizeof (u) / sizeof (u[0]));
- return suffix;
- }
- static std::basic_string<CharT> singular()
- {
- static const CharT u[] =
- { 's', 'e', 'c', 'o', 'n', 'd' };
- static const std::basic_string<CharT> suffix(u, u + sizeof (u) / sizeof (u[0]));
- return suffix;
- }
- static std::basic_string<CharT> symbol()
- {
- static const std::basic_string<CharT> str(1, 's');
- return str;
- }
- };
-
- template <class CharT>
- struct duration_unit_strings<ratio<60> , CharT>
- {
- static std::basic_string<CharT> plural()
- {
- static const CharT u[] =
- { 'm', 'i', 'n', 'u', 't', 'e', 's' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- static std::basic_string<CharT> singular()
- {
- static const CharT u[] =
- { 'm', 'i', 'n', 'u', 't', 'e' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- static std::basic_string<CharT> symbol()
- {
- static const CharT u[] =
- { 'm', 'i', 'n' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- };
-
- template <class CharT>
- struct duration_unit_strings<ratio<3600> , CharT>
- {
- static std::basic_string<CharT> plural()
- {
- static const CharT u[] =
- { 'h', 'o', 'u', 'r', 's' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- static std::basic_string<CharT> singular()
- {
- static const CharT u[] =
- { 'h', 'o', 'u', 'r' };
- static const std::basic_string<CharT> str(u, u + sizeof (u) / sizeof (u[0]));
- return str;
- }
- static std::basic_string<CharT> symbol()
- {
- static const std::basic_string<CharT> str(1, 'h');
- return str;
- }
- };
-
- template <class CharT, class Rep, class Period>
- std::basic_string<CharT> duration_unit(std::locale const &loc, bool is_prefix, duration<Rep, Period> const& d)
- {
- if (is_prefix)
- {
- return translate(loc, ratio_string_id<Period> (), duration_unit_strings<Period, CharT>::singular(),
- duration_unit_strings<Period, CharT>::plural(), d.count());
- }
- else
- {
- return translate(loc, ratio_string_id<Period> (), duration_unit_strings<Period, CharT>::symbol());
- }
- }
-
- template <class CharT, class Rep, class Period>
- std::basic_string<CharT> translated_duration_unit(std::locale const &loc, bool is_prefix,
- duration<Rep, Period> const& d)
- {
- if (is_prefix)
- {
- return translate(loc, ratio_string_id<Period> (),
- value<CharT>::name() + duration_unit_strings<Period, CharT>::singular(),
- value<CharT>::name() + duration_unit_strings<Period, CharT>::plural(), d.count());
- }
- else
- {
- return translate(loc, ratio_string_id<Period> (),
- value<CharT>::name() + duration_unit_strings<Period, CharT>::symbol());
- }
- }
-
- template <class CharT, class Period>
- std::basic_string<CharT> translated_duration_unit(std::locale const &loc, bool is_prefix)
- {
- if (is_prefix)
- {
- return translate(loc, ratio_string_id<Period> (),
- value<CharT>::name() + period<CharT>::name() + duration_unit_strings<Period, CharT>::plural());
- }
- else
- {
- return translate(loc, ratio_string_id<Period> (),
- value<CharT>::name() + period<CharT>::name() + duration_unit_strings<Period, CharT>::symbol());
- }
- }
-
- } // chrono
-
-}
-
-#endif // BOOST_CHRONO_CHRONO_IO_HPP

Modified: trunk/boost/chrono/io/time_point_io.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_io.hpp (original)
+++ trunk/boost/chrono/io/time_point_io.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
@@ -384,7 +384,7 @@
           timezone_type tz = get_timezone(os);
           std::locale loc = os.getloc();
           time_t t = system_clock::to_time_t(tp);
- tm tm;
+ std::tm tm;
           if (tz == timezone::local)
           {
 #if defined BOOST_WINDOWS && ! defined(__CYGWIN__)

Modified: trunk/boost/chrono/io/time_point_put.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_put.hpp (original)
+++ trunk/boost/chrono/io/time_point_put.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
@@ -154,6 +154,38 @@
         return put(s, ios, tp, str.data(), str.data() + str.size());
       }
 
+// /*
+// *
+// */
+//
+// template <class Clock, class Duration>
+// iter_type put(iter_type s, std::ios_base& ios, time_point<Clock, Duration> const& tp, const CharT* pattern,
+// const CharT* pat_end) const
+// {
+// time_point_units<CharT,OutputIterator> const& units_facet = time_point_units<CharT,OutputIterator>::imbue_if_has_not(ios);
+//
+// return s;
+// }
+
+// /**
+// *
+// * @param s an output stream iterator
+// * @param ios a reference to a ios_base
+// * @param d the duration
+// * @Effects imbue in @c ios the @c time_point_units_default facet if not already present.
+// * Retrieves Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if
+// * @code
+// * return put(s, ios, d, str.data(), str.data() + str.size());
+// * @codeend
+// * @Returns An iterator pointing immediately after the last character produced.
+// */
+// template <class Duration>
+// iter_type put(iter_type s, std::ios_base& ios, time_point<system_clock, Duration> const& tp) const
+// {
+// std::basic_string<CharT> str = time_point_units<CharT,OutputIterator>::imbue_if_has_not(ios).get_date_time_pattern();
+// return put(s, ios, tp, str.data(), str.data() + str.size());
+// }
+
       /**
        *
        * @param s an output stream iterator

Modified: trunk/boost/chrono/io/time_point_units.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_units.hpp (original)
+++ trunk/boost/chrono/io/time_point_units.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
@@ -179,6 +179,15 @@
 
         return pattern;
       }
+// std::basic_string<CharT> get_date_time_pattern() const
+// {
+// static const CharT t[] =
+// { '%', 'd', '%', 'e' };
+// static const std::basic_string<CharT> pattern(t, t + sizeof (t) / sizeof (t[0]));
+//
+// return pattern;
+// }
+
 
       iter_type do_put(iter_type s, std::ios_base& , system_clock c) const
       {

Deleted: trunk/boost/chrono/io/translate.hpp
==============================================================================
--- trunk/boost/chrono/io/translate.hpp 2011-11-08 17:58:16 EST (Tue, 08 Nov 2011)
+++ (empty file)
@@ -1,67 +0,0 @@
-//
-// (C) Copyright Howard Hinnant
-// (C) Copyright 2011 Vicente J. Botet Escriba
-// Use, modification and distribution are subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt).
-//
-
-#ifndef BOOST_CHRONO_IO_TRANSLATE_HPP
-#define BOOST_CHRONO_IO_TRANSLATE_HPP
-
-#include <boost/chrono/config.hpp>
-#include <string>
-#include <locale>
-
-namespace boost
-{
- namespace chrono
- {
-
-#if !defined BOOST_CHRONO_SPECIFIC_TRANSLATE
- template <class CharT, class Rep>
- std::basic_string<CharT> duration_prefix_translate(std::basic_string<CharT> const &singular,
- std::basic_string<CharT> const &plural, Rep v)
- {
- if (v == 1)
- return singular;
- if (v == -1)
- return singular;
- return plural;
- }
-
- template <class CharT>
- std::basic_string<CharT> duration_symbol_translate(std::basic_string<CharT> const &symbol)
- {
- return symbol;
- }
-
- template <class CharT>
- std::basic_string<CharT> epoch_translate(std::basic_string<CharT> const &epoch)
- {
- return epoch;
- }
- template <class CharT>
- std::basic_string<CharT> translate(std::locale const &, int, std::basic_string<CharT> const &dfault)
- {
- return dfault;
- }
-
- template <class CharT>
- std::basic_string<CharT> translate(std::locale const &, int, std::basic_string<CharT> const &singular,
- std::basic_string<CharT> const &plural, int v)
- {
- if (v == 1)
- return singular;
- if (v == -1)
- return singular;
- return plural;
- }
-
-#endif
-
- } // chrono
-
-}
-
-#endif // BOOST_CHRONO_CHRONO_IO_HPP


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