Ticket #7234: warnings.patch

File warnings.patch, 32.6 KB (added by viboes, 10 years ago)
  • time_duration.hpp

     
    22#define DATE_TIME_TIME_DURATION_HPP___
    33
    44/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    88 * Author: Jeff Garland, Bart Garst
     
    179179      return duration_type(ticks_);
    180180    }
    181181    //! Division operations on a duration with an integer.
    182     duration_type operator/=(int divisor) 
     182    duration_type operator/=(int divisor)
    183183    {
    184184      ticks_ = ticks_ / divisor;
    185185      return duration_type(ticks_);
     
    251251    }
    252252
    253253  protected:
    254     explicit time_duration(impl_type in) : ticks_(in) {};
     254    explicit time_duration(impl_type in) : ticks_(in) {}
    255255    impl_type ticks_;
    256256  };
    257257
  • dst_rules.hpp

     
    371371        return is_not_in_dst;
    372372      }
    373373
    374       static bool is_dst_boundary_day(date_type d)
     374      static bool is_dst_boundary_day(date_type )
    375375      {
    376376        return false;
    377377      }
  • period_formatter.hpp

     
    114114    {
    115115      m_range_option = option;
    116116    }
    117     void delimiter_strings(const string_type& separator,
    118                            const string_type& start_delim,
    119                            const string_type& open_end_delim,
    120                            const string_type& closed_end_delim)
     117    void delimiter_strings(const string_type& ,
     118                           const string_type& ,
     119                           const string_type& ,
     120                           const string_type& )
    121121    {
    122122      m_period_separator;
    123123      m_period_start_delimeter;
  • date_generators.hpp

     
    22#define DATE_TIME_DATE_GENERATORS_HPP__
    33
    44/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    8  * Author: Jeff Garland, Bart Garst 
     8 * Author: Jeff Garland, Bart Garst
    99 * $Date$
    1010 */
    1111
     
    3434  public:
    3535    typedef typename date_type::calendar_type calendar_type;
    3636    typedef typename calendar_type::year_type        year_type;
    37     year_based_generator() {};
    38     virtual ~year_based_generator() {};
     37    year_based_generator() {}
     38    virtual ~year_based_generator() {}
    3939    virtual date_type get_date(year_type y) const = 0;
    4040    //! Returns a string for use in a POSIX time_zone string
    4141    virtual std::string to_string() const =0;
    4242  };
    43  
     43
    4444  //! Generates a date by applying the year to the given month and day.
    4545  /*!
    46     Example usage: 
     46    Example usage:
    4747    @code
    4848    partial_date pd(1, Jan);
    4949    partial_date pd2(70);
     
    123123     //months are equal
    124124     return (day_ < rhs.day_);
    125125   }
    126    
     126
    127127   // added for streaming purposes
    128    month_type month() const 
     128   month_type month() const
    129129   {
    130130     return month_;
    131131   }
     
    135135   }
    136136
    137137   //! Returns string suitable for use in POSIX time zone string
    138    /*! Returns string formatted with up to 3 digits: 
    139     * Jan-01 == "0" 
     138   /*! Returns string formatted with up to 3 digits:
     139    * Jan-01 == "0"
    140140    * Feb-29 == "58"
    141141    * Dec-31 == "365" */
    142142   virtual std::string to_string() const
    143143   {
    144144     std::ostringstream ss;
    145145     date_type d(2004, month_, day_);
    146      unsigned short c = d.day_of_year();     
     146     unsigned short c = d.day_of_year();
    147147     c--; // numbered 0-365 while day_of_year is 1 based...
    148148     ss << c;
    149149     return ss.str();
     
    161161  /*! Based on the idea in Cal. Calc. for finding holidays that are
    162162   *  the 'first Monday of September'. When instantiated with
    163163   *  'fifth' kday of month, the result will be the last kday of month
    164    *  which can be the fourth or fifth depending on the structure of 
     164   *  which can be the fourth or fifth depending on the structure of
    165165   *  the month.
    166166   *
    167167   *  The algorithm here basically guesses for the first
     
    169169   *  type.  That is, if the first of the month is a Tuesday
    170170   *  and it needs Wenesday then we simply increment by a day
    171171   *  and then we can add the length of a week until we get
    172    *  to the 'nth kday'.  There are probably more efficient 
    173    *  algorithms based on using a mod 7, but this one works 
     172   *  to the 'nth kday'.  There are probably more efficient
     173   *  algorithms based on using a mod 7, but this one works
    174174   *  reasonably well for basic applications.
    175175   *  \ingroup date_alg
    176176   */
     
    233233    virtual std::string to_string() const
    234234    {
    235235     std::ostringstream ss;
    236      ss << 'M' 
     236     ss << 'M'
    237237       << static_cast<int>(month_) << '.'
    238238       << static_cast<int>(wn_) << '.'
    239239       << static_cast<int>(dow_);
     
    244244    week_num wn_;
    245245    day_of_week_type dow_;
    246246  };
    247  
     247
    248248  //! Useful generator functor for finding holidays and daylight savings
    249249  /*! Similar to nth_kday_of_month, but requires less paramters
    250250   *  \ingroup date_alg
     
    290290    virtual std::string to_string() const
    291291    {
    292292     std::ostringstream ss;
    293      ss << 'M' 
     293     ss << 'M'
    294294       << static_cast<int>(month_) << '.'
    295295       << 1 << '.'
    296296       << static_cast<int>(dow_);
     
    300300    month_type month_;
    301301    day_of_week_type dow_;
    302302  };
    303  
    304  
    305  
     303
     304
     305
    306306  //! Calculate something like Last Sunday of January
    307307  /*! Useful generator functor for finding holidays and daylight savings
    308308   *  Get the last day of the month and then calculate the difference
     
    351351    virtual std::string to_string() const
    352352    {
    353353      std::ostringstream ss;
    354       ss << 'M' 
     354      ss << 'M'
    355355         << static_cast<int>(month_) << '.'
    356356         << 5 << '.'
    357357         << static_cast<int>(dow_);
     
    361361    month_type month_;
    362362    day_of_week_type dow_;
    363363   };
    364  
    365  
     364
     365
    366366  //! Calculate something like "First Sunday after Jan 1,2002
    367367  /*! Date generator that takes a date and finds kday after
    368368   *@code
     
    400400  private:
    401401    day_of_week_type dow_;
    402402  };
    403  
     403
    404404  //! Calculate something like "First Sunday before Jan 1,2002
    405405  /*! Date generator that takes a date and finds kday after
    406406   *@code
     
    438438  private:
    439439    day_of_week_type dow_;
    440440  };
    441  
     441
    442442  //! Calculates the number of days until the next weekday
    443443  /*! Calculates the number of days until the next weekday.
    444    * If the date given falls on a Sunday and the given weekday 
     444   * If the date given falls on a Sunday and the given weekday
    445445   * is Tuesday the result will be 2 days */
    446446  template<typename date_type, class weekday_type>
    447447  inline
     
    458458
    459459  //! Calculates the number of days since the previous weekday
    460460  /*! Calculates the number of days since the previous weekday
    461    * If the date given falls on a Sunday and the given weekday 
    462    * is Tuesday the result will be 5 days. The answer will be a positive 
     461   * If the date given falls on a Sunday and the given weekday
     462   * is Tuesday the result will be 5 days. The answer will be a positive
    463463   * number because Tuesday is 5 days before Sunday, not -5 days before. */
    464464  template<typename date_type, class weekday_type>
    465465  inline
     
    477477  }
    478478
    479479  //! Generates a date object representing the date of the following weekday from the given date
    480   /*! Generates a date object representing the date of the following 
    481    * weekday from the given date. If the date given is 2004-May-9 
    482    * (a Sunday) and the given weekday is Tuesday then the resulting date 
     480  /*! Generates a date object representing the date of the following
     481   * weekday from the given date. If the date given is 2004-May-9
     482   * (a Sunday) and the given weekday is Tuesday then the resulting date
    483483   * will be 2004-May-11. */
    484484  template<class date_type, class weekday_type>
    485485  inline
     
    489489  }
    490490
    491491  //! Generates a date object representing the date of the previous weekday from the given date
    492   /*! Generates a date object representing the date of the previous 
    493    * weekday from the given date. If the date given is 2004-May-9 
    494    * (a Sunday) and the given weekday is Tuesday then the resulting date 
     492  /*! Generates a date object representing the date of the previous
     493   * weekday from the given date. If the date given is 2004-May-9
     494   * (a Sunday) and the given weekday is Tuesday then the resulting date
    495495   * will be 2004-May-4. */
    496496  template<class date_type, class weekday_type>
    497497  inline
  • date.hpp

     
    191191      dates.  It is not exposed to users since that would require class
    192192      users to understand the inner workings of the date class.
    193193    */
    194     explicit date(date_int_type days) : days_(days) {};
    195     explicit date(date_rep_type days) : days_(days.as_number()) {};
     194    explicit date(date_int_type days) : days_(days) {}
     195    explicit date(date_rep_type days) : days_(days.as_number()) {}
    196196    date_int_type days_;
    197197
    198198  };
  • local_time/posix_time_zone.hpp

     
    115115        calc_rules(dst_begin, dst_end);
    116116      }
    117117    }
    118     virtual ~posix_time_zone_base() {};
     118    virtual ~posix_time_zone_base() {}
    119119    //!String for the zone when not in daylight savings (eg: EST)
    120120    virtual string_type std_zone_abbrev()const
    121121    {
  • local_time/custom_time_zone.hpp

     
    22#define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__
    33
    44/* Copyright (c) 2003-2005 CrystalClear Software, Inc.
    5  * Subject to the Boost Software License, Version 1.0. 
     5 * Subject to the Boost Software License, Version 1.0.
    66 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    77 * Author: Jeff Garland, Bart Garst
    88 * $Date$
     
    3434    typedef typename base_type::stringstream_type stringstream_type;
    3535    typedef date_time::time_zone_names_base<CharT> time_zone_names;
    3636    typedef CharT char_type;
    37    
    38     custom_time_zone_base(const time_zone_names& zone_names,   
     37
     38    custom_time_zone_base(const time_zone_names& zone_names,
    3939                     const time_duration_type& utc_offset,
    4040                     const dst_adjustment_offsets& dst_shift,
    4141                     boost::shared_ptr<dst_calc_rule> calc_rule) :
     
    4343      base_utc_offset_(utc_offset),
    4444      dst_offsets_(dst_shift),
    4545      dst_calc_rules_(calc_rule)
    46     {};
    47     virtual ~custom_time_zone_base() {};
     46    {}
     47    virtual ~custom_time_zone_base() {}
    4848    virtual string_type dst_zone_abbrev() const
    4949    {
    5050      return zone_names_.dst_zone_abbrev();
  • local_time/local_date_time.hpp

     
    208208    }
    209209
    210210    //! Simple destructor, releases time zone if last referrer
    211     ~local_date_time_base() {};
     211    ~local_date_time_base() {}
    212212
    213213    //! Copy constructor
    214214    local_date_time_base(const local_date_time_base& rhs) :
  • time_zone_base.hpp

     
    22#define _DATE_TIME_TIME_ZONE_BASE__
    33
    44/* Copyright (c) 2003-2005 CrystalClear Software, Inc.
    5  * Subject to the Boost Software License, Version 1.0. 
     5 * Subject to the Boost Software License, Version 1.0.
    66 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    77 * Author: Jeff Garland, Bart Garst
    88 * $Date$
     
    2626   *  would be to convert from POSIX timezone strings.  Regardless of
    2727   *  the construction technique, this is the interface that these
    2828   *  time zone types must provide.
    29    * 
     29   *
    3030   * Note that this class is intended to be used as a shared
    31    * resource (hence the derivation from boost::counted_base. 
     31   * resource (hence the derivation from boost::counted_base.
    3232   */
    3333  template<typename time_type, typename CharT>
    3434  class time_zone_base  {
     
    3939    typedef typename time_type::date_type::year_type year_type;
    4040    typedef typename time_type::time_duration_type time_duration_type;
    4141
    42     time_zone_base() {};
    43     virtual ~time_zone_base() {};
     42    time_zone_base() {}
     43    virtual ~time_zone_base() {}
    4444    //!String for the timezone when in daylight savings (eg: EDT)
    4545    virtual string_type dst_zone_abbrev() const=0;
    4646    //!String for the zone when not in daylight savings (eg: EST)
     
    6161    virtual time_duration_type dst_offset() const=0;
    6262    //! Returns a POSIX time_zone string for this object
    6363    virtual string_type to_posix_string() const =0;
    64    
     64
    6565  private:
    66    
     66
    6767  };
    6868
    6969
     
    8282      dst_start_offset_(dst_start_offset),
    8383      dst_end_offset_(dst_end_offset)
    8484    {}
    85    
     85
    8686    //! Amount DST adjusts the clock eg: plus one hour
    8787    time_duration_type dst_adjust_;
    8888    //! Time past midnight on start transition day that dst starts
  • date_iterator.hpp

     
    22#define DATE_ITERATOR_HPP___
    33
    44/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    88 * Author: Jeff Garland, Bart Garst
     
    3232  template<class date_type>
    3333  class date_itr_base {
    3434  // works, but benefit unclear at the moment
    35   //   class date_itr_base : public std::iterator<std::input_iterator_tag, 
     35  //   class date_itr_base : public std::iterator<std::input_iterator_tag,
    3636  //                                             date_type, void, void, void>{
    3737  public:
    3838    typedef typename date_type::duration_type duration_type;
     
    4040    typedef std::input_iterator_tag iterator_category;
    4141
    4242    date_itr_base(date_type d) : current_(d) {}
    43     virtual ~date_itr_base() {};
    44     date_itr_base& operator++() 
     43    virtual ~date_itr_base() {}
     44    date_itr_base& operator++()
    4545    {
    4646      current_ = current_ + get_offset(current_);
    4747      return *this;
    4848    }
    49     date_itr_base& operator--() 
     49    date_itr_base& operator--()
    5050    {
    5151      current_ = current_ + get_neg_offset(current_);
    5252      return *this;
    5353    }
    5454    virtual duration_type get_offset(const date_type& current) const=0;
    5555    virtual duration_type get_neg_offset(const date_type& current) const=0;
    56     date_type operator*() {return current_;};
    57     date_type* operator->() {return &current_;};
     56    date_type operator*() {return current_;}
     57    date_type* operator->() {return &current_;}
    5858    bool operator<  (const date_type& d) {return current_ < d;}
    5959    bool operator<= (const date_type& d) {return current_ <= d;}
    6060    bool operator>  (const date_type& d) {return current_ > d;}
    6161    bool operator>= (const date_type& d) {return current_ >= d;}
    6262    bool operator== (const date_type& d) {return current_ == d;}
    63     bool operator!= (const date_type& d) {return current_ != d;}   
     63    bool operator!= (const date_type& d) {return current_ != d;}
    6464  private:
    6565    date_type current_;
    6666  };
    67  
     67
    6868  //! Overrides the base date iterator providing hook for functors
    6969  /*
    7070   *  <b>offset_functor</b>
     
    7777  class date_itr : public date_itr_base<date_type> {
    7878  public:
    7979    typedef typename date_type::duration_type duration_type;
    80     date_itr(date_type d, int factor=1) : 
    81       date_itr_base<date_type>(d), 
    82       of_(factor) 
     80    date_itr(date_type d, int factor=1) :
     81      date_itr_base<date_type>(d),
     82      of_(factor)
    8383    {}
    8484  private:
    8585    virtual duration_type get_offset(const date_type& current) const
     
    9292    }
    9393    offset_functor of_;
    9494  };
    95  
    9695
    97  
     96
     97
    9898} } //namespace date_time
    9999
    100100
  • date_names_put.hpp

     
    22#define DATE_TIME_DATE_NAMES_PUT_HPP___
    33
    44/* Copyright (c) 2002-2005 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    8  * Author: Jeff Garland, Bart Garst 
     8 * Author: Jeff Garland, Bart Garst
    99 * $Date$
    1010 */
    1111
     
    2727    //! Output facet base class for gregorian dates.
    2828    /*! This class is a base class for date facets used to localize the
    2929     *  names of months and the names of days in the week.
    30      * 
     30     *
    3131     * Requirements of Config
    32      *  - define an enumeration month_enum that enumerates the months. 
     32     *  - define an enumeration month_enum that enumerates the months.
    3333     *    The enumeration should be '1' based eg: Jan==1
    3434     *  - define as_short_string and as_long_string
    3535     *
    3636     * (see langer & kreft p334).
    37      * 
     37     *
    3838     */
    3939    template<class Config,
    40              class charT = char, 
     40             class charT = char,
    4141             class OutputIterator = std::ostreambuf_iterator<charT> >
    4242    class date_names_put : public std::locale::facet
    4343    {
    4444    public:
    45       date_names_put() {};
     45      date_names_put() {}
    4646      typedef OutputIterator iter_type;
    4747      typedef typename Config::month_type month_type;
    4848      typedef typename Config::month_enum month_enum;
     
    118118        put_string(oitr, gm.as_short_string(c));
    119119      }
    120120      //! Default facet implementation uses month_type defaults
    121       virtual void do_put_month_long(iter_type& oitr, 
     121      virtual void do_put_month_long(iter_type& oitr,
    122122                                     month_enum moy) const
    123123      {
    124124        month_type gm(moy);
     
    160160        string_type s(separator); //put in '-'
    161161        put_string(oitr, s);
    162162      }
    163       //! Default for date order 
     163      //! Default for date order
    164164      virtual ymd_order_spec do_date_order() const
    165165      {
    166166        return ymd_order_iso;
     
    186186        }
    187187      }
    188188    };
    189    
     189
    190190    template<class Config, class charT, class OutputIterator>
    191     const typename date_names_put<Config, charT, OutputIterator>::char_type 
    192     date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = { 
     191    const typename date_names_put<Config, charT, OutputIterator>::char_type
     192    date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = {
    193193      {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'},
    194194      {'-','i','n','f','i','n','i','t','y'},
    195195      {'+','i','n','f','i','n','i','t','y'} };
    196196
    197197    template<class Config, class charT, class OutputIterator>
    198     const typename date_names_put<Config, charT, OutputIterator>::char_type 
    199     date_names_put<Config, charT, OutputIterator>::separator[2] = 
     198    const typename date_names_put<Config, charT, OutputIterator>::char_type
     199    date_names_put<Config, charT, OutputIterator>::separator[2] =
    200200      {'-', '\0'} ;
    201    
    202201
    203     //! Generate storage location for a std::locale::id
     202
     203    //! Generate storage location for a std::locale::id
    204204    template<class Config, class charT, class OutputIterator>
    205205    std::locale::id date_names_put<Config, charT, OutputIterator>::id;
    206206
    207207    //! A date name output facet that takes an array of char* to define strings
    208208    template<class Config,
    209              class charT = char, 
     209             class charT = char,
    210210             class OutputIterator = std::ostreambuf_iterator<charT> >
    211211    class all_date_names_put : public date_names_put<Config, charT, OutputIterator>
    212212    {
     
    230230        separator_char_[0] = separator_char;
    231231        separator_char_[1] = '\0';
    232232
    233       };
     233      }
    234234      typedef OutputIterator iter_type;
    235235      typedef typename Config::month_enum month_enum;
    236236      typedef typename Config::weekday_enum weekday_enum;
    237237      typedef typename Config::special_value_enum special_value_enum;
    238238
    239       const charT* const* get_short_month_names() const 
     239      const charT* const* get_short_month_names() const
    240240      {
    241241        return month_short_names_;
    242242      }
    243       const charT* const* get_long_month_names() const 
     243      const charT* const* get_long_month_names() const
    244244      {
    245245        return month_long_names_;
    246246      }
    247       const charT* const* get_special_value_names() const 
     247      const charT* const* get_special_value_names() const
    248248      {
    249249        return special_value_names_;
    250250      }
    251       const charT* const* get_short_weekday_names()const 
     251      const charT* const* get_short_weekday_names()const
    252252      {
    253253        return weekday_short_names_;
    254254      }
    255       const charT* const* get_long_weekday_names()const 
     255      const charT* const* get_long_weekday_names()const
    256256      {
    257257        return weekday_long_names_;
    258258      }
     
    263263      {
    264264        this->put_string(oitr, month_short_names_[moy-1]);
    265265      }
    266       //! Long month names 
     266      //! Long month names
    267267      virtual void do_put_month_long(iter_type& oitr, month_enum moy) const
    268268      {
    269269        this->put_string(oitr, month_long_names_[moy-1]);
     
    310310      const charT* const* weekday_long_names_;
    311311      charT separator_char_[2];
    312312      ymd_order_spec order_spec_;
    313       month_format_spec month_format_spec_;     
     313      month_format_spec month_format_spec_;
    314314    };
    315315
    316316} } //namespace boost::date_time
  • dst_transition_generators.hpp

     
    1818    {
    1919    public:
    2020      typedef typename date_type::year_type year_type;
    21       virtual ~dst_day_calc_rule() {};
     21      virtual ~dst_day_calc_rule() {}
    2222      virtual date_type start_day(year_type y) const=0;
    2323      virtual std::string start_rule_as_string() const=0;
    2424      virtual date_type end_day(year_type y) const=0;
  • wrapping_int.hpp

     
    22#define _DATE_TIME_WRAPPING_INT_HPP__
    33
    44/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    88 * Author: Jeff Garland, Bart Garst
     
    1616//! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type)
    1717/*! In composite date and time types this type is used to
    1818 *  wrap at the day boundary.
    19  *  Ex: 
    20  *  A wrapping_int<short, 10> will roll over after nine, and 
     19 *  Ex:
     20 *  A wrapping_int<short, 10> will roll over after nine, and
    2121 *  roll under below zero. This gives a range of [0,9]
    2222 *
    23  * NOTE: it is strongly recommended that wrapping_int2 be used 
    24  * instead of wrapping_int as wrapping_int is to be depricated 
     23 * NOTE: it is strongly recommended that wrapping_int2 be used
     24 * instead of wrapping_int as wrapping_int is to be depricated
    2525 * at some point soon.
    2626 *
    27  * Also Note that warnings will occur if instantiated with an 
     27 * Also Note that warnings will occur if instantiated with an
    2828 * unsigned type. Only a signed type should be used!
    2929 */
    3030template<typename int_type_, int_type_ wrap_val>
     
    3434  //typedef overflow_type_ overflow_type;
    3535  static int_type wrap_value() {return wrap_val;}
    3636  //!Add, return true if wrapped
    37   wrapping_int(int_type v) : value_(v) {};
     37  wrapping_int(int_type v) : value_(v) {}
    3838  //! Explicit converion method
    3939  int_type as_int()   const   {return value_;}
    4040  operator int_type() const   {return value_;}
    4141  //!Add, return number of wraps performed
    42   /*! The sign of the returned value will indicate which direction the 
     42  /*! The sign of the returned value will indicate which direction the
    4343   * wraps went. Ex: add a negative number and wrapping under could occur,
    44    * this would be indicated by a negative return value. If wrapping over 
     44   * this would be indicated by a negative return value. If wrapping over
    4545   * took place, a positive value would be returned */
    4646  template< typename IntT >
    47   IntT add(IntT v) 
     47  IntT add(IntT v)
    4848  {
    4949    int_type remainder = static_cast<int_type>(v % (wrap_val));
    5050    IntT overflow = static_cast<IntT>(v / (wrap_val));
     
    5353  }
    5454  //! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps)
    5555  /*! The sign of the returned value will indicate which direction the
    56    * wraps went (positive indicates wrap under, negative indicates wrap over). 
    57    * Ex: subtract a negative number and wrapping over could 
    58    * occur, this would be indicated by a negative return value. If 
     56   * wraps went (positive indicates wrap under, negative indicates wrap over).
     57   * Ex: subtract a negative number and wrapping over could
     58   * occur, this would be indicated by a negative return value. If
    5959   * wrapping under took place, a positive value would be returned. */
    6060  template< typename IntT >
    61   IntT subtract(IntT v) 
     61  IntT subtract(IntT v)
    6262  {
    6363    int_type remainder = static_cast<int_type>(v % (wrap_val));
    6464    IntT underflow = static_cast<IntT>(-(v / (wrap_val)));
     
    7171  template< typename IntT >
    7272  IntT calculate_wrap(IntT wrap)
    7373  {
    74     if ((value_) >= wrap_val) 
     74    if ((value_) >= wrap_val)
    7575    {
    7676      ++wrap;
    7777      value_ -= (wrap_val);
    7878    }
    79     else if(value_ < 0) 
     79    else if(value_ < 0)
    8080    {
    8181      --wrap;
    8282      value_ += (wrap_val);
    8383    }
    8484    return wrap;
    8585  }
    86                  
     86
    8787};
    8888
    8989
     
    113113  int_type as_int()   const   {return value_;}
    114114  operator int_type() const {return value_;}
    115115  //!Add, return number of wraps performed
    116   /*! The sign of the returned value will indicate which direction the 
     116  /*! The sign of the returned value will indicate which direction the
    117117   * wraps went. Ex: add a negative number and wrapping under could occur,
    118    * this would be indicated by a negative return value. If wrapping over 
     118   * this would be indicated by a negative return value. If wrapping over
    119119   * took place, a positive value would be returned */
    120120  template< typename IntT >
    121   IntT add(IntT v) 
     121  IntT add(IntT v)
    122122  {
    123123    int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1));
    124124    IntT overflow = static_cast<IntT>(v / (wrap_max - wrap_min + 1));
     
    127127  }
    128128  //! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps)
    129129  /*! The sign of the returned value will indicate which direction the
    130    * wraps went. Ex: subtract a negative number and wrapping over could 
    131    * occur, this would be indicated by a positive return value. If 
     130   * wraps went. Ex: subtract a negative number and wrapping over could
     131   * occur, this would be indicated by a positive return value. If
    132132   * wrapping under took place, a negative value would be returned */
    133133  template< typename IntT >
    134   IntT subtract(IntT v) 
     134  IntT subtract(IntT v)
    135135  {
    136136    int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1));
    137137    IntT underflow = static_cast<IntT>(-(v / (wrap_max - wrap_min + 1)));
    138138    value_ = static_cast<int_type>(value_ - remainder);
    139139    return calculate_wrap(underflow);
    140140  }
    141            
     141
    142142private:
    143143  int_type value_;
    144144
    145145  template< typename IntT >
    146146  IntT calculate_wrap(IntT wrap)
    147147  {
    148     if ((value_) > wrap_max) 
     148    if ((value_) > wrap_max)
    149149    {
    150150      ++wrap;
    151151      value_ -= (wrap_max - wrap_min + 1);
    152152    }
    153     else if((value_) < wrap_min) 
     153    else if((value_) < wrap_min)
    154154    {
    155155      --wrap;
    156156      value_ += (wrap_max - wrap_min + 1);
  • time_iterator.hpp

     
    22#define DATE_TIME_TIME_ITERATOR_HPP___
    33
    44/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    88 * Author: Jeff Garland, Bart Garst
     
    1212
    1313namespace boost {
    1414namespace date_time {
    15  
    1615
     16
    1717  //! Simple time iterator skeleton class
    1818  template<class time_type>
    1919  class time_itr {
    2020  public:
    2121    typedef typename time_type::time_duration_type time_duration_type;
    22     time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {};
    23     time_itr& operator++() 
     22    time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}
     23    time_itr& operator++()
    2424    {
    2525      current_ = current_ + offset_;
    2626      return *this;
    2727    }
    28     time_itr& operator--() 
     28    time_itr& operator--()
    2929    {
    3030      current_ = current_ - offset_;
    3131      return *this;
    3232    }
    33     time_type operator*() {return current_;};
    34     time_type* operator->() {return &current_;};
    35     bool operator<  (const time_type& t) {return current_ < t;};
    36     bool operator<= (const time_type& t) {return current_ <= t;};
    37     bool operator!=  (const time_type& t) {return current_ != t;};
    38     bool operator== (const time_type& t) {return current_ == t;};
    39     bool operator>  (const time_type& t) {return current_ > t;};
    40     bool operator>= (const time_type& t) {return current_ >= t;};
    41    
     33    time_type operator*() {return current_;}
     34    time_type* operator->() {return &current_;}
     35    bool operator<  (const time_type& t) {return current_ < t;}
     36    bool operator<= (const time_type& t) {return current_ <= t;}
     37    bool operator!=  (const time_type& t) {return current_ != t;}
     38    bool operator== (const time_type& t) {return current_ == t;}
     39    bool operator>  (const time_type& t) {return current_ > t;}
     40    bool operator>= (const time_type& t) {return current_ >= t;}
     41
    4242  private:
    4343    time_type current_;
    4444    time_duration_type offset_;
    4545  };
    46  
    4746
    48  
     47
     48
    4949} }//namespace date_time
    5050
    5151
  • date_duration.hpp

     
    22#define DATE_TIME_DATE_DURATION__
    33
    44/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
    5  * Use, modification and distribution is subject to the 
     5 * Use, modification and distribution is subject to the
    66 * Boost Software License, Version 1.0. (See accompanying
    77 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    88 * Author: Jeff Garland, Bart Garst
     
    2626            , boost::subtractable1< date_duration< duration_rep_traits >
    2727            , boost::dividable2< date_duration< duration_rep_traits >, int
    2828            > > > > >
    29   { 
     29  {
    3030  public:
    3131    typedef typename duration_rep_traits::int_type duration_rep_type;
    3232    typedef typename duration_rep_traits::impl_type duration_rep;
    33    
     33
    3434    //! Construct from a day count
    35     explicit date_duration(duration_rep day_count) : days_(day_count) {};
    36    
     35    explicit date_duration(duration_rep day_count) : days_(day_count) {}
     36
    3737    /*! construct from special_values - only works when
    3838     * instantiated with duration_traits_adapted */
    3939    date_duration(special_values sv) :
     
    125125  {
    126126    typedef long int_type;
    127127    typedef long impl_type;
    128     static int_type as_number(impl_type i) { return i; };
     128    static int_type as_number(impl_type i) { return i; }
    129129  };
    130130
    131131  /*! Struct for instantiating date_duration <b>WITH</b> special values
     
    135135  {
    136136    typedef long int_type;
    137137    typedef boost::date_time::int_adapter<long> impl_type;
    138     static int_type as_number(impl_type i) { return i.as_number(); };
     138    static int_type as_number(impl_type i) { return i.as_number(); }
    139139  };
    140  
    141140
     141
    142142} } //namspace date_time
    143143
    144144