Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75584 - in trunk: boost/chrono/io libs/chrono/example
From: vicente.botet_at_[hidden]
Date: 2011-11-21 02:07:30


Author: viboes
Date: 2011-11-21 02:07:27 EST (Mon, 21 Nov 2011)
New Revision: 75584
URL: http://svn.boost.org/trac/boost/changeset/75584

Log:
Chrono: renamed some functions in duration_units
Text files modified:
   trunk/boost/chrono/io/duration_get.hpp | 22 +-
   trunk/boost/chrono/io/duration_put.hpp | 3
   trunk/boost/chrono/io/duration_units.hpp | 363 +++++++++++++++++++++++++++------------
   trunk/boost/chrono/io/time_point_put.hpp | 3
   trunk/libs/chrono/example/french.cpp | 6
   5 files changed, 266 insertions(+), 131 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-21 02:07:27 EST (Mon, 21 Nov 2011)
@@ -294,9 +294,7 @@
         // num / den is now factor to multiply by r
         if (!detail::reduce(r, den, err)) return s;
 
- //if (r > ( (duration_values<common_type_t>::max)() / num))
         if (chrono::detail::gt(r, ( (duration_values<common_type_t>::max)() / num)))
- //if (common_type_t(r) > ( (duration_values<common_type_t>::max)() / num))
         {
           // Conversion to Period overflowed
           err |= std::ios_base::failbit;
@@ -447,11 +445,11 @@
             return i;
           }
           // parse s or second or seconds
- return do_get_n_d_prefix_unit(facet, i, e, is, err);
+ return do_get_n_d_valid_unit(facet, i, e, is, err);
         }
         else
         {
- return do_get_prefix_unit(facet, i, e, is, err, rt);
+ return do_get_valid_unit(facet, i, e, is, err, rt);
         }
       }
 
@@ -482,18 +480,18 @@
        * @param err the ios_base state.
        * @return @c s
        */
- virtual iter_type do_get_n_d_prefix_unit(duration_units<CharT> const &facet, iter_type i, iter_type e,
+ virtual iter_type do_get_n_d_valid_unit(duration_units<CharT> const &facet, iter_type i, iter_type e,
           std::ios_base&, std::ios_base::iostate& err) const
       {
         // parse SI name, short or long
 
- const string_type* units = facet.get_n_d_prefix_units_start();
- const string_type* units_end = facet.get_n_d_prefix_units_end();
+ const string_type* units = facet.get_n_d_valid_units_start();
+ const string_type* units_end = facet.get_n_d_valid_units_end();
 
         const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end,
         //~ std::use_facet<std::ctype<CharT> >(loc),
             err);
- if (!facet.match_n_d_prefix_unit(k))
+ if (!facet.match_n_d_valid_unit(k))
         {
           err |= std::ios_base::failbit;
         }
@@ -516,20 +514,20 @@
        * @Effects
        * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name.
        */
- virtual iter_type do_get_prefix_unit(duration_units<CharT> const &facet, iter_type i, iter_type e,
+ virtual iter_type do_get_valid_unit(duration_units<CharT> const &facet, iter_type i, iter_type e,
           std::ios_base&, std::ios_base::iostate& err, rt_ratio &rt) const
       {
         // parse SI name, short or long
 
- const string_type* units = facet.get_prefix_units_start();
- const string_type* units_end = facet.get_prefix_units_end();
+ const string_type* units = facet.get_valid_units_start();
+ const string_type* units_end = facet.get_valid_units_end();
 
         err = std::ios_base::goodbit;
         const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end,
         //~ std::use_facet<std::ctype<CharT> >(loc),
             err);
 
- if (!facet.match_prefix_unit(k, rt))
+ if (!facet.match_valid_unit(k, rt))
         {
           err |= std::ios_base::failbit;
         }

Modified: trunk/boost/chrono/io/duration_put.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_put.hpp (original)
+++ trunk/boost/chrono/io/duration_put.hpp 2011-11-21 02:07:27 EST (Mon, 21 Nov 2011)
@@ -29,9 +29,6 @@
      * The @c duration_put facet provides facilities for formatted output of duration values.
      * The member function of @c duration_put take a duration and translate this into character string representation.
      *
- * FIXME As the facet doesn't have any data, I'm wondering if this should functions
- * shouldn't be at the namespace level or static member functions.
- * This will leverage the user to need to ensure that the facet is imbued on the ios_base.
      */
     template <class CharT, class OutputIterator = std::ostreambuf_iterator<CharT> >
     class duration_put: public std::locale::facet

Modified: trunk/boost/chrono/io/duration_units.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_units.hpp (original)
+++ trunk/boost/chrono/io/duration_units.hpp 2011-11-21 02:07:27 EST (Mon, 21 Nov 2011)
@@ -148,42 +148,83 @@
        */
       typedef std::basic_string<CharT> string_type;
 
+ /**
+ * Unique identifier for this type of facet.
+ */
       static std::locale::id id;
 
+ /**
+ * Construct a @c duration_units facet.
+ * @param refs
+ * @Effects Construct a @c duration_units facet.
+ * If the @c refs argument is @c 0 then destruction of the object is
+ * delegated to the @c locale, or locales, containing it. This allows
+ * the user to ignore lifetime management issues. On the other had,
+ * if @c refs is @c 1 then the object must be explicitly deleted;
+ * the @c locale will not do so. In this case, the object can be
+ * maintained across the lifetime of multiple locales.
+ */
       explicit duration_units(size_t refs = 0) :
         std::locale::facet(refs)
       {
       }
 
- const string_type* get_n_d_prefix_units_start() const
+ /**
+ * @effect calls the do_...
+ * @return pointer to the start of valid [N/D] units.
+ */
+ const string_type* get_n_d_valid_units_start() const
       {
- return do_get_n_d_prefix_units_start();
+ return do_get_n_d_valid_units_start();
       }
- const string_type* get_n_d_prefix_units_end() const
+ /**
+ * @effect calls the do_...
+ * @return pointer to the end of valid [N/D] units.
+ */
+ const string_type* get_n_d_valid_units_end() const
       {
- return do_get_n_d_prefix_units_end();
+ return do_get_n_d_valid_units_end();
       }
 
- const string_type* get_prefix_units_start() const
+ /**
+ * @effect calls the do_...
+ * @return pointer to the start of valid units, symbol or prefix with its different plural forms.
+ */
+ const string_type* get_valid_units_start() const
       {
- return do_get_prefix_units_start();
+ return do_get_valid_units_start();
       }
- const string_type* get_prefix_units_end() const
+ /**
+ * @effect calls the do_...
+ * @return pointer to the end of valid units.
+ */
+ const string_type* get_valid_units_end() const
       {
- return do_get_prefix_units_end();
+ return do_get_valid_units_end();
       }
 
- bool match_n_d_prefix_unit(const string_type* k) const
+ /**
+ * @effect calls the do_...
+ * @param k the found pointer to the [N/D] unit.
+ * @return true if @c k matches a valid unit.
+ */
+ bool match_n_d_valid_unit(const string_type* k) const
       {
- return do_match_n_d_prefix_unit(k);
+ return do_match_n_d_valid_unit(k);
       }
- bool match_prefix_unit(const string_type* k, rt_ratio& rt) const
+ /**
+ * @param k the found pointer to the unit.
+ * @effect calls the do_...
+ * @Effects @c rt is set to the valid Period when the @c k matches a valid unit.
+ * @return true if @c k matches a valid unit.
+ */
+ bool match_valid_unit(const string_type* k, rt_ratio& rt) const
       {
- return do_match_prefix_unit(k, rt);
+ return do_match_valid_unit(k, rt);
       }
 
       /**
- *
+ * @effect calls the do_...
        * @return the pattern to be used by default.
        */
       string_type get_pattern() const
@@ -191,24 +232,28 @@
         return do_get_pattern();
       }
       /**
- *
+ * @effect calls the do_...
        * @return the unit associated to this duration.
        */
       template <typename Rep, typename Period>
       string_type get_unit(duration_style::type style, duration<Rep, Period> const& d) const
       {
- return do_get_unit(style, rt_ratio(Period()), d.count());
+ return do_get_unit(style, rt_ratio(Period()), static_cast<intmax_t>(d.count()));
       }
       /**
- *
- * @return the unit associated to this duration.
+ * @effect calls the do_...
+ * @return the [N/D] suffix unit associated to this duration.
        */
       template <typename Rep, typename Period>
       string_type get_n_d_unit(duration_style::type style, duration<Rep, Period> const& d) const
       {
- return do_get_n_d_unit(style, rt_ratio(Period()), d.count());
+ return do_get_n_d_unit(style, rt_ratio(Period()), static_cast<intmax_t>(d.count()));
       }
 
+ /**
+ * @effect calls the do_...
+ * @return true if the unit associated to the given Period is named, false otherwise.
+ */
       template <typename Period>
       bool is_named_unit() const
       {
@@ -218,18 +263,55 @@
 
     protected:
 
+ /**
+ * @Effects Destroys the facet
+ */
       virtual ~duration_units()
       {
       }
+ /**
+ * @return the pattern to be used by default.
+ */
       virtual string_type do_get_pattern() const=0;
- virtual const string_type* do_get_n_d_prefix_units_start() const = 0;
- virtual const string_type* do_get_n_d_prefix_units_end() const = 0;
- virtual const string_type* do_get_prefix_units_start() const = 0;
- virtual const string_type* do_get_prefix_units_end() const = 0;
- virtual bool do_match_n_d_prefix_unit(const string_type* k) const = 0;
- virtual bool do_match_prefix_unit(const string_type* k, rt_ratio& rt) const = 0;
+ /**
+ * @return pointer to the start of valid [N/D] units.
+ */
+ virtual const string_type* do_get_n_d_valid_units_start() const = 0;
+ /**
+ * @return pointer to the end of valid [N/D] units.
+ */
+ virtual const string_type* do_get_n_d_valid_units_end() const = 0;
+ /**
+ * @return pointer to the start of valid units, symbol or prefix with its different plural forms.
+ */
+ virtual const string_type* do_get_valid_units_start() const = 0;
+ /**
+ * @return pointer to the end of valid units.
+ */
+ virtual const string_type* do_get_valid_units_end() const = 0;
+ /**
+ * @param k the found pointer to the [N/D] unit.
+ * @return true if @c k matches a valid unit.
+ */
+ virtual bool do_match_n_d_valid_unit(const string_type* k) const = 0;
+ /**
+ * @param k the found pointer to the unit.
+ * @effect calls the do_...
+ * @Effects @c rt is set to the valid Period when the @c k matches a valid unit.
+ * @return true if @c k matches a valid unit.
+ */
+ virtual bool do_match_valid_unit(const string_type* k, rt_ratio& rt) const = 0;
+ /**
+ * @return the [N/D] suffix unit associated to this duration.
+ */
       virtual string_type do_get_n_d_unit(duration_style::type style, rt_ratio rt, intmax_t v) const = 0;
+ /**
+ * @return the unit associated to this duration.
+ */
       virtual string_type do_get_unit(duration_style::type style,rt_ratio rt, intmax_t v) const = 0;
+ /**
+ * @return true if the unit associated to the given Period is named, false otherwise.
+ */
       virtual bool do_is_named_unit(rt_ratio rt) const =0;
 
     };
@@ -237,22 +319,42 @@
     template <typename CharT>
     std::locale::id duration_units<CharT>::id;
 
- // This class is used to define the strings for the default English
+ /**
+ * This class is used to define the strings for the default English
+ *
+ */
     template <typename CharT = char>
     class duration_units_default: public duration_units<CharT>
     {
       static const std::size_t pfs_ = 2;
 
     public:
+ /**
+ * Type of character the facet is instantiated on.
+ */
       typedef CharT char_type;
+ /**
+ * Type of character string passed to member functions.
+ */
       typedef std::basic_string<CharT> string_type;
 
+ /**
+ * Construct a @c duration_units_default facet.
+ * @param refs
+ * @Effects Construct a @c duration_units_default facet.
+ * If the @c refs argument is @c 0 then destruction of the object is
+ * delegated to the @c locale, or locales, containing it. This allows
+ * the user to ignore lifetime management issues. On the other had,
+ * if @c refs is @c 1 then the object must be explicitly deleted;
+ * the @c locale will not do so. In this case, the object can be
+ * maintained across the lifetime of multiple locales.
+ */
       explicit duration_units_default(size_t refs = 0) :
         duration_units<CharT> (refs)
       {
- string_type* it = n_d_prefix_units_;
+ string_type* it = n_d_valid_units_;
         it = fill_units(it, ratio<1> ());
- it = prefix_units_;
+ it = valid_units_;
         it = fill_units(it, atto());
         it = fill_units(it, femto());
         it = fill_units(it, pico());
@@ -273,15 +375,22 @@
         it = fill_units(it, ratio<60> ());
         it = fill_units(it, ratio<3600> ());
       }
+ /**
+ * Destroys the facet.
+ */
       ~duration_units_default()
       {
       }
 
     protected:
 
- bool do_match_n_d_prefix_unit(const string_type* k) const
+ /**
+ * @param k the found pointer to the [N/D] unit.
+ * @return true if @c k matches a valid unit.
+ */
+ bool do_match_n_d_valid_unit(const string_type* k) const
       {
- std::size_t index = (k - n_d_prefix_units_) / (pfs_ + 1);
+ std::size_t index = (k - n_d_valid_units_) / (pfs_ + 1);
         switch (index)
         {
         case 0:
@@ -291,9 +400,14 @@
         }
         return true;
       }
- bool do_match_prefix_unit(const string_type* k, rt_ratio& rt) const
+ /**
+ * @param k the found pointer to the unit.
+ * @Effects @c rt is set to the valid Period when the @c k matches a valid unit.
+ * @return true if @c k matches a valid unit.
+ */
+ bool do_match_valid_unit(const string_type* k, rt_ratio& rt) const
       {
- std::size_t index = (k - prefix_units_) / (pfs_ + 1);
+ std::size_t index = (k - valid_units_) / (pfs_ + 1);
         switch (index)
         {
         case 0:
@@ -359,24 +473,43 @@
         }
         return true;
       }
- const string_type* do_get_n_d_prefix_units_start() const
+
+ /**
+ * @return pointer to the start of valid [N/D] units.
+ */
+ const string_type* do_get_n_d_valid_units_start() const
       {
- return n_d_prefix_units_;
+ return n_d_valid_units_;
       }
- const string_type* do_get_n_d_prefix_units_end() const
+ /**
+ * @return pointer to the end of valid [N/D] units.
+ */
+ const string_type* do_get_n_d_valid_units_end() const
       {
- return n_d_prefix_units_ + (pfs_ + 1);
+ return n_d_valid_units_ + (pfs_ + 1);
       }
 
- const string_type* do_get_prefix_units_start() const
+ /**
+ * @return pointer to the start of valid units.
+ */
+ const string_type* do_get_valid_units_start() const
       {
- return prefix_units_;
+ return valid_units_;
       }
- const string_type* do_get_prefix_units_end() const
+ /**
+ * @return pointer to the end of valid units.
+ */
+ const string_type* do_get_valid_units_end() const
       {
- return prefix_units_ + 19 * (pfs_ + 1);
+ return valid_units_ + 19 * (pfs_ + 1);
       }
 
+ /**
+ *
+ * This facet names the units associated to the following periods:
+ * atto,femto,pico,nano,micro,milli,centi,deci,ratio<1>,deca,hecto,kilo,mega,giga,tera,peta,exa,ratio<60> and ratio<3600>.
+ * @return true if the unit associated to the given Period is named, false otherwise.
+ */
       bool do_is_named_unit(rt_ratio rt) const
       {
         if (rt.num==1) {
@@ -417,33 +550,41 @@
 
       }
 
+ /**
+ * In English the suffix used after [N/D] is the one associated to the period ratio<1>.
+ * @return the [N/D] suffix unit associated to this duration.
+ */
       std::string do_get_n_d_unit(duration_style::type style, rt_ratio, intmax_t ) const
       {
- return do_get_plural_form(style, ratio<1>(), 1);
+ return do_get_unit(style, ratio<1>(), 1);
       }
+
+ /**
+ * @return the unit associated to this duration if it is named, "" otherwise.
+ */
       std::string do_get_unit(duration_style::type style, rt_ratio rt, intmax_t v) const
       {
         if (rt.num==1) {
           switch (rt.den)
           {
           case BOOST_RATIO_INTMAX_C(1):
- return do_get_plural_form(style, ratio<1>(), do_get_plural_form(v));
+ return do_get_unit(style, ratio<1>(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(10):
- return do_get_plural_form(style, deci(), do_get_plural_form(v));
+ return do_get_unit(style, deci(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(100):
- return do_get_plural_form(style, centi(), do_get_plural_form(v));
+ return do_get_unit(style, centi(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(1000):
- return do_get_plural_form(style, milli(), do_get_plural_form(v));
+ return do_get_unit(style, milli(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(1000000):
- return do_get_plural_form(style, micro(), do_get_plural_form(v));
+ return do_get_unit(style, micro(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(1000000000):
- return do_get_plural_form(style, nano(), do_get_plural_form(v));
+ return do_get_unit(style, nano(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(1000000000000):
- return do_get_plural_form(style, pico(), do_get_plural_form(v));
+ return do_get_unit(style, pico(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(1000000000000000):
- return do_get_plural_form(style, femto(), do_get_plural_form(v));
+ return do_get_unit(style, femto(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(1000000000000000000):
- return do_get_plural_form(style, atto(), do_get_plural_form(v));
+ return do_get_unit(style, atto(), do_get_plural_form(v));
           default:
             ;
           }
@@ -451,25 +592,25 @@
           switch (rt.num)
           {
           case BOOST_RATIO_INTMAX_C(10):
- return do_get_plural_form(style, deca(), do_get_plural_form(v));
+ return do_get_unit(style, deca(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(60):
- return do_get_plural_form(style, ratio<60>(), do_get_plural_form(v));
+ return do_get_unit(style, ratio<60>(), do_get_plural_form(v));
           case BOOST_RATIO_INTMAX_C(100):
- return do_get_plural_form(style, hecto(), do_get_plural_form(v));
+ return do_get_unit(style, hecto(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(1000):
- return do_get_plural_form(style, kilo(), do_get_plural_form(v));
+ return do_get_unit(style, kilo(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(3600):
- return do_get_plural_form(style, ratio<3600>(), do_get_plural_form(v));
+ return do_get_unit(style, ratio<3600>(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(1000000):
- return do_get_plural_form(style, mega(), do_get_plural_form(v));
+ return do_get_unit(style, mega(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(1000000000):
- return do_get_plural_form(style, giga(), do_get_plural_form(v));
+ return do_get_unit(style, giga(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(1000000000000):
- return do_get_plural_form(style, tera(), do_get_plural_form(v));
+ return do_get_unit(style, tera(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(1000000000000000):
- return do_get_plural_form(style, peta(), do_get_plural_form(v));
+ return do_get_unit(style, peta(), do_get_plural_form(v));
            case BOOST_RATIO_INTMAX_C(1000000000000000000):
- return do_get_plural_form(style, exa(), do_get_plural_form(v));
+ return do_get_unit(style, exa(), do_get_plural_form(v));
            default:
              ;
            }
@@ -479,16 +620,6 @@
 
       }
 
- virtual std::size_t do_get_plural_forms() const
- {
- return pfs_;
- }
-
- virtual std::size_t do_get_plural_form(int_least64_t value) const
- {
- return (value == -1 || value == 1) ? 0 : 1;
- }
-
       string_type do_get_pattern() const
       {
         static const CharT t[] =
@@ -498,7 +629,19 @@
         return pattern;
       }
 
- string_type do_get_plural_form(duration_style_type style, ratio<1> , std::size_t pf) const
+ protected:
+ /**
+ *
+ * @param value
+ * @return
+ */
+ virtual std::size_t do_get_plural_form(int_least64_t value) const
+ {
+ return (value == -1 || value == 1) ? 0 : 1;
+ }
+
+
+ string_type do_get_unit(duration_style_type style, ratio<1> , std::size_t pf) const
       {
         static const CharT t[] =
         { 's' };
@@ -526,7 +669,7 @@
         throw "exception";
       }
 
- virtual string_type do_get_plural_form(duration_style_type style, ratio<60> , std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, ratio<60> , std::size_t pf) const
       {
         static const CharT t[] =
         { 'm', 'i', 'n' };
@@ -546,7 +689,7 @@
         throw "exception";
       }
 
- virtual string_type do_get_plural_form(duration_style_type style, ratio<3600> , std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, ratio<3600> , std::size_t pf) const
       {
         static const CharT t[] =
         { 'h' };
@@ -564,69 +707,69 @@
         // assert
         throw "exception";
       }
- virtual string_type do_get_plural_form(duration_style_type style, atto u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, atto u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, femto u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, femto u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, pico u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, pico u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, nano u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, nano u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, micro u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, micro u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, milli u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, milli u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, centi u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, centi u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, deci u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, deci u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, deca u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, deca u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, hecto u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, hecto u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, kilo u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, kilo u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, mega u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, mega u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, giga u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, giga u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, tera u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, tera u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, peta u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, peta u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
- virtual string_type do_get_plural_form(duration_style_type style, exa u, std::size_t pf) const
+ virtual string_type do_get_unit(duration_style_type style, exa u, std::size_t pf) const
       {
- return do_get_ratio_prefix(style, u) + do_get_plural_form(style, ratio<1> (), pf);
+ return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf);
       }
 
     protected:
@@ -719,10 +862,10 @@
        * @return the translation associated to the plural form given as parameter.
        */
       template <typename Period>
- typename enable_if<detail::is_localizable<Period>, string_type>::type get_plural_form(duration_style_type style,
+ typename enable_if<detail::is_localizable<Period>, string_type>::type get_unit(duration_style_type style,
           std::size_t pf) const
       {
- return do_get_plural_form(style, Period(), pf);
+ return do_get_unit(style, Period(), pf);
       }
 
     private:
@@ -731,14 +874,14 @@
       {
         for (std::size_t pf = 0; pf < pfs_; ++pf)
         {
- *it++ = get_plural_form<Period> (duration_style::prefix, pf);
+ *it++ = get_unit<Period> (duration_style::prefix, pf);
         }
- *it++ = get_plural_form<Period> (duration_style::symbol, 0);
+ *it++ = get_unit<Period> (duration_style::symbol, 0);
         return it;
       }
 
- string_type n_d_prefix_units_[3];
- string_type prefix_units_[19 * 3];
+ string_type n_d_valid_units_[3];
+ string_type valid_units_[19 * 3];
 
     };
 

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-21 02:07:27 EST (Mon, 21 Nov 2011)
@@ -30,9 +30,6 @@
      * The @c time_point_put facet provides facilities for formatted output of duration values.
      * The member function of @c time_point_put take a duration and translate this into character string representation.
      *
- * FIXME As the facet doesn't have any data, I'm wondering if this should functions
- * shouldn't be at the namespace level or static member functions.
- * This will leverage the user to need to ensure that the facet is imbued on the ios_base.
      */
     template <class CharT, class OutputIterator = std::ostreambuf_iterator<CharT> >
     class time_point_put: public std::locale::facet

Modified: trunk/libs/chrono/example/french.cpp
==============================================================================
--- trunk/libs/chrono/example/french.cpp (original)
+++ trunk/libs/chrono/example/french.cpp 2011-11-21 02:07:27 EST (Mon, 21 Nov 2011)
@@ -40,7 +40,7 @@
         return (value == -1 || value == 0 || value == 1) ? 0 : 1;
       }
 
- std::basic_string<CharT> do_get_plural_form(duration_style_type style, ratio<1> , std::size_t pf) const
+ std::basic_string<CharT> do_get_unit(duration_style_type style, ratio<1> , std::size_t pf) const
       {
         static const CharT t[] =
         { 's' };
@@ -59,7 +59,7 @@
         throw "exception";
       }
 
- std::basic_string<CharT> do_get_plural_form(duration_style_type style, ratio<60> , std::size_t pf) const
+ std::basic_string<CharT> do_get_unit(duration_style_type style, ratio<60> , std::size_t pf) const
       {
         static const CharT t[] =
         { 'm', 'i', 'n' };
@@ -79,7 +79,7 @@
         throw "exception";
       }
 
- std::basic_string<CharT> do_get_plural_form(duration_style_type style, ratio<3600> , std::size_t pf) const
+ std::basic_string<CharT> do_get_unit(duration_style_type style, ratio<3600> , std::size_t pf) const
       {
         static const CharT t[] =
         { 'h' };


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