]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/date_time/period_formatter.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / date_time / period_formatter.hpp
index 961061283419368c8a64fce2c90cc68fdf8ae649..2b46c3a01b873b8008381b1303d7b819e5a8c3d2 100644 (file)
@@ -3,14 +3,17 @@
 #define DATETIME_PERIOD_FORMATTER_HPP___
 
 /* Copyright (c) 2002-2004 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
  * $Date$
  */
 
-
+#include <iosfwd>
+#include <string>
+#include <vector>
+#include <iterator>
 
 namespace boost { namespace date_time {
 
@@ -19,14 +22,14 @@ namespace boost { namespace date_time {
   /*! Provides settings for the following:
    *   - period_separator -- default '/'
    *   - period_open_start_delimeter -- default '['
-   *   - period_open_range_end_delimeter -- default ')' 
-   *   - period_closed_range_end_delimeter -- default ']' 
+   *   - period_open_range_end_delimeter -- default ')'
+   *   - period_closed_range_end_delimeter -- default ']'
    *   - display_as_open_range, display_as_closed_range -- default closed_range
    *
    *  Thus the default formatting for a period is as follows:
    *@code
    *  [period.start()/period.last()]
-   *@endcode 
+   *@endcode
    *  So for a typical date_period this would be
    *@code
    *  [2004-Jan-04/2004-Feb-01]
@@ -34,13 +37,13 @@ namespace boost { namespace date_time {
    * where the date formatting is controlled by the date facet
    */
   template <class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
-  class period_formatter { 
+  class period_formatter {
   public:
     typedef std::basic_string<CharT> string_type;
     typedef CharT                    char_type;
     typedef typename std::basic_string<char_type>::const_iterator const_itr_type;
     typedef std::vector<std::basic_string<CharT> > collection_type;
-    
+
     static const char_type default_period_separator[2];
     static const char_type default_period_start_delimeter[2];
     static const char_type default_period_open_range_end_delimeter[2];
@@ -49,8 +52,8 @@ namespace boost { namespace date_time {
     enum range_display_options { AS_OPEN_RANGE, AS_CLOSED_RANGE };
 
     //! Constructor that sets up period formatter options -- default should suffice most cases.
-    period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE, 
-                     const char_type* const period_separator = default_period_separator, 
+    period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE,
+                     const char_type* const period_separator = default_period_separator,
                      const char_type* const period_start_delimeter = default_period_start_delimeter,
                      const char_type* const period_open_range_end_delimeter = default_period_open_range_end_delimeter,
                      const char_type* const period_closed_range_end_delimeter = default_period_closed_range_end_delimeter) :
@@ -62,7 +65,7 @@ namespace boost { namespace date_time {
     {}
 
     //! Puts the characters between period elements into stream -- default is /
-    OutItrT put_period_separator(OutItrT& oitr) const 
+    OutItrT put_period_separator(OutItrT& oitr) const
     {
       const_itr_type ci = m_period_separator.begin();
       while (ci != m_period_separator.end()) {
@@ -73,7 +76,7 @@ namespace boost { namespace date_time {
     }
 
     //! Puts the period start characters into stream -- default is [
-    OutItrT put_period_start_delimeter(OutItrT& oitr) const 
+    OutItrT put_period_start_delimeter(OutItrT& oitr) const
     {
       const_itr_type ci = m_period_start_delimeter.begin();
       while (ci != m_period_start_delimeter.end()) {
@@ -84,9 +87,9 @@ namespace boost { namespace date_time {
     }
 
     //! Puts the period end characters into stream as controled by open/closed range setting.
-    OutItrT put_period_end_delimeter(OutItrT& oitr) const 
+    OutItrT put_period_end_delimeter(OutItrT& oitr) const
     {
-      
+
       const_itr_type ci, end;
       if (m_range_option == AS_OPEN_RANGE) {
         ci = m_open_range_end_delimeter.begin();
@@ -102,14 +105,14 @@ namespace boost { namespace date_time {
       }
       return oitr;
     }
-   
+
     range_display_options range_option() const
     {
       return m_range_option;
     }
 
     //! Reset the range_option control
-    void 
+    void
     range_option(range_display_options option) const
     {
       m_range_option = option;
@@ -130,13 +133,13 @@ namespace boost { namespace date_time {
     //! Generic code to output a period -- no matter the period type.
     /*! This generic code will output any period using a facet to
      *  to output the 'elements'.  For example, in the case of a date_period
-     *  the elements will be instances of a date which will be formatted 
+     *  the elements will be instances of a date which will be formatted
      *  according the to setup in the passed facet parameter.
-     * 
+     *
      *  The steps for formatting a period are always the same:
      *  - put the start delimiter
      *  - put start element
-     *  - put the separator 
+     *  - put the separator
      *  - put either last or end element depending on range settings
      *  - put end delimeter depending on range settings
      *
@@ -149,9 +152,9 @@ namespace boost { namespace date_time {
      *@endcode
      */
     template<class period_type, class facet_type>
-    OutItrT put_period(OutItrT next, 
-                       std::ios_base& a_ios, 
-                       char_type a_fill, 
+    OutItrT put_period(OutItrT next,
+                       std::ios_base& a_ios,
+                       char_type a_fill,
                        const period_type& p,
                        const facet_type& facet) const {
       put_period_start_delimeter(next);
@@ -167,29 +170,29 @@ namespace boost { namespace date_time {
       return next;
     }
 
-      
+
   private:
-    range_display_options m_range_option;    
+    range_display_options m_range_option;
     string_type m_period_separator;
     string_type m_period_start_delimeter;
     string_type m_open_range_end_delimeter;
     string_type m_closed_range_end_delimeter;
   };
 
-  template <class CharT, class OutItrT>  
-  const typename period_formatter<CharT, OutItrT>::char_type 
+  template <class CharT, class OutItrT>
+  const typename period_formatter<CharT, OutItrT>::char_type
   period_formatter<CharT, OutItrT>::default_period_separator[2] = {'/'};
 
-  template <class CharT, class OutItrT>  
-  const typename period_formatter<CharT, OutItrT>::char_type 
+  template <class CharT, class OutItrT>
+  const typename period_formatter<CharT, OutItrT>::char_type
   period_formatter<CharT, OutItrT>::default_period_start_delimeter[2] = {'['};
 
-  template <class CharT, class OutItrT>  
-  const typename period_formatter<CharT, OutItrT>::char_type 
+  template <class CharT, class OutItrT>
+  const typename period_formatter<CharT, OutItrT>::char_type
   period_formatter<CharT, OutItrT>::default_period_open_range_end_delimeter[2] = {')'};
 
-  template <class CharT, class OutItrT>  
-  const typename period_formatter<CharT, OutItrT>::char_type 
+  template <class CharT, class OutItrT>
+  const typename period_formatter<CharT, OutItrT>::char_type
   period_formatter<CharT, OutItrT>::default_period_closed_range_end_delimeter[2] = {']'};
 
  } } //namespace boost::date_time