diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/date_time | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/date_time')
19 files changed, 867 insertions, 864 deletions
diff --git a/3rdParty/Boost/src/boost/date_time/c_time.hpp b/3rdParty/Boost/src/boost/date_time/c_time.hpp index 42902a5..24ccfe5 100644 --- a/3rdParty/Boost/src/boost/date_time/c_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/c_time.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_C_TIME_HPP___ /* Copyright (c) 2002,2003,2005 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: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * Author: Jeff Garland, Bart Garst + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ @@ -38,12 +38,14 @@ namespace std { using ::time_t; using ::time; using ::localtime; namespace boost { namespace date_time { //! Provides a uniform interface to some 'ctime' functions - /*! Provides a uniform interface to some ctime functions and - * their '_r' counterparts. The '_r' functions require a pointer to a - * user created std::tm struct whereas the regular functions use a - * staticly created struct and return a pointer to that. These wrapper - * functions require the user to create a std::tm struct and send in a - * pointer to it. A pointer to the user created struct will be returned. + /*! Provides a uniform interface to some ctime functions and + * their '_r' counterparts. The '_r' functions require a pointer to a + * user created std::tm struct whereas the regular functions use a + * staticly created struct and return a pointer to that. These wrapper + * functions require the user to create a std::tm struct and send in a + * pointer to it. This struct may be used to store the resulting time. + * The returned pointer may or may not point to this struct, however, + * it will point to the result of the corresponding function. * All functions do proper checking of the C function results and throw * exceptions on error. Therefore the functions will never return NULL. */ @@ -101,5 +103,5 @@ namespace date_time { #endif // BOOST_HAS_THREADS }; }} // namespaces - + #endif // DATE_TIME_C_TIME_HPP___ diff --git a/3rdParty/Boost/src/boost/date_time/date.hpp b/3rdParty/Boost/src/boost/date_time/date.hpp index beab047..1056fb6 100644 --- a/3rdParty/Boost/src/boost/date_time/date.hpp +++ b/3rdParty/Boost/src/boost/date_time/date.hpp @@ -2,43 +2,43 @@ #define DATE_TIME_DATE_HPP___ /* Copyright (c) 2002,2003 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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/year_month_day.hpp" -#include "boost/date_time/special_defs.hpp" -#include "boost/operators.hpp" +#include <boost/operators.hpp> +#include <boost/date_time/year_month_day.hpp> +#include <boost/date_time/special_defs.hpp> namespace boost { namespace date_time { //!Representation of timepoint at the one day level resolution. - /*! + /*! The date template represents an interface shell for a date class that is based on a year-month-day system such as the gregorian or iso systems. It provides basic operations to enable calculation - and comparisons. + and comparisons. <b>Theory</b> - This date representation fundamentally departs from the C tm struct + This date representation fundamentally departs from the C tm struct approach. The goal for this type is to provide efficient date operations (add, subtract) and storage (minimize space to represent) in a concrete class. Thus, the date uses a count internally to - represent a particular date. The calendar parameter defines + represent a particular date. The calendar parameter defines the policies for converting the the year-month-day and internal counted form here. Applications that need to perform heavy formatting of the same date repeatedly will perform better by using the year-month-day representation. - + Internally the date uses a day number to represent the date. - This is a monotonic time representation. This representation + This is a monotonic time representation. This representation allows for fast comparison as well as simplifying - the creation of writing numeric operations. Essentially, the + the creation of writing numeric operations. Essentially, the internal day number is like adjusted julian day. The adjustment is determined by the Epoch date which is represented as day 1 of the calendar. Day 0 is reserved for negative infinity so that @@ -48,11 +48,11 @@ namespace date_time { day representations. */ - - template<class T, class calendar, class duration_type_> - class date : private - boost::less_than_comparable<T - , boost::equality_comparable<T + + template<class T, class calendar, class duration_type_> + class date : private + boost::less_than_comparable<T + , boost::equality_comparable<T > > { public: @@ -67,26 +67,26 @@ namespace date_time { typedef typename calendar::date_rep_type date_rep_type; typedef typename calendar::date_int_type date_int_type; typedef typename calendar::day_of_week_type day_of_week_type; - date(year_type y, month_type m, day_type d) + date(year_type y, month_type m, day_type d) : days_(calendar::day_number(ymd_type(y, m, d))) {} - date(const ymd_type& ymd) + date(const ymd_type& ymd) : days_(calendar::day_number(ymd)) - {} + {} //let the compiler write copy, assignment, and destructor year_type year() const { - ymd_type ymd = calendar::from_day_number(days_); + ymd_type ymd = calendar::from_day_number(days_); return ymd.year; } month_type month() const { - ymd_type ymd = calendar::from_day_number(days_); + ymd_type ymd = calendar::from_day_number(days_); return ymd.month; } day_type day() const { - ymd_type ymd = calendar::from_day_number(days_); + ymd_type ymd = calendar::from_day_number(days_); return ymd.day; } day_of_week_type day_of_week() const @@ -138,10 +138,21 @@ namespace date_time { } duration_type operator-(const date_type& d) const { - date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_); - return duration_type(val.as_number()); + if (!this->is_special() && !d.is_special()) + { + // The duration underlying type may be wider than the date underlying type. + // Thus we calculate the difference in terms of two durations from some common fixed base date. + typedef typename duration_type::duration_rep_type duration_rep_type; + return duration_type(static_cast< duration_rep_type >(days_) - static_cast< duration_rep_type >(d.days_)); + } + else + { + // In this case the difference will be a special value, too + date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_); + return duration_type(val.as_special()); + } } - + date_type operator-(const duration_type& dd) const { if(dd.is_special()) @@ -155,10 +166,10 @@ namespace date_time { *this = *this - dd; return date_type(days_); } - date_rep_type day_count() const + date_rep_type day_count() const { return days_; - }; + } //allow internal access from operators date_type operator+(const duration_type& dd) const { @@ -170,25 +181,25 @@ namespace date_time { } date_type operator+=(const duration_type& dd) { - *this = *this + dd; + *this = *this + dd; return date_type(days_); } //see reference protected: - /*! This is a private constructor which allows for the creation of new - dates. It is not exposed to users since that would require class + /*! This is a private constructor which allows for the creation of new + dates. It is not exposed to users since that would require class users to understand the inner workings of the date class. */ explicit date(date_int_type days) : days_(days) {}; explicit date(date_rep_type days) : days_(days.as_number()) {}; date_int_type days_; - + }; - + } } // namespace date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_facet.hpp b/3rdParty/Boost/src/boost/date_time/date_facet.hpp index a592c11..3eda4c7 100644 --- a/3rdParty/Boost/src/boost/date_time/date_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_facet.hpp @@ -2,11 +2,11 @@ #define _DATE_TIME_DATE_FACET__HPP___ /* Copyright (c) 2004-2005 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: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2009-02-01 06:29:43 -0500 (Sun, 01 Feb 2009) $ + * $Date: 2009-06-04 07:40:18 -0400 (Thu, 04 Jun 2009) $ */ #include <locale> @@ -27,7 +27,7 @@ namespace boost { namespace date_time { - + /*! Class that provides format based I/O facet for date types. * * This class allows the formatting of dates by using format string. @@ -44,7 +44,7 @@ namespace boost { namespace date_time { * Default weekday format == %a */ template <class date_type, - class CharT, + class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > class date_facet : public std::locale::facet { public: @@ -81,9 +81,9 @@ namespace boost { namespace date_time { #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } #endif - - explicit date_facet(::size_t a_ref = 0) - : std::locale::facet(a_ref), + + explicit date_facet(::size_t a_ref = 0) + : std::locale::facet(a_ref), //m_format(standard_format_specifier) m_format(default_date_format), m_month_format(short_month_format), @@ -92,22 +92,22 @@ namespace boost { namespace date_time { explicit date_facet(const char_type* format_str, const input_collection_type& short_names, - ::size_t ref_count = 0) - : std::locale::facet(ref_count), + ::size_t ref_count = 0) + : std::locale::facet(ref_count), m_format(format_str), m_month_format(short_month_format), m_weekday_format(short_weekday_format), - m_month_short_names(short_names) + m_month_short_names(short_names) {} - - explicit date_facet(const char_type* format_str, - period_formatter_type per_formatter = period_formatter_type(), + + explicit date_facet(const char_type* format_str, + period_formatter_type per_formatter = period_formatter_type(), special_values_formatter_type sv_formatter = special_values_formatter_type(), date_gen_formatter_type dg_formatter = date_gen_formatter_type(), ::size_t ref_count = 0) - : std::locale::facet(ref_count), - m_format(format_str), + : std::locale::facet(ref_count), + m_format(format_str), m_month_format(short_month_format), m_weekday_format(short_weekday_format), m_period_formatter(per_formatter), @@ -131,11 +131,11 @@ namespace boost { namespace date_time { void weekday_format(const char_type* const format_str) { m_weekday_format = format_str; } - + void period_formatter(period_formatter_type per_formatter) { m_period_formatter= per_formatter; } - void special_values_formatter(const special_values_formatter_type& svf) + void special_values_formatter(const special_values_formatter_type& svf) { m_special_values_formatter = svf; } @@ -164,24 +164,24 @@ namespace boost { namespace date_time { m_date_gen_formatter.elements(new_strings, beg_pos); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const date_type& d) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const date_type& d) const { - if (d.is_special()) { + if (d.is_special()) { return do_put_special(next, a_ios, fill_char, d.as_special()); } //The following line of code required the date to support a to_tm function return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const duration_type& dd) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const duration_type& dd) const { - if (dd.is_special()) { + if (dd.is_special()) { return do_put_special(next, a_ios, fill_char, dd.get_rep().as_special()); } @@ -199,164 +199,147 @@ namespace boost { namespace date_time { } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const month_type& m) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const month_type& m) const { - //if (d.is_special()) { + //if (d.is_special()) { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function - tm dtm; - init_tm(dtm); - dtm.tm_mon = m -1; + std::tm dtm = {}; + dtm.tm_mon = m - 1; return do_put_tm(next, a_ios, fill_char, dtm, m_month_format); } //! puts the day of month - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const day_type& day) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const day_type& day) const { - tm dtm; - init_tm(dtm); + std::tm dtm = {}; dtm.tm_mday = day.as_number(); char_type tmp[3] = {'%','d'}; string_type temp_format(tmp); return do_put_tm(next, a_ios, fill_char, dtm, temp_format); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const day_of_week_type& dow) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const day_of_week_type& dow) const { - //if (d.is_special()) { + //if (d.is_special()) { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function - tm dtm; - init_tm(dtm); + std::tm dtm = {}; dtm.tm_wday = dow; return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const period_type& p) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const period_type& p) const { return m_period_formatter.put_period(next, a_ios, fill_char, p, *this); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const partial_date_type& pd) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const partial_date_type& pd) const { return m_date_gen_formatter.put_partial_date(next, a_ios, fill_char, pd, *this); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const nth_kday_type& nkd) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const nth_kday_type& nkd) const { return m_date_gen_formatter.put_nth_kday(next, a_ios, fill_char, nkd, *this); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const first_kday_type& fkd) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const first_kday_type& fkd) const { return m_date_gen_formatter.put_first_kday(next, a_ios, fill_char, fkd, *this); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const last_kday_type& lkd) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const last_kday_type& lkd) const { return m_date_gen_formatter.put_last_kday(next, a_ios, fill_char, lkd, *this); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const kday_before_type& fkb) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const kday_before_type& fkb) const { return m_date_gen_formatter.put_kday_before(next, a_ios, fill_char, fkb, *this); } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const kday_after_type& fka) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const kday_after_type& fka) const { return m_date_gen_formatter.put_kday_after(next, a_ios, fill_char, fka, *this); } - + protected: - //! Helper function to initialize all fields in a tm struct - tm init_tm(tm& tm_value) const - { - tm_value.tm_sec = 0; /* seconds */ - tm_value.tm_min = 0; /* minutes */ - tm_value.tm_hour = 0; /* hours */ - tm_value.tm_mday = 0; /* day of the month */ - tm_value.tm_mon = 0; /* month */ - tm_value.tm_year = 0; /* year */ - tm_value.tm_wday = 0; /* day of the week */ - tm_value.tm_yday = 0; /* day in the year */ - tm_value.tm_isdst = 0; /* daylight saving time */ - return tm_value; - } - virtual OutItrT do_put_special(OutItrT next, - std::ios_base& /*a_ios*/, - char_type /*fill_char*/, - const boost::date_time::special_values sv) const + virtual OutItrT do_put_special(OutItrT next, + std::ios_base& /*a_ios*/, + char_type /*fill_char*/, + const boost::date_time::special_values sv) const { m_special_values_formatter.put_special(next, sv); return next; } - virtual OutItrT do_put_tm(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, + virtual OutItrT do_put_tm(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, const tm& tm_value, - string_type a_format) const + string_type a_format) const { // update format string with custom names if (m_weekday_long_names.size()) { - boost::algorithm::replace_all(a_format, - long_weekday_format, + boost::algorithm::replace_all(a_format, + long_weekday_format, m_weekday_long_names[tm_value.tm_wday]); } if (m_weekday_short_names.size()) { - boost::algorithm::replace_all(a_format, - short_weekday_format, + boost::algorithm::replace_all(a_format, + short_weekday_format, m_weekday_short_names[tm_value.tm_wday]); } if (m_month_long_names.size()) { - boost::algorithm::replace_all(a_format, - long_month_format, + boost::algorithm::replace_all(a_format, + long_month_format, m_month_long_names[tm_value.tm_mon]); } if (m_month_short_names.size()) { - boost::algorithm::replace_all(a_format, - short_month_format, + boost::algorithm::replace_all(a_format, + short_month_format, m_month_short_names[tm_value.tm_mon]); } // use time_put facet to create final string const char_type* p_format = a_format.c_str(); - return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next, a_ios, - fill_char, + return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next, a_ios, + fill_char, &tm_value, - p_format, + p_format, p_format + a_format.size()); } protected: @@ -376,51 +359,51 @@ namespace boost { namespace date_time { template <class date_type, class CharT, class OutItrT> std::locale::id date_facet<date_type, CharT, OutItrT>::id; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type date_facet<date_type, CharT, OutItrT>::long_weekday_format[3] = {'%','A'}; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type date_facet<date_type, CharT, OutItrT>::short_weekday_format[3] = {'%','a'}; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type date_facet<date_type, CharT, OutItrT>::long_month_format[3] = {'%','B'}; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type date_facet<date_type, CharT, OutItrT>::short_month_format[3] = {'%','b'}; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type date_facet<date_type, CharT, OutItrT>::default_period_separator[4] = { ' ', '/', ' '}; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type - date_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] = + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type + date_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] = {'%', 'x' }; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type - date_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] = + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type + date_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] = {'%', 'Y', '%', 'm', '%', 'd' }; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type - date_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] = + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type + date_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd' }; - template <class date_type, class CharT, class OutItrT> - const typename date_facet<date_type, CharT, OutItrT>::char_type - date_facet<date_type, CharT, OutItrT>::default_date_format[9] = + template <class date_type, class CharT, class OutItrT> + const typename date_facet<date_type, CharT, OutItrT>::char_type + date_facet<date_type, CharT, OutItrT>::default_date_format[9] = {'%','Y','-','%','b','-','%','d'}; //! Input facet template <class date_type, - class CharT, + class CharT, class InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > > class date_input_facet : public std::locale::facet { public: @@ -434,7 +417,7 @@ namespace boost { namespace date_time { typedef std::basic_string<CharT> string_type; typedef CharT char_type; typedef boost::date_time::period_parser<date_type, CharT> period_parser_type; - typedef boost::date_time::special_values_parser<date_type,CharT> special_values_parser_type; + typedef boost::date_time::special_values_parser<date_type,CharT> special_values_parser_type; typedef std::vector<std::basic_string<CharT> > input_collection_type; typedef format_date_parser<date_type, CharT> format_date_parser_type; // date_generators stuff goes here @@ -458,9 +441,9 @@ namespace boost { namespace date_time { static const char_type iso_format_extended_specifier[9]; static const char_type default_date_format[9]; // YYYY-Mon-DD static std::locale::id id; - - explicit date_input_facet(::size_t a_ref = 0) - : std::locale::facet(a_ref), + + explicit date_input_facet(::size_t a_ref = 0) + : std::locale::facet(a_ref), m_format(default_date_format), m_month_format(short_month_format), m_weekday_format(short_weekday_format), @@ -470,8 +453,8 @@ namespace boost { namespace date_time { {} explicit date_input_facet(const string_type& format_str, - ::size_t a_ref = 0) - : std::locale::facet(a_ref), + ::size_t a_ref = 0) + : std::locale::facet(a_ref), m_format(format_str), m_month_format(short_month_format), m_weekday_format(short_weekday_format), @@ -518,7 +501,7 @@ namespace boost { namespace date_time { void year_format(const char_type* const format_str) { m_year_format = format_str; } - + void period_parser(period_parser_type per_parser) { m_period_parser = per_parser; } @@ -554,7 +537,7 @@ namespace boost { namespace date_time { const string_type& before, const string_type& after, const string_type& of) - + { m_date_gen_parser.element_strings(first,second,third,fourth,fifth,last,before,after,of); } @@ -564,68 +547,68 @@ namespace boost { namespace date_time { m_sv_parser = sv_parser; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& /*a_ios*/, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, date_type& d) const { d = m_parser.parse_date(from, to, m_format, m_sv_parser); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& /*a_ios*/, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, month_type& m) const { m = m_parser.parse_month(from, to, m_month_format); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& /*a_ios*/, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, day_of_week_type& wd) const { wd = m_parser.parse_weekday(from, to, m_weekday_format); return from; } //! Expects 1 or 2 digit day range: 1-31 - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& /*a_ios*/, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, day_type& d) const { d = m_parser.parse_var_day_of_month(from, to); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& /*a_ios*/, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, year_type& y) const { y = m_parser.parse_year(from, to, m_year_format); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, duration_type& dd) const { // skip leading whitespace - while(std::isspace(*from) && from != to) { ++from; } - - /* num_get.get() will always consume the first character if it - * is a sign indicator (+/-). Special value strings may begin + while(std::isspace(*from) && from != to) { ++from; } + + /* num_get.get() will always consume the first character if it + * is a sign indicator (+/-). Special value strings may begin * with one of these signs so we'll need a copy of it * in case num_get.get() fails. */ - char_type c = '\0'; + char_type c = '\0'; // TODO Are these characters somewhere in the locale? - if(*from == '-' || *from == '+') { + if(*from == '-' || *from == '+') { c = *from; } typedef std::num_get<CharT, InItrT> num_get; typename duration_type::duration_rep_type val = 0; std::ios_base::iostate err = std::ios_base::goodbit; - + if (std::has_facet<num_get>(a_ios.getloc())) { from = std::use_facet<num_get>(a_ios.getloc()).get(from, to, a_ios, err, val); } @@ -646,65 +629,65 @@ namespace boost { namespace date_time { boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'")); BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return from); // should never reach } - dd = duration_type(static_cast<special_values>(mr.current_match)); + dd = duration_type(static_cast<special_values>(mr.current_match)); } else { dd = duration_type(val); } return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, period_type& p) const { - p = m_period_parser.get_period(from, to, a_ios, p, duration_type::unit(), *this); + p = m_period_parser.get_period(from, to, a_ios, p, duration_type::unit(), *this); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, nth_kday_type& nkd) const { nkd = m_date_gen_parser.get_nth_kday_type(from, to, a_ios, *this); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, partial_date_type& pd) const { pd = m_date_gen_parser.get_partial_date_type(from, to, a_ios, *this); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, first_kday_type& fkd) const { fkd = m_date_gen_parser.get_first_kday_type(from, to, a_ios, *this); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, last_kday_type& lkd) const { lkd = m_date_gen_parser.get_last_kday_type(from, to, a_ios, *this); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, kday_before_type& fkb) const { fkb = m_date_gen_parser.get_kday_before_type(from, to, a_ios, *this); return from; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& a_ios, + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, kday_after_type& fka) const { fka = m_date_gen_parser.get_kday_after_type(from, to, a_ios, *this); @@ -727,52 +710,52 @@ namespace boost { namespace date_time { template <class date_type, class CharT, class OutItrT> std::locale::id date_input_facet<date_type, CharT, OutItrT>::id; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::long_weekday_format[3] = {'%','A'}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::short_weekday_format[3] = {'%','a'}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::long_month_format[3] = {'%','B'}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::short_month_format[3] = {'%','b'}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::four_digit_year_format[3] = {'%','Y'}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::two_digit_year_format[3] = {'%','y'}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type date_input_facet<date_type, CharT, OutItrT>::default_period_separator[4] = { ' ', '/', ' '}; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type - date_input_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] = + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type + date_input_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] = {'%', 'x' }; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type - date_input_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] = + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type + date_input_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] = {'%', 'Y', '%', 'm', '%', 'd' }; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type - date_input_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] = + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type + date_input_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd' }; - template <class date_type, class CharT, class OutItrT> - const typename date_input_facet<date_type, CharT, OutItrT>::char_type - date_input_facet<date_type, CharT, OutItrT>::default_date_format[9] = + template <class date_type, class CharT, class OutItrT> + const typename date_input_facet<date_type, CharT, OutItrT>::char_type + date_input_facet<date_type, CharT, OutItrT>::default_date_format[9] = {'%','Y','-','%','b','-','%','d'}; } } // namespaces diff --git a/3rdParty/Boost/src/boost/date_time/date_parsing.hpp b/3rdParty/Boost/src/boost/date_time/date_parsing.hpp index 41b6aef..f361bc8 100644 --- a/3rdParty/Boost/src/boost/date_time/date_parsing.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_parsing.hpp @@ -2,11 +2,11 @@ #define _DATE_TIME_DATE_PARSING_HPP___ /* Copyright (c) 2002,2003,2005 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: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ #include <string> @@ -29,11 +29,11 @@ namespace date_time { //! A function to replace the std::transform( , , ,tolower) construct /*! This function simply takes a string, and changes all the characters * in that string to lowercase (according to the default system locale). - * In the event that a compiler does not support locales, the old + * In the event that a compiler does not support locales, the old * C style tolower() is used. */ inline - std::string + std::string convert_to_lower(std::string inp) { #if !defined(BOOST_DATE_TIME_NO_LOCALE) @@ -57,11 +57,11 @@ namespace date_time { /* Used by-value parameter because we change the string and may * want to preserve the original argument */ template<class month_type> - inline unsigned short + inline unsigned short month_str_to_ushort(std::string const& s) { if((s.at(0) >= '0') && (s.at(0) <= '9')) { return boost::lexical_cast<unsigned short>(s); - } + } else { std::string str = convert_to_lower(s); typename month_type::month_map_ptr_type ptr = month_type::get_month_map_ptr(); @@ -78,11 +78,11 @@ namespace date_time { * must contain 'size' elements. The index of the match is returned. * If no match is found, 'size' is returned. * Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2. - * 'size' can be sent in with: greg_month::max() (which 12), - * greg_weekday::max() + 1 (which is 7) or date_time::NumSpecialValues */ + * 'size' can be sent in with: (greg_month::max)() (which 12), + * (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */ template<class charT> - short find_match(const charT* const* short_names, - const charT* const* long_names, + short find_match(const charT* const* short_names, + const charT* const* long_names, short size, const std::basic_string<charT>& s) { for(short i = 0; i < size; ++i){ @@ -92,12 +92,12 @@ namespace date_time { } return size; // not-found, return a value out of range } - + //! Generic function to parse a delimited date (eg: 2002-02-10) /*! Accepted formats are: "2003-02-10" or " 2003-Feb-10" or - * "2003-Feburary-10" - * The order in which the Month, Day, & Year appear in the argument - * string can be accomodated by passing in the appropriate ymd_order_spec + * "2003-Feburary-10" + * The order in which the Month, Day, & Year appear in the argument + * string can be accomodated by passing in the appropriate ymd_order_spec */ template<class date_type> date_type @@ -105,14 +105,14 @@ namespace date_time { std::string spec_str; if(order_spec == ymd_order_iso) { spec_str = "ymd"; - } + } else if(order_spec == ymd_order_dmy) { spec_str = "dmy"; - } + } else { // (order_spec == ymd_order_us) spec_str = "mdy"; } - + typedef typename date_type::year_type year_type; typedef typename date_type::month_type month_type; unsigned pos = 0; @@ -129,21 +129,21 @@ namespace date_time { const char sep_char[] = {',','-','.',' ','/','\0'}; char_separator_type sep(sep_char); tokenizer tok(s,sep); - for(tokenizer_iterator beg=tok.begin(); - beg!=tok.end() && pos < spec_str.size(); + for(tokenizer_iterator beg=tok.begin(); + beg!=tok.end() && pos < spec_str.size(); ++beg, ++pos) { switch(spec_str.at(pos)) { - case 'y': + case 'y': { year = boost::lexical_cast<unsigned short>(*beg); break; } - case 'm': + case 'm': { month = month_str_to_ushort<month_type>(*beg); break; } - case 'd': + case 'd': { day = boost::lexical_cast<unsigned short>(*beg); break; @@ -152,7 +152,7 @@ namespace date_time { } return date_type(year, month, day); } - + //! Generic function to parse undelimited date (eg: 20020201) template<class date_type> date_type @@ -162,16 +162,16 @@ namespace date_time { typedef typename date_type::year_type year_type; //typename date_type::ymd_type ymd((year_type::min)(),1,1); unsigned short y = 0, m = 0, d = 0; - - /* The two bool arguments state that parsing will not wrap - * (only the first 8 characters will be parsed) and partial - * strings will not be parsed. + + /* The two bool arguments state that parsing will not wrap + * (only the first 8 characters will be parsed) and partial + * strings will not be parsed. * Ex: * "2005121" will parse 2005 & 12, but not the "1" */ boost::offset_separator osf(offsets, offsets+3, false, false); - - typedef typename boost::tokenizer<boost::offset_separator, - std::basic_string<char>::const_iterator, + + typedef typename boost::tokenizer<boost::offset_separator, + std::basic_string<char>::const_iterator, std::basic_string<char> > tokenizer_type; tokenizer_type tok(s, osf); for(typename tokenizer_type::iterator ti=tok.begin(); ti!=tok.end();++ti) { @@ -185,17 +185,17 @@ namespace date_time { } return date_type(y,m,d); } - + //! Helper function for 'date gregorian::from_stream()' /*! Creates a string from the iterators that reference the - * begining & end of a char[] or string. All elements are + * begining & end of a char[] or string. All elements are * used in output string */ template<class date_type, class iterator_type> - inline + inline date_type - from_stream_type(iterator_type& beg, - iterator_type& end, - char) + from_stream_type(iterator_type& beg, + iterator_type const& end, + char) { std::ostringstream ss; while(beg != end) { @@ -203,16 +203,16 @@ namespace date_time { } return parse_date<date_type>(ss.str()); } - + //! Helper function for 'date gregorian::from_stream()' /*! Returns the first string found in the stream referenced by the * begining & end iterators */ template<class date_type, class iterator_type> - inline + inline date_type - from_stream_type(iterator_type& beg, - iterator_type& /* end */, - std::string) + from_stream_type(iterator_type& beg, + iterator_type const& /* end */, + std::string const&) { return parse_date<date_type>(*beg); } @@ -221,22 +221,30 @@ namespace date_time { * parse_date<>()? In the mean time this gets us started... */ //! Helper function for 'date gregorian::from_stream()' /*! Creates a string from the iterators that reference the - * begining & end of a wstring. All elements are + * begining & end of a wstring. All elements are * used in output string */ template<class date_type, class iterator_type> - inline - date_type from_stream_type(iterator_type& beg, - iterator_type& end, - wchar_t) + inline + date_type from_stream_type(iterator_type& beg, + iterator_type const& end, + wchar_t) { std::ostringstream ss; - while(beg != end) { #if !defined(BOOST_DATE_TIME_NO_LOCALE) - ss << std::use_facet<std::ctype<wchar_t> >(std::locale()).narrow(*beg++, 'X'); // 'X' will cause exception to be thrown + std::locale loc; + std::ctype<wchar_t> const& fac = std::use_facet<std::ctype<wchar_t> >(loc); + while(beg != end) { + ss << fac.narrow(*beg++, 'X'); // 'X' will cause exception to be thrown + } #else - ss << ss.narrow(*beg++, 'X'); -#endif + while(beg != end) { + char c = 'X'; // 'X' will cause exception to be thrown + const wchar_t wc = *beg++; + if (wc >= 0 && wc <= 127) + c = static_cast< char >(wc); + ss << c; } +#endif return parse_date<date_type>(ss.str()); } #ifndef BOOST_NO_STD_WSTRING @@ -244,21 +252,29 @@ namespace date_time { /*! Creates a string from the first wstring found in the stream * referenced by the begining & end iterators */ template<class date_type, class iterator_type> - inline + inline date_type - from_stream_type(iterator_type& beg, - iterator_type& /* end */, - std::wstring) { + from_stream_type(iterator_type& beg, + iterator_type const& /* end */, + std::wstring const&) { std::wstring ws = *beg; std::ostringstream ss; std::wstring::iterator wsb = ws.begin(), wse = ws.end(); - while(wsb != wse) { #if !defined(BOOST_DATE_TIME_NO_LOCALE) - ss << std::use_facet<std::ctype<wchar_t> >(std::locale()).narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown + std::locale loc; + std::ctype<wchar_t> const& fac = std::use_facet<std::ctype<wchar_t> >(loc); + while(wsb != wse) { + ss << fac.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown + } #else - ss << ss.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown -#endif + while(wsb != wse) { + char c = 'X'; // 'X' will cause exception to be thrown + const wchar_t wc = *wsb++; + if (wc >= 0 && wc <= 127) + c = static_cast< char >(wc); + ss << c; } +#endif return parse_date<date_type>(ss.str()); } #endif // BOOST_NO_STD_WSTRING @@ -267,27 +283,27 @@ namespace date_time { #else //! function called by wrapper functions: date_period_from_(w)string() template<class date_type, class charT> - period<date_type, typename date_type::duration_type> + period<date_type, typename date_type::duration_type> from_simple_string_type(const std::basic_string<charT>& s){ typedef typename std::basic_string<charT>::traits_type traits_type; typedef typename boost::char_separator<charT, traits_type> char_separator; - typedef typename boost::tokenizer<char_separator, - typename std::basic_string<charT>::const_iterator, + typedef typename boost::tokenizer<char_separator, + typename std::basic_string<charT>::const_iterator, std::basic_string<charT> > tokenizer; const charT sep_list[4] = {'[','/',']','\0'}; char_separator sep(sep_list); tokenizer tokens(s, sep); - typename tokenizer::iterator tok_it = tokens.begin(); + typename tokenizer::iterator tok_it = tokens.begin(); std::basic_string<charT> date_string = *tok_it; // get 2 string iterators and generate a date from them - typename std::basic_string<charT>::iterator date_string_start = date_string.begin(), - date_string_end = date_string.end(); + typename std::basic_string<charT>::iterator date_string_start = date_string.begin(), + date_string_end = date_string.end(); typedef typename std::iterator_traits<typename std::basic_string<charT>::iterator>::value_type value_type; date_type d1 = from_stream_type<date_type>(date_string_start, date_string_end, value_type()); date_string = *(++tok_it); // next token - date_string_start = date_string.begin(), date_string_end = date_string.end(); + date_string_start = date_string.begin(), date_string_end = date_string.end(); date_type d2 = from_stream_type<date_type>(date_string_start, date_string_end, value_type()); - return period<date_type, typename date_type::duration_type>(d1, d2); + return period<date_type, typename date_type::duration_type>(d1, d2); } #endif diff --git a/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp b/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp index 79a3d4c..27ed754 100644 --- a/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp +++ b/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp @@ -6,11 +6,11 @@ * 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: 2009-02-01 06:29:43 -0500 (Sun, 01 Feb 2009) $ + * $Date: 2009-06-06 07:24:09 -0400 (Sat, 06 Jun 2009) $ */ /*! @file filetime_functions.hpp - * Function(s) for converting between a FILETIME structure and a + * Function(s) for converting between a FILETIME structure and a * time object. This file is only available on systems that have * BOOST_HAS_FTIME defined. */ @@ -51,13 +51,13 @@ namespace winapi { boost::uint16_t wHour; boost::uint16_t wMinute; boost::uint16_t wSecond; - boost::uint16_t wMilliseconds; + boost::uint16_t wMilliseconds; }; - __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME* lpFileTime); - __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const FILETIME* lpFileTime, FILETIME* lpLocalFileTime); - __declspec(dllimport) void __stdcall GetSystemTime(SYSTEMTIME* lpSystemTime); - __declspec(dllimport) int __stdcall SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, FILETIME* lpFileTime); + __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME* lpFileTime); + __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const FILETIME* lpFileTime, FILETIME* lpLocalFileTime); + __declspec(dllimport) void __stdcall GetSystemTime(SYSTEMTIME* lpSystemTime); + __declspec(dllimport) int __stdcall SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, FILETIME* lpFileTime); } // extern "C" @@ -96,9 +96,7 @@ namespace winapi { { /* shift is difference between 1970-Jan-01 & 1601-Jan-01 * in 100-nanosecond intervals */ - const uint64_t c1 = 27111902UL; - const uint64_t c2 = 3577643008UL; // issues warning without 'UL' - const uint64_t shift = (c1 << 32) + c2; + const uint64_t shift = 116444736000000000ULL; // (27111902 << 32) + 3577643008 union { FileTimeT as_file_time; @@ -115,8 +113,8 @@ namespace winapi { //! Create a time object from an initialized FILETIME struct. /*! * Create a time object from an initialized FILETIME struct. - * A FILETIME struct holds 100-nanosecond units (0.0000001). When - * built with microsecond resolution the file_time's sub second value + * A FILETIME struct holds 100-nanosecond units (0.0000001). When + * built with microsecond resolution the file_time's sub second value * will be truncated. Nanosecond resolution has no truncation. * * \note The function is templated on the FILETIME type, so that diff --git a/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp b/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp index 21e4a49..a4a4d0d 100644 --- a/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp @@ -7,7 +7,7 @@ * 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: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ @@ -100,19 +100,19 @@ template<typename int_type, typename charT> inline int_type var_string_to_int(std::istreambuf_iterator<charT>& itr, - std::istreambuf_iterator<charT>& /* stream_end */, + const std::istreambuf_iterator<charT>& stream_end, unsigned int max_length) { typedef std::basic_string<charT> string_type; unsigned int j = 0; string_type s; - while ((j < max_length) && std::isdigit(*itr)) { + while (itr != stream_end && (j < max_length) && std::isdigit(*itr)) { s += (*itr); - itr++; - j++; + ++itr; + ++j; } int_type i = -1; - if(s.length() != 0) { + if(!s.empty()) { i = boost::lexical_cast<int_type>(s); } return i; diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp index 4428c05..f35796e 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp @@ -2,75 +2,65 @@ #define _GREGORIAN__CONVERSION_HPP___ /* Copyright (c) 2004-2005 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: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2009-06-06 07:27:35 -0400 (Sat, 06 Jun 2009) $ */ #include <string> #include <stdexcept> #include <boost/throw_exception.hpp> -#include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/c_time.hpp> -#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) -# if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) -# include <boost/date_time/gregorian/formatters_limited.hpp> -# else -# include <boost/date_time/gregorian/formatters.hpp> -# endif // BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS -#else -# include <sstream> -# include <boost/date_time/gregorian/gregorian_io.hpp> -#endif // USE_DATE_TIME_PRE_1_33_FACET_IO +#include <boost/date_time/special_defs.hpp> +#include <boost/date_time/gregorian/gregorian_types.hpp> namespace boost { namespace gregorian { - //! Converts a date to a tm struct. Throws out_of_range exception if date is a special value inline - std::tm to_tm(const date& d) + std::tm to_tm(const date& d) { - if(d.is_pos_infinity() || d.is_neg_infinity() || d.is_not_a_date()){ - std::string s = "tm unable to handle date value of "; -#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) - s += to_simple_string(d); -#else - std::ostringstream ss; - ss << d; - s += ss.str(); -#endif // USE_DATE_TIME_PRE_1_33_FACET_IO - boost::throw_exception(std::out_of_range(s)); + if (d.is_special()) + { + std::string s = "tm unable to handle "; + switch (d.as_special()) + { + case date_time::not_a_date_time: + s += "not-a-date-time value"; break; + case date_time::neg_infin: + s += "-infinity date value"; break; + case date_time::pos_infin: + s += "+infinity date value"; break; + default: + s += "a special date value"; break; + } + boost::throw_exception(std::out_of_range(s)); } - std::tm datetm; + + std::tm datetm = {}; // zero initialization is needed for extension members, like tm_zone boost::gregorian::date::ymd_type ymd = d.year_month_day(); - datetm.tm_year = ymd.year-1900; - datetm.tm_mon = ymd.month-1; + datetm.tm_year = ymd.year - 1900; + datetm.tm_mon = ymd.month - 1; datetm.tm_mday = ymd.day; datetm.tm_wday = d.day_of_week(); - datetm.tm_yday = d.day_of_year()-1; - datetm.tm_hour = datetm.tm_min = datetm.tm_sec = 0; + datetm.tm_yday = d.day_of_year() - 1; datetm.tm_isdst = -1; // negative because not enough info to set tm_isdst return datetm; } //! Converts a tm structure into a date dropping the any time values. inline - date date_from_tm(const std::tm& datetm) + date date_from_tm(const std::tm& datetm) { - return date(static_cast<unsigned short>(datetm.tm_year+1900), - static_cast<unsigned short>(datetm.tm_mon+1), + return date(static_cast<unsigned short>(datetm.tm_year+1900), + static_cast<unsigned short>(datetm.tm_mon+1), static_cast<unsigned short>(datetm.tm_mday)); } - } } //namespace boost::gregorian - - - #endif - diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp index b8b1f5a..483ead5 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp @@ -2,27 +2,28 @@ #define GREGORIAN_GREGORIAN_CALENDAR_HPP__ /* Copyright (c) 2002,2003 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 - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * Author: Jeff Garland + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/gregorian/greg_weekday.hpp" -#include "boost/date_time/gregorian/greg_day_of_year.hpp" -#include "boost/date_time/gregorian_calendar.hpp" -#include "boost/date_time/gregorian/greg_ymd.hpp" -#include "boost/date_time/int_adapter.hpp" +#include <boost/cstdint.hpp> +#include <boost/date_time/gregorian/greg_weekday.hpp> +#include <boost/date_time/gregorian/greg_day_of_year.hpp> +#include <boost/date_time/gregorian_calendar.hpp> +#include <boost/date_time/gregorian/greg_ymd.hpp> +#include <boost/date_time/int_adapter.hpp> namespace boost { namespace gregorian { - + //!An internal date representation that includes infinities, not a date - typedef date_time::int_adapter<unsigned long> fancy_date_rep; + typedef date_time::int_adapter<uint32_t> fancy_date_rep; //! Gregorian calendar for this implementation, hard work in the base - class gregorian_calendar : + class gregorian_calendar : public date_time::gregorian_calendar_base<greg_year_month_day, fancy_date_rep::int_type> { public: //! Type to hold a weekday (eg: Sunday, Monday,...) @@ -34,14 +35,14 @@ namespace gregorian { //! Date rep implements the traits stuff as well typedef fancy_date_rep date_traits_type; - + private: }; } } //namespace gregorian - + #endif - + diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp index 56d576f..ad67c0c 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp @@ -2,11 +2,11 @@ #define GREG_DATE_HPP___ /* Copyright (c) 2002,2003 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 - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * Author: Jeff Garland + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ #include <boost/throw_exception.hpp> @@ -28,10 +28,10 @@ namespace gregorian { using date_time::min_date_time; //! A date type based on gregorian_calendar - /*! This class is the primary interface for programming with + /*! This class is the primary interface for programming with greogorian dates. The is a lightweight type that can be - freely passed by value. All comparison operators are - supported. + freely passed by value. All comparison operators are + supported. \ingroup date_basics */ class date : public date_time::date<date, gregorian_calendar, date_duration> @@ -52,7 +52,7 @@ namespace gregorian { {} #endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR //! Main constructor with year, month, day - date(year_type y, month_type m, day_type d) + date(year_type y, month_type m, day_type d) : date_time::date<date, gregorian_calendar, date_duration>(y, m, d) { if (gregorian_calendar::end_of_month_day(y, m) < d) { @@ -60,7 +60,7 @@ namespace gregorian { } } //! Constructor from a ymd_type structure - explicit date(const ymd_type& ymd) + explicit date(const ymd_type& ymd) : date_time::date<date, gregorian_calendar, date_duration>(ymd) {} //! Needed copy constructor @@ -99,16 +99,16 @@ namespace gregorian { return day_of_year_type(doy); } //!Return the Modified Julian Day number for the date. - long modjulian_day() const + date_int_type modjulian_day() const { ymd_type ymd = year_month_day(); - return gregorian_calendar::modjulian_day_number(ymd); + return gregorian_calendar::modjulian_day_number(ymd); } //!Return the iso 8601 week number 1..53 int week_number() const { ymd_type ymd = year_month_day(); - return gregorian_calendar::week_number(ymd); + return gregorian_calendar::week_number(ymd); } //! Return the day number from the calendar date_int_type day_number() const @@ -118,7 +118,7 @@ namespace gregorian { //! Return the last day of the current month date end_of_month() const { - ymd_type ymd = year_month_day(); + ymd_type ymd = year_month_day(); short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month); return date(ymd.year, ymd.month, eom_day); } @@ -126,7 +126,7 @@ namespace gregorian { private: }; - + } } //namespace gregorian diff --git a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp index 6386008..c27c09e 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_GREGORIAN_CALENDAR_HPP__ /* Copyright (c) 2002,2003 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 - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * Author: Jeff Garland + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ @@ -27,7 +27,7 @@ namespace date_time { template<typename ymd_type_, typename date_int_type_> class gregorian_calendar_base { public: - //! define a type a date split into components + //! define a type a date split into components typedef ymd_type_ ymd_type; //! define a type for representing months typedef typename ymd_type::month_type month_type; @@ -44,10 +44,10 @@ namespace date_time { //static unsigned short day_of_year(date_int_type); static date_int_type day_number(const ymd_type& ymd); static date_int_type julian_day_number(const ymd_type& ymd); - static long modjulian_day_number(const ymd_type& ymd); + static date_int_type modjulian_day_number(const ymd_type& ymd); static ymd_type from_day_number(date_int_type); static ymd_type from_julian_day_number(date_int_type); - static ymd_type from_modjulian_day_number(long); + static ymd_type from_modjulian_day_number(date_int_type); static bool is_leap_year(year_type); static unsigned short end_of_month_day(year_type y, month_type m); static ymd_type epoch(); @@ -58,7 +58,7 @@ namespace date_time { } } //namespace - + #ifndef NO_BOOST_DATE_TIME_INLINE #include "boost/date_time/gregorian_calendar.ipp" #endif @@ -66,5 +66,5 @@ namespace date_time { #endif - + diff --git a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp index b7628fc..a281b45 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp +++ b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp @@ -1,9 +1,9 @@ /* Copyright (c) 2002,2003 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: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ #ifndef NO_BOOST_DATE_TIME_INLINE @@ -27,10 +27,10 @@ namespace date_time { //std::cout << year << "-" << month << "-" << day << " is day: " << d << "\n"; return d; } - + //!Return the iso week number for the date /*!Implements the rules associated with the iso 8601 week number. - Basically the rule is that Week 1 of the year is the week that contains + Basically the rule is that Week 1 of the year is the week that contains January 4th or the week that contains the first Thursday in January. Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000. */ @@ -42,11 +42,11 @@ namespace date_time { unsigned long juliantoday = julian_day_number(ymd); unsigned long day = (julianbegin + 3) % 7; unsigned long week = (juliantoday + day - julianbegin + 4)/7; - + if ((week >= 1) && (week <= 52)) { return week; } - + if ((week == 53)) { if((day==6) ||(day == 5 && is_leap_year(ymd.year))) { return week; //under these circumstances week == 53. @@ -62,18 +62,18 @@ namespace date_time { week = (juliantoday + day - julianbegin + 4)/7; return week; } - + return week; //not reachable -- well except if day == 5 and is_leap_year != true - + } - + //! Convert a ymd_type into a day number /*! The day number is an absolute number of days since the start of count */ template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE date_int_type_ - gregorian_calendar_base<ymd_type_,date_int_type_>::day_number(const ymd_type& ymd) + gregorian_calendar_base<ymd_type_,date_int_type_>::day_number(const ymd_type& ymd) { unsigned short a = static_cast<unsigned short>((14-ymd.month)/12); unsigned short y = static_cast<unsigned short>(ymd.year + 4800 - a); @@ -81,14 +81,14 @@ namespace date_time { unsigned long d = ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045; return d; } - + //! Convert a year-month-day into the julian day number /*! Since this implementation uses julian day internally, this is the same as the day_number. */ template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE date_int_type_ - gregorian_calendar_base<ymd_type_,date_int_type_>::julian_day_number(const ymd_type& ymd) + gregorian_calendar_base<ymd_type_,date_int_type_>::julian_day_number(const ymd_type& ymd) { return day_number(ymd); } @@ -99,17 +99,17 @@ namespace date_time { */ template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE - long - gregorian_calendar_base<ymd_type_,date_int_type_>::modjulian_day_number(const ymd_type& ymd) + date_int_type_ + gregorian_calendar_base<ymd_type_,date_int_type_>::modjulian_day_number(const ymd_type& ymd) { return julian_day_number(ymd)-2400001; //prerounded } - + //! Change a day number into a year-month-day template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE ymd_type_ - gregorian_calendar_base<ymd_type_,date_int_type_>::from_day_number(date_int_type dayNumber) + gregorian_calendar_base<ymd_type_,date_int_type_>::from_day_number(date_int_type dayNumber) { date_int_type a = dayNumber + 32044; date_int_type b = (4*a + 3)/146097; @@ -121,15 +121,15 @@ namespace date_time { unsigned short month = static_cast<unsigned short>(m + 3 - 12 * (m/10)); year_type year = static_cast<unsigned short>(100*b + d - 4800 + (m/10)); //std::cout << year << "-" << month << "-" << day << "\n"; - + return ymd_type(static_cast<unsigned short>(year),month,day); } - + //! Change a day number into a year-month-day template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE ymd_type_ - gregorian_calendar_base<ymd_type_,date_int_type_>::from_julian_day_number(date_int_type dayNumber) + gregorian_calendar_base<ymd_type_,date_int_type_>::from_julian_day_number(date_int_type dayNumber) { date_int_type a = dayNumber + 32044; date_int_type b = (4*a+3)/146097; @@ -141,19 +141,19 @@ namespace date_time { unsigned short month = static_cast<unsigned short>(m + 3 - 12 * (m/10)); year_type year = static_cast<year_type>(100*b + d - 4800 + (m/10)); //std::cout << year << "-" << month << "-" << day << "\n"; - + return ymd_type(year,month,day); } - + //! Change a modified julian day number into a year-month-day template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE ymd_type_ - gregorian_calendar_base<ymd_type_,date_int_type_>::from_modjulian_day_number(long dayNumber) { + gregorian_calendar_base<ymd_type_,date_int_type_>::from_modjulian_day_number(date_int_type dayNumber) { date_int_type jd = dayNumber + 2400001; //is 2400000.5 prerounded return from_julian_day_number(jd); } - + //! Determine if the provided year is a leap year /*! *@return true if year is a leap year, false otherwise @@ -161,12 +161,12 @@ namespace date_time { template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE bool - gregorian_calendar_base<ymd_type_,date_int_type_>::is_leap_year(year_type year) + gregorian_calendar_base<ymd_type_,date_int_type_>::is_leap_year(year_type year) { //divisible by 4, not if divisible by 100, but true if divisible by 400 return (!(year % 4)) && ((year % 100) || (!(year % 400))); } - + //! Calculate the last day of the month /*! Find the day which is the end of the month given year and month * No error checking is performed. @@ -175,7 +175,7 @@ namespace date_time { BOOST_DATE_TIME_INLINE unsigned short gregorian_calendar_base<ymd_type_,date_int_type_>::end_of_month_day(year_type year, - month_type month) + month_type month) { switch (month) { case 2: @@ -194,12 +194,12 @@ namespace date_time { }; } - + //! Provide the ymd_type specification for the calandar start template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE ymd_type_ - gregorian_calendar_base<ymd_type_,date_int_type_>::epoch() + gregorian_calendar_base<ymd_type_,date_int_type_>::epoch() { return ymd_type(1400,1,1); } @@ -208,7 +208,7 @@ namespace date_time { template<typename ymd_type_, typename date_int_type_> BOOST_DATE_TIME_INLINE unsigned short - gregorian_calendar_base<ymd_type_,date_int_type_>::days_in_week() + gregorian_calendar_base<ymd_type_,date_int_type_>::days_in_week() { return 7; } diff --git a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp index 363af5e..e6f3b8e 100644 --- a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp +++ b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp @@ -6,7 +6,7 @@ * 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: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $ + * $Date: 2009-06-04 07:36:43 -0400 (Thu, 04 Jun 2009) $ */ @@ -89,7 +89,7 @@ namespace date_time { winapi::get_system_time_as_file_time(ft); uint64_t micros = winapi::file_time_to_microseconds(ft); // it will not wrap, since ft is the current time // and cannot be before 1970-Jan-01 - std::time_t t = static_cast<time_t>(micros / 1000000UL); // seconds since epoch + std::time_t t = static_cast<std::time_t>(micros / 1000000UL); // seconds since epoch // microseconds -- static casts supress warnings boost::uint32_t sub_sec = static_cast<boost::uint32_t>(micros % 1000000UL); #else diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp index 82f8dca..9cdb864 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp @@ -2,18 +2,19 @@ #define POSIX_TIME_CONVERSION_HPP___ /* Copyright (c) 2002-2005 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: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/posix_time/ptime.hpp" -#include "boost/date_time/posix_time/posix_time_duration.hpp" -#include "boost/date_time/filetime_functions.hpp" -#include "boost/date_time/c_time.hpp" -#include "boost/date_time/gregorian/conversion.hpp" +#include <boost/date_time/posix_time/ptime.hpp> +#include <boost/date_time/posix_time/posix_time_duration.hpp> +#include <boost/date_time/filetime_functions.hpp> +#include <boost/date_time/c_time.hpp> +#include <boost/date_time/time_resolution_traits.hpp> // absolute_value +#include <boost/date_time/gregorian/conversion.hpp> namespace boost { @@ -22,34 +23,28 @@ namespace posix_time { //! Function that converts a time_t into a ptime. inline - ptime from_time_t(std::time_t t) + ptime from_time_t(std::time_t t) { ptime start(gregorian::date(1970,1,1)); return start + seconds(static_cast<long>(t)); } - //! Convert a time to a tm structure truncating any fractional seconds + //! Convert a time to a tm structure truncating any fractional seconds inline std::tm to_tm(const boost::posix_time::ptime& t) { std::tm timetm = boost::gregorian::to_tm(t.date()); boost::posix_time::time_duration td = t.time_of_day(); - timetm.tm_hour = td.hours(); - timetm.tm_min = td.minutes(); + timetm.tm_hour = td.hours(); + timetm.tm_min = td.minutes(); timetm.tm_sec = td.seconds(); - timetm.tm_isdst = -1; // -1 used when dst info is unknown + timetm.tm_isdst = -1; // -1 used when dst info is unknown return timetm; } - //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components + //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components inline std::tm to_tm(const boost::posix_time::time_duration& td) { - std::tm timetm; - timetm.tm_year = 0; - timetm.tm_mon = 0; - timetm.tm_mday = 0; - timetm.tm_wday = 0; - timetm.tm_yday = 0; - - timetm.tm_hour = date_time::absolute_value(td.hours()); + std::tm timetm = {}; + timetm.tm_hour = date_time::absolute_value(td.hours()); timetm.tm_min = date_time::absolute_value(td.minutes()); timetm.tm_sec = date_time::absolute_value(td.seconds()); timetm.tm_isdst = -1; // -1 used when dst info is unknown @@ -65,12 +60,12 @@ namespace posix_time { #if defined(BOOST_HAS_FTIME) - + //! Function to create a time object from an initialized FILETIME struct. /*! Function to create a time object from an initialized FILETIME struct. - * A FILETIME struct holds 100-nanosecond units (0.0000001). When - * built with microsecond resolution the FILETIME's sub second value - * will be truncated. Nanosecond resolution has no truncation. + * A FILETIME struct holds 100-nanosecond units (0.0000001). When + * built with microsecond resolution the FILETIME's sub second value + * will be truncated. Nanosecond resolution has no truncation. * * \note FILETIME is part of the Win32 API, so it is not portable to non-windows * platforms. diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp index c40a15c..60c3f7e 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp @@ -2,22 +2,22 @@ #define POSIX_TIME_CONFIG_HPP___ /* Copyright (c) 2002,2003,2005 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: 2008-10-13 05:00:03 -0400 (Mon, 13 Oct 2008) $ + * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $ */ -#include "boost/date_time/time_duration.hpp" -#include "boost/date_time/time_resolution_traits.hpp" -#include "boost/date_time/gregorian/gregorian_types.hpp" -#include "boost/date_time/wrapping_int.hpp" -#include "boost/limits.hpp" -#include "boost/date_time/compiler_config.hpp" -#include "boost/cstdint.hpp" -#include <boost/config/no_tr1/cmath.hpp> #include <cstdlib> //for MCW 7.2 std::abs(long long) +#include <boost/limits.hpp> +#include <boost/cstdint.hpp> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/date_time/time_duration.hpp> +#include <boost/date_time/time_resolution_traits.hpp> +#include <boost/date_time/gregorian/gregorian_types.hpp> +#include <boost/date_time/wrapping_int.hpp> +#include <boost/date_time/compiler_config.hpp> namespace boost { namespace posix_time { @@ -30,7 +30,7 @@ namespace posix_time { #define BOOST_DATE_TIME_HAS_MILLISECONDS #define BOOST_DATE_TIME_HAS_MICROSECONDS #define BOOST_DATE_TIME_HAS_NANOSECONDS - typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano, + typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano, 1000000000, 9 > time_res_traits; #else // set up conditional test compilations @@ -38,14 +38,14 @@ namespace posix_time { #define BOOST_DATE_TIME_HAS_MICROSECONDS #undef BOOST_DATE_TIME_HAS_NANOSECONDS typedef date_time::time_resolution_traits< - boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro, + boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro, 1000000, 6 > time_res_traits; // #undef BOOST_DATE_TIME_HAS_MILLISECONDS // #undef BOOST_DATE_TIME_HAS_MICROSECONDS // #undef BOOST_DATE_TIME_HAS_NANOSECONDS -// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth, +// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth, // 10, 0 > time_res_traits; #endif @@ -82,8 +82,8 @@ namespace posix_time { //Give duration access to ticks constructor -- hide from users friend class date_time::time_duration<time_duration, time_res_traits>; private: - explicit time_duration(impl_type ticks) : - date_time::time_duration<time_duration, time_res_traits>(ticks) + explicit time_duration(impl_type tick_count) : + date_time::time_duration<time_duration, time_res_traits>(tick_count) {} }; @@ -134,7 +134,7 @@ namespace posix_time { } }; - class posix_time_system_config + class posix_time_system_config { public: typedef simple_time_rep time_rep_type; @@ -143,7 +143,7 @@ namespace posix_time { typedef time_duration time_duration_type; typedef time_res_traits::tick_type int_type; typedef time_res_traits resolution_traits; -#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers #else BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000000); #endif @@ -151,7 +151,7 @@ namespace posix_time { #else - class millisec_posix_time_system_config + class millisec_posix_time_system_config { public: typedef boost::int64_t time_rep_type; @@ -162,7 +162,7 @@ namespace posix_time { typedef time_res_traits::tick_type int_type; typedef time_res_traits::impl_type impl_type; typedef time_res_traits resolution_traits; -#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers #else BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000); #endif diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp index dc8facf..466331b 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp @@ -2,24 +2,24 @@ #define POSIXTIME_FORMATTERS_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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/gregorian/gregorian.hpp" -#include "boost/date_time/compiler_config.hpp" -#include "boost/date_time/iso_format.hpp" -#include "boost/date_time/date_format_simple.hpp" -#include "boost/date_time/posix_time/posix_time_types.hpp" -#include "boost/date_time/time_formatting_streams.hpp" +#include <boost/date_time/gregorian/gregorian.hpp> +#include <boost/date_time/compiler_config.hpp> +#include <boost/date_time/iso_format.hpp> +#include <boost/date_time/date_format_simple.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/time_formatting_streams.hpp> +#include <boost/date_time/time_resolution_traits.hpp> // absolute_value +#include <boost/date_time/time_parsing.hpp> -#include "boost/date_time/time_parsing.hpp" - -/* NOTE: The "to_*_string" code for older compilers, ones that define - * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in +/* NOTE: The "to_*_string" code for older compilers, ones that define + * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in * formatters_limited.hpp */ @@ -57,27 +57,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.hours()) << ":"; - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.minutes()) << ":"; - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] charT buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill(fill_char) - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -99,7 +99,7 @@ namespace posix_time { // template function called by wrapper functions: // to_*_string(time_duration) & to_*_wstring(time_duration) template<class charT> - inline std::basic_string<charT> to_iso_string_type(time_duration td) + inline std::basic_string<charT> to_iso_string_type(time_duration td) { std::basic_ostringstream<charT> ss; if(td.is_special()) { @@ -126,27 +126,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.hours()); - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.minutes()); - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] charT buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill(fill_char) - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -168,7 +168,7 @@ namespace posix_time { /*!\ingroup time_format */ template<class charT> - inline std::basic_string<charT> to_simple_string_type(ptime t) + inline std::basic_string<charT> to_simple_string_type(ptime t) { // can't use this w/gcc295, no to_simple_string_type<>(td) available std::basic_string<charT> ts = gregorian::to_simple_string_type<charT>(t.date());// + " "; @@ -184,10 +184,10 @@ namespace posix_time { return to_simple_string_type<char>(t); } - // function called by wrapper functions to_*_string(time_period) + // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template<class charT> - inline std::basic_string<charT> to_simple_string_type(time_period tp) + inline std::basic_string<charT> to_simple_string_type(time_period tp) { charT beg = '[', mid = '/', end = ']'; std::basic_string<charT> d1(to_simple_string_type<charT>(tp.begin())); @@ -201,10 +201,10 @@ namespace posix_time { return to_simple_string_type<char>(tp); } - // function called by wrapper functions to_*_string(time_period) + // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template<class charT> - inline std::basic_string<charT> to_iso_string_type(ptime t) + inline std::basic_string<charT> to_iso_string_type(ptime t) { std::basic_string<charT> ts = gregorian::to_iso_string_type<charT>(t.date());// + "T"; if(!t.time_of_day().is_special()) { @@ -223,10 +223,10 @@ namespace posix_time { } - // function called by wrapper functions to_*_string(time_period) + // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template<class charT> - inline std::basic_string<charT> to_iso_extended_string_type(ptime t) + inline std::basic_string<charT> to_iso_extended_string_type(ptime t) { std::basic_string<charT> ts = gregorian::to_iso_extended_string_type<charT>(t.date());// + "T"; if(!t.time_of_day().is_special()) { diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp index def5169..d0e959e 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp @@ -2,20 +2,21 @@ #define POSIXTIME_FORMATTERS_LIMITED_HPP___ /* Copyright (c) 2002,2003 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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/gregorian/gregorian.hpp" -#include "boost/date_time/compiler_config.hpp" -#include "boost/date_time/iso_format.hpp" -#include "boost/date_time/date_format_simple.hpp" -#include "boost/date_time/posix_time/posix_time_types.hpp" -#include "boost/date_time/time_formatting_streams.hpp" - +#include <boost/date_time/gregorian/gregorian.hpp> +#include <boost/date_time/compiler_config.hpp> +#include <boost/date_time/iso_format.hpp> +#include <boost/date_time/date_format_simple.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/time_formatting_streams.hpp> +#include <boost/date_time/time_resolution_traits.hpp> // absolute_value + namespace boost { namespace posix_time { @@ -49,27 +50,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.hours()) << ":"; - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.minutes()) << ":"; - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] char buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill('0') - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -84,9 +85,9 @@ namespace posix_time { //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 /*!\ingroup time_format */ - inline - std::string - to_iso_string(time_duration td) + inline + std::string + to_iso_string(time_duration td) { std::ostringstream ss; if(td.is_special()) { @@ -112,27 +113,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.hours()); - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.minutes()); - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] char buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill('0') - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -147,9 +148,9 @@ namespace posix_time { //! Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff /*!\ingroup time_format */ - inline - std::string - to_simple_string(ptime t) + inline + std::string + to_simple_string(ptime t) { std::string ts = gregorian::to_simple_string(t.date());// + " "; if(!t.time_of_day().is_special()) { @@ -163,9 +164,9 @@ namespace posix_time { //! Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] /*!\ingroup time_format */ - inline - std::string - to_simple_string(time_period tp) + inline + std::string + to_simple_string(time_period tp) { std::string d1(to_simple_string(tp.begin())); std::string d2(to_simple_string(tp.last())); @@ -175,8 +176,8 @@ namespace posix_time { //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator /*!\ingroup time_format */ - inline - std::string to_iso_string(ptime t) + inline + std::string to_iso_string(ptime t) { std::string ts = gregorian::to_iso_string(t.date());// + "T"; if(!t.time_of_day().is_special()) { @@ -190,9 +191,9 @@ namespace posix_time { //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator /*!\ingroup time_format */ - inline - std::string - to_iso_extended_string(ptime t) + inline + std::string + to_iso_extended_string(ptime t) { std::string ts = gregorian::to_iso_extended_string(t.date());// + "T"; if(!t.time_of_day().is_special()) { diff --git a/3rdParty/Boost/src/boost/date_time/time_duration.hpp b/3rdParty/Boost/src/boost/date_time/time_duration.hpp index 4004125..2fd2590 100644 --- a/3rdParty/Boost/src/boost/date_time/time_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_duration.hpp @@ -6,18 +6,19 @@ * 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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ -#include "boost/operators.hpp" -#include "boost/date_time/time_defs.hpp" -#include "boost/date_time/special_defs.hpp" -#include "boost/date_time/compiler_config.hpp" +#include <boost/cstdint.hpp> +#include <boost/operators.hpp> +#include <boost/date_time/time_defs.hpp> +#include <boost/date_time/special_defs.hpp> +#include <boost/date_time/compiler_config.hpp> namespace boost { namespace date_time { - + //! Represents some amount of elapsed time measure to a given resolution /*! This class represents a standard set of capabilities for all counted time durations. Time duration implementations should derive @@ -30,13 +31,13 @@ namespace date_time { */ template<class T, typename rep_type> class time_duration : private - boost::less_than_comparable<T + boost::less_than_comparable<T , boost::equality_comparable<T > > /* dividable, addable, and subtractable operator templates - * won't work with this class (MSVC++ 6.0). return type - * from '+=' is different than expected return type - * from '+'. multipliable probably wont work + * won't work with this class (MSVC++ 6.0). return type + * from '+=' is different than expected return type + * from '+'. multipliable probably wont work * either (haven't tried) */ { public: @@ -50,12 +51,12 @@ namespace date_time { typedef typename rep_type::tick_type tick_type; typedef typename rep_type::impl_type impl_type; - time_duration() : ticks_(0) {} - time_duration(hour_type hours_in, - min_type minutes_in, + time_duration() : ticks_(0) {} + time_duration(hour_type hours_in, + min_type minutes_in, sec_type seconds_in=0, fractional_seconds_type frac_sec_in = 0) : - ticks_(rep_type::to_tick_count(hours_in,minutes_in,seconds_in,frac_sec_in)) + ticks_(rep_type::to_tick_count(hours_in,minutes_in,seconds_in,frac_sec_in)) {} // copy constructor required for dividable<> //! Construct from another time_duration (Copy constructor) @@ -136,17 +137,17 @@ namespace date_time { } duration_type invert_sign() const { - return duration_type(ticks_ * (-1)); - } + return duration_type(ticks_ * (-1)); + } bool is_negative() const { return ticks_ < 0; - } - bool operator<(const time_duration& rhs) const + } + bool operator<(const time_duration& rhs) const { return ticks_ < rhs.ticks_; } - bool operator==(const time_duration& rhs) const + bool operator==(const time_duration& rhs) const { return ticks_ == rhs.ticks_; } @@ -188,13 +189,13 @@ namespace date_time { { return duration_type(ticks_ * rhs); } - duration_type operator*=(int divisor) + duration_type operator*=(int divisor) { ticks_ = ticks_ * divisor; return duration_type(ticks_); } - tick_type ticks() const - { + tick_type ticks() const + { return traits_type::as_number(ticks_); } @@ -258,9 +259,9 @@ namespace date_time { //! Template for instantiating derived adjusting durations /* These templates are designed to work with multiples of - * 10 for frac_of_second and resoultion adjustment + * 10 for frac_of_second and resoultion adjustment */ - template<class base_duration, boost::int64_t frac_of_second> + template<class base_duration, boost::int64_t frac_of_second> class subsecond_duration : public base_duration { public: @@ -270,8 +271,8 @@ namespace date_time { {} }; - - + + } } //namespace date_time diff --git a/3rdParty/Boost/src/boost/date_time/time_facet.hpp b/3rdParty/Boost/src/boost/date_time/time_facet.hpp index c1a2f8e..3f27f77 100644 --- a/3rdParty/Boost/src/boost/date_time/time_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_facet.hpp @@ -3,11 +3,11 @@ #define _DATE_TIME_FACET__HPP__ /* Copyright (c) 2004-2005 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: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ #include <cctype> @@ -27,6 +27,7 @@ #include <boost/date_time/date_facet.hpp> #include <boost/date_time/string_convert.hpp> #include <boost/date_time/special_defs.hpp> +#include <boost/date_time/time_resolution_traits.hpp> // absolute_value namespace boost { namespace date_time { @@ -55,129 +56,129 @@ namespace date_time { static const char_type iso_time_format_specifier[18]; static const char_type iso_time_format_extended_specifier[22]; //default ptime format is YYYY-Mon-DD HH:MM:SS[.fff...][ zzz] - static const char_type default_time_format[23]; + static const char_type default_time_format[23]; // default_time_input_format uses a posix_time_zone_string instead of a time zone abbrev - static const char_type default_time_input_format[24]; + static const char_type default_time_input_format[24]; //default time_duration format is HH:MM:SS[.fff...] static const char_type default_time_duration_format[11]; }; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::fractional_seconds_format[3] = {'%','f'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::fractional_seconds_or_none_format[3] = {'%','F'}; - template <class CharT> - const typename time_formats<CharT>::char_type - time_formats<CharT>::seconds_with_fractional_seconds_format[3] = + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::seconds_with_fractional_seconds_format[3] = {'%','s'}; template <class CharT> - const typename time_formats<CharT>::char_type + const typename time_formats<CharT>::char_type time_formats<CharT>::seconds_format[3] = {'%','S'}; template <class CharT> - const typename time_formats<CharT>::char_type + const typename time_formats<CharT>::char_type time_formats<CharT>::hours_format[3] = {'%','H'}; template <class CharT> - const typename time_formats<CharT>::char_type + const typename time_formats<CharT>::char_type time_formats<CharT>::unrestricted_hours_format[3] = {'%','O'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type //time_formats<CharT>::standard_format[5] = {'%','c',' ','%','z'}; time_formats<CharT>::standard_format[9] = {'%','x',' ','%','X',' ','%','z'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::zone_abbrev_format[3] = {'%','z'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::zone_name_format[3] = {'%','Z'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::zone_iso_format[3] = {'%','q'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::zone_iso_extended_format[3] ={'%','Q'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::posix_zone_string_format[4] ={'%','Z','P'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::duration_seperator[2] = {':'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::negative_sign[2] = {'-'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::positive_sign[2] = {'+'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::duration_sign_negative_only[3] ={'%','-'}; - template <class CharT> - const typename time_formats<CharT>::char_type + template <class CharT> + const typename time_formats<CharT>::char_type time_formats<CharT>::duration_sign_always[3] ={'%','+'}; - template <class CharT> - const typename time_formats<CharT>::char_type - time_formats<CharT>::iso_time_format_specifier[18] = - {'%', 'Y', '%', 'm', '%', 'd', 'T', + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::iso_time_format_specifier[18] = + {'%', 'Y', '%', 'm', '%', 'd', 'T', '%', 'H', '%', 'M', '%', 'S', '%', 'F', '%','q' }; - template <class CharT> - const typename time_formats<CharT>::char_type - time_formats<CharT>::iso_time_format_extended_specifier[22] = - {'%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::iso_time_format_extended_specifier[22] = + {'%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', '%', 'H', ':', '%', 'M', ':', '%', 'S', '%', 'F','%','Q'}; - template <class CharT> - const typename time_formats<CharT>::char_type - time_formats<CharT>::default_time_format[23] = + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::default_time_format[23] = {'%','Y','-','%','b','-','%','d',' ', '%','H',':','%','M',':','%','S','%','F',' ','%','z'}; - template <class CharT> - const typename time_formats<CharT>::char_type - time_formats<CharT>::default_time_input_format[24] = + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::default_time_input_format[24] = {'%','Y','-','%','b','-','%','d',' ', '%','H',':','%','M',':','%','S','%','F',' ','%','Z','P'}; - template <class CharT> - const typename time_formats<CharT>::char_type - time_formats<CharT>::default_time_duration_format[11] = - {'%','H',':','%','M',':','%','S','%','F'}; + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::default_time_duration_format[11] = + {'%','O',':','%','M',':','%','S','%','F'}; - /*! Facet used for format-based output of time types + /*! Facet used for format-based output of time types * This class provides for the use of format strings to output times. In addition * to the flags for formatting date elements, the following are the allowed format flags: * - %x %X => default format - enables addition of more flags to default (ie. "%x %X %z") * - %f => fractional seconds ".123456" * - %F => fractional seconds or none: like frac sec but empty if frac sec == 0 - * - %s => seconds w/ fractional sec "02.123" (this is the same as "%S%f) + * - %s => seconds w/ fractional sec "02.123" (this is the same as "%S%f) * - %S => seconds "02" * - %z => abbreviated time zone "EDT" * - %Z => full time zone name "Eastern Daylight Time" */ template <class time_type, - class CharT, + class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > - class time_facet : + class time_facet : public boost::date_time::date_facet<typename time_type::date_type , CharT, OutItrT> { public: typedef typename time_type::date_type date_type; @@ -210,7 +211,7 @@ namespace date_time { static const char_type* iso_time_format_extended_specifier; //default ptime format is YYYY-Mon-DD HH:MM:SS[.fff...][ zzz] - static const char_type* default_time_format; + static const char_type* default_time_format; //default time_duration format is HH:MM:SS[.fff...] static const char_type* default_time_duration_format; static std::locale::id id; @@ -227,20 +228,20 @@ namespace date_time { //! Construct the facet with an explicitly specified format explicit time_facet(const char_type* a_format, - period_formatter_type period_formatter = period_formatter_type(), - const special_values_formatter_type& special_value_formatter = special_values_formatter_type(), + period_formatter_type period_formatter = period_formatter_type(), + const special_values_formatter_type& special_value_formatter = special_values_formatter_type(), date_gen_formatter_type dg_formatter = date_gen_formatter_type(), - ::size_t a_ref = 0) - : base_type(a_format, + ::size_t a_ref = 0) + : base_type(a_format, period_formatter, - special_value_formatter, - dg_formatter, + special_value_formatter, + dg_formatter, a_ref), m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) {} //! Changes format for time_duration - void time_duration_format(const char_type* const format) + void time_duration_format(const char_type* const format) { m_time_duration_format = format; } @@ -254,33 +255,33 @@ namespace date_time { this->m_format = iso_time_format_extended_specifier; } - OutItrT put(OutItrT a_next, - std::ios_base& a_ios, - char_type a_fill, - const time_type& a_time) const + OutItrT put(OutItrT a_next, + std::ios_base& a_ios, + char_type a_fill, + const time_type& a_time) const { - if (a_time.is_special()) { - return this->do_put_special(a_next, a_ios, a_fill, + if (a_time.is_special()) { + return this->do_put_special(a_next, a_ios, a_fill, a_time.date().as_special()); } string_type format(this->m_format); string_type frac_str; if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { - // replace %s with %S.nnn - frac_str = + // replace %s with %S.nnn + frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); - + string_type replace_string(seconds_format); replace_string += sep; replace_string += frac_str; - boost::algorithm::replace_all(format, - seconds_with_fractional_seconds_format, + boost::algorithm::replace_all(format, + seconds_with_fractional_seconds_format, replace_string); } /* NOTE: replacing posix_zone_string_format must be done BEFORE - * zone_name_format: "%ZP" & "%Z", if Z is checked first it will + * zone_name_format: "%ZP" & "%Z", if Z is checked first it will * incorrectly replace a zone_name where a posix_string should go */ if (format.find(posix_zone_string_format) != string_type::npos) { if(a_time.zone_abbrev().empty()) { @@ -296,8 +297,8 @@ namespace date_time { } if (format.find(zone_name_format) != string_type::npos) { if(a_time.zone_name().empty()) { - /* TODO: this'll probably create problems if a user places - * the zone_*_format flag in the format with a ptime. This + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_name() returns an empty string, we want to @@ -314,8 +315,8 @@ namespace date_time { } if (format.find(zone_abbrev_format) != string_type::npos) { if(a_time.zone_abbrev(false).empty()) { - /* TODO: this'll probably create problems if a user places - * the zone_*_format flag in the format with a ptime. This + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_abbrev() returns an empty string, we want to @@ -332,8 +333,8 @@ namespace date_time { } if (format.find(zone_iso_extended_format) != string_type::npos) { if(a_time.zone_name(true).empty()) { - /* TODO: this'll probably create problems if a user places - * the zone_*_format flag in the format with a ptime. This + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_name() returns an empty string, we want to @@ -349,8 +350,8 @@ namespace date_time { if (format.find(zone_iso_format) != string_type::npos) { if(a_time.zone_abbrev(true).empty()) { - /* TODO: this'll probably create problems if a user places - * the zone_*_format flag in the format with a ptime. This + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_abbrev() returns an empty string, we want to @@ -369,13 +370,13 @@ namespace date_time { frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); } boost::algorithm::replace_all(format, - fractional_seconds_format, + fractional_seconds_format, frac_str); } if (format.find(fractional_seconds_or_none_format) != string_type::npos) { // replace %F with nnnnnnn or nothing if fs == 0 - frac_str = + frac_str = fractional_seconds_as_string(a_time.time_of_day(), true); if (frac_str.size()) { char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); @@ -383,7 +384,7 @@ namespace date_time { replace_string += sep; replace_string += frac_str; boost::algorithm::replace_all(format, - fractional_seconds_or_none_format, + fractional_seconds_or_none_format, replace_string); } else { @@ -392,46 +393,46 @@ namespace date_time { } } - return this->do_put_tm(a_next, a_ios, a_fill, + return this->do_put_tm(a_next, a_ios, a_fill, to_tm(a_time), format); } //! put function for time_duration - OutItrT put(OutItrT a_next, - std::ios_base& a_ios, - char_type a_fill, - const time_duration_type& a_time_dur) const + OutItrT put(OutItrT a_next, + std::ios_base& a_ios, + char_type a_fill, + const time_duration_type& a_time_dur) const { - if (a_time_dur.is_special()) { - return this->do_put_special(a_next, a_ios, a_fill, + if (a_time_dur.is_special()) { + return this->do_put_special(a_next, a_ios, a_fill, a_time_dur.get_rep().as_special()); } string_type format(m_time_duration_format); if (a_time_dur.is_negative()) { // replace %- with minus sign. Should we use the numpunct facet? - boost::algorithm::replace_all(format, - duration_sign_negative_only, + boost::algorithm::replace_all(format, + duration_sign_negative_only, negative_sign); // remove all the %+ in the string with '-' - boost::algorithm::replace_all(format, - duration_sign_always, + boost::algorithm::replace_all(format, + duration_sign_always, negative_sign); } else { //duration is positive // remove all the %- combos from the string boost::algorithm::erase_all(format, duration_sign_negative_only); // remove all the %+ in the string with '+' - boost::algorithm::replace_all(format, - duration_sign_always, + boost::algorithm::replace_all(format, + duration_sign_always, positive_sign); } /* - * It is possible for a time duration to span more then 24 hours. - * Standard time_put::put is obliged to behave the same as strftime - * (See ISO 14882-2003 22.2.5.3.1 par. 1) and strftime's behavior is - * unspecified for the case when tm_hour field is outside 0-23 range + * It is possible for a time duration to span more then 24 hours. + * Standard time_put::put is obliged to behave the same as strftime + * (See ISO 14882-2003 22.2.5.3.1 par. 1) and strftime's behavior is + * unspecified for the case when tm_hour field is outside 0-23 range * (See ISO 9899-1999 7.23.3.5 par. 3). So we must output %H and %O * here ourself. */ @@ -452,16 +453,16 @@ namespace date_time { string_type frac_str; if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { - // replace %s with %S.nnn - frac_str = + // replace %s with %S.nnn + frac_str = fractional_seconds_as_string(a_time_dur, false); char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); - + string_type replace_string(seconds_format); replace_string += sep; replace_string += frac_str; - boost::algorithm::replace_all(format, - seconds_with_fractional_seconds_format, + boost::algorithm::replace_all(format, + seconds_with_fractional_seconds_format, replace_string); } if (format.find(fractional_seconds_format) != string_type::npos) { @@ -470,13 +471,13 @@ namespace date_time { frac_str = fractional_seconds_as_string(a_time_dur, false); } boost::algorithm::replace_all(format, - fractional_seconds_format, + fractional_seconds_format, frac_str); } if (format.find(fractional_seconds_or_none_format) != string_type::npos) { // replace %F with nnnnnnn or nothing if fs == 0 - frac_str = + frac_str = fractional_seconds_as_string(a_time_dur, true); if (frac_str.size()) { char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); @@ -484,7 +485,7 @@ namespace date_time { replace_string += sep; replace_string += frac_str; boost::algorithm::replace_all(format, - fractional_seconds_or_none_format, + fractional_seconds_or_none_format, replace_string); } else { @@ -493,12 +494,12 @@ namespace date_time { } } - return this->do_put_tm(a_next, a_ios, a_fill, + return this->do_put_tm(a_next, a_ios, a_fill, to_tm(a_time_dur), format); } - - OutItrT put(OutItrT next, std::ios_base& a_ios, - char_type fill, const period_type& p) const + + OutItrT put(OutItrT next, std::ios_base& a_ios, + char_type fill, const period_type& p) const { return this->m_period_formatter.put_period(next, a_ios, fill,p,*this); } @@ -506,12 +507,12 @@ namespace date_time { protected: - static - string_type + static + string_type fractional_seconds_as_string(const time_duration_type& a_time, - bool null_when_zero) + bool null_when_zero) { - typename time_duration_type::fractional_seconds_type frac_sec = + typename time_duration_type::fractional_seconds_type frac_sec = a_time.fractional_seconds(); if (null_when_zero && (frac_sec == 0)) { @@ -538,7 +539,7 @@ namespace date_time { { std::basic_ostringstream<char_type> ss; ss.imbue(std::locale::classic()); // don't want any formatting - ss << std::setw(width) + ss << std::setw(width) << std::setfill(static_cast<char_type>('0')); #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) // JDG [7/6/02 VC++ compatibility] @@ -555,105 +556,105 @@ namespace date_time { }; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> std::locale::id time_facet<time_type, CharT, OutItrT>::id; - template <class time_type, class CharT, class OutItrT> - const typename time_facet<time_type, CharT, OutItrT>::char_type* + template <class time_type, class CharT, class OutItrT> + const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::fractional_seconds_format = time_formats<CharT>::fractional_seconds_format; - template <class time_type, class CharT, class OutItrT> - const typename time_facet<time_type, CharT, OutItrT>::char_type* + template <class time_type, class CharT, class OutItrT> + const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::fractional_seconds_or_none_format = time_formats<CharT>::fractional_seconds_or_none_format; - template <class time_type, class CharT, class OutItrT> - const typename time_facet<time_type, CharT, OutItrT>::char_type* - time_facet<time_type, CharT, OutItrT>::seconds_with_fractional_seconds_format = + template <class time_type, class CharT, class OutItrT> + const typename time_facet<time_type, CharT, OutItrT>::char_type* + time_facet<time_type, CharT, OutItrT>::seconds_with_fractional_seconds_format = time_formats<CharT>::seconds_with_fractional_seconds_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::zone_name_format = time_formats<CharT>::zone_name_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::zone_abbrev_format = time_formats<CharT>::zone_abbrev_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::zone_iso_extended_format =time_formats<CharT>::zone_iso_extended_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::posix_zone_string_format =time_formats<CharT>::posix_zone_string_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::zone_iso_format = time_formats<CharT>::zone_iso_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::seconds_format = time_formats<CharT>::seconds_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::hours_format = time_formats<CharT>::hours_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::unrestricted_hours_format = time_formats<CharT>::unrestricted_hours_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::standard_format = time_formats<CharT>::standard_format; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::duration_seperator = time_formats<CharT>::duration_seperator; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::negative_sign = time_formats<CharT>::negative_sign; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::positive_sign = time_formats<CharT>::positive_sign; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::duration_sign_negative_only = time_formats<CharT>::duration_sign_negative_only; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::duration_sign_always = time_formats<CharT>::duration_sign_always; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type,CharT, OutItrT>::char_type* time_facet<time_type,CharT, OutItrT>::iso_time_format_specifier = time_formats<CharT>::iso_time_format_specifier; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* time_facet<time_type, CharT, OutItrT>::iso_time_format_extended_specifier = time_formats<CharT>::iso_time_format_extended_specifier; - template <class time_type, class CharT, class OutItrT> + template <class time_type, class CharT, class OutItrT> const typename time_facet<time_type, CharT, OutItrT>::char_type* - time_facet<time_type, CharT, OutItrT>::default_time_format = + time_facet<time_type, CharT, OutItrT>::default_time_format = time_formats<CharT>::default_time_format; - template <class time_type, class CharT, class OutItrT> - const typename time_facet<time_type, CharT, OutItrT>::char_type* - time_facet<time_type, CharT, OutItrT>::default_time_duration_format = + template <class time_type, class CharT, class OutItrT> + const typename time_facet<time_type, CharT, OutItrT>::char_type* + time_facet<time_type, CharT, OutItrT>::default_time_duration_format = time_formats<CharT>::default_time_duration_format; - //! Facet for format-based input. + //! Facet for format-based input. /*! */ template <class time_type, - class CharT, + class CharT, class InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > > - class time_input_facet : + class time_input_facet : public boost::date_time::date_input_facet<typename time_type::date_type , CharT, InItrT> { public: typedef typename time_type::date_type date_type; @@ -686,13 +687,13 @@ namespace date_time { static const char_type* duration_seperator; static const char_type* iso_time_format_specifier; static const char_type* iso_time_format_extended_specifier; - static const char_type* default_time_input_format; + static const char_type* default_time_input_format; static const char_type* default_time_duration_format; static std::locale::id id; //! Constructor that takes a format string for a ptime - explicit time_input_facet(const string_type& format, ::size_t a_ref = 0) - : base_type(format, a_ref), + explicit time_input_facet(const string_type& format, ::size_t a_ref = 0) + : base_type(format, a_ref), m_time_duration_format(default_time_duration_format) { } @@ -707,16 +708,16 @@ namespace date_time { sv_parser, per_parser, date_gen_parser, - a_ref), + a_ref), m_time_duration_format(default_time_duration_format) {} //! sets default formats for ptime, local_date_time, and time_duration - explicit time_input_facet(::size_t a_ref = 0) - : base_type(default_time_input_format, a_ref), + explicit time_input_facet(::size_t a_ref = 0) + : base_type(default_time_input_format, a_ref), m_time_duration_format(default_time_duration_format) { } - + //! Set the format for time_duration void time_duration_format(const char_type* const format) { m_time_duration_format = format; @@ -729,47 +730,47 @@ namespace date_time { { this->m_format = iso_time_format_extended_specifier; } - + InItrT get(InItrT& sitr, InItrT& stream_end, std::ios_base& a_ios, period_type& p) const { - p = this->m_period_parser.get_period(sitr, - stream_end, - a_ios, - p, - time_duration_type::unit(), + p = this->m_period_parser.get_period(sitr, + stream_end, + a_ios, + p, + time_duration_type::unit(), *this); return sitr; } - + //default ptime format is YYYY-Mon-DD HH:MM:SS[.fff...][ zzz] //default time_duration format is %H:%M:%S%F HH:MM:SS[.fff...] - InItrT get(InItrT& sitr, - InItrT& stream_end, - std::ios_base& a_ios, + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, time_duration_type& td) const { // skip leading whitespace while((sitr != stream_end) && std::isspace(*sitr)) { ++sitr; } - + bool use_current_char = false; - + // num_get will consume the +/-, we may need a copy if special_value char_type c = '\0'; if((sitr != stream_end) && (*sitr == '-' || *sitr == '+')) { c = *sitr; } - + typedef typename time_duration_type::hour_type hour_type; typedef typename time_duration_type::min_type min_type; typedef typename time_duration_type::sec_type sec_type; - hour_type hour = 0; - min_type min = 0; - sec_type sec = 0; + hour_type hour = 0; + min_type min = 0; + sec_type sec = 0; typename time_duration_type::fractional_seconds_type frac(0); typedef std::num_get<CharT, InItrT> num_get; @@ -778,25 +779,25 @@ namespace date_time { std::locale loc = std::locale(a_ios.getloc(), ng); a_ios.imbue(loc); } - + const_itr itr(m_time_duration_format.begin()); while (itr != m_time_duration_format.end() && (sitr != stream_end)) { if (*itr == '%') { ++itr; if (*itr != '%') { switch(*itr) { - case 'O': + case 'O': { // A period may span more than 24 hours. In that case the format // string should be composed with the unrestricted hours specifier. - hour = var_string_to_int<hour_type, CharT>(sitr, stream_end, + hour = var_string_to_int<hour_type, CharT>(sitr, stream_end, std::numeric_limits<hour_type>::digits10 + 1); if(hour == -1){ return check_special_value(sitr, stream_end, td, c); } break; } - case 'H': + case 'H': { match_results mr; hour = fixed_string_to_int<hour_type, CharT>(sitr, stream_end, mr, 2); @@ -805,7 +806,7 @@ namespace date_time { } break; } - case 'M': + case 'M': { match_results mr; min = fixed_string_to_int<min_type, CharT>(sitr, stream_end, mr, 2); @@ -815,7 +816,7 @@ namespace date_time { break; } case 's': - case 'S': + case 'S': { match_results mr; sec = fixed_string_to_int<sec_type, CharT>(sitr, stream_end, mr, 2); @@ -832,7 +833,7 @@ namespace date_time { if(*sitr == '.') { ++sitr; parse_frac_type(sitr, stream_end, frac); - // sitr will point to next expected char after this parsing + // sitr will point to next expected char after this parsing // is complete so no need to advance it use_current_char = true; } @@ -841,13 +842,13 @@ namespace date_time { } break; } - case 'F': + case 'F': { // check for decimal, skip if missing if(*sitr == '.') { ++sitr; parse_frac_type(sitr, stream_end, frac); - // sitr will point to next expected char after this parsing + // sitr will point to next expected char after this parsing // is complete so no need to advance it use_current_char = true; } @@ -864,12 +865,12 @@ namespace date_time { else { // itr == '%', second consecutive ++sitr; } - + ++itr; //advance past format specifier } else { //skip past chars in format and in buffer ++itr; - // set use_current_char when sitr is already + // set use_current_char when sitr is already // pointing at the next character to process if (use_current_char) { use_current_char = false; @@ -883,21 +884,21 @@ namespace date_time { td = time_duration_type(hour, min, sec, frac); return sitr; } - + //! Parses a time object from the input stream - InItrT get(InItrT& sitr, - InItrT& stream_end, - std::ios_base& a_ios, + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, time_type& t) const { string_type tz_str; return get(sitr, stream_end, a_ios, t, tz_str, false); } //! Expects a time_zone in the input stream - InItrT get_local_time(InItrT& sitr, - InItrT& stream_end, - std::ios_base& a_ios, + InItrT get_local_time(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, time_type& t, string_type& tz_str) const { @@ -906,19 +907,19 @@ namespace date_time { protected: - InItrT get(InItrT& sitr, - InItrT& stream_end, - std::ios_base& a_ios, + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, time_type& t, string_type& tz_str, bool time_is_local) const { // skip leading whitespace while((sitr != stream_end) && std::isspace(*sitr)) { ++sitr; } - + bool use_current_char = false; bool use_current_format_char = false; // used whith two character flags - + // num_get will consume the +/-, we may need a copy if special_value char_type c = '\0'; if((sitr != stream_end) && (*sitr == '-' || *sitr == '+')) { @@ -930,27 +931,27 @@ namespace date_time { typedef typename time_duration_type::sec_type sec_type; // time elements - hour_type hour = 0; - min_type min = 0; - sec_type sec = 0; + hour_type hour = 0; + min_type min = 0; + sec_type sec = 0; typename time_duration_type::fractional_seconds_type frac(0); // date elements short day_of_year(0); - /* Initialized the following to their minimum values. These intermediate - * objects are used so we get specific exceptions when part of the input - * is unparsable. + /* Initialized the following to their minimum values. These intermediate + * objects are used so we get specific exceptions when part of the input + * is unparsable. * Ex: "205-Jan-15" will throw a bad_year, "2005-Jsn-15"- bad_month, etc.*/ year_type t_year(1400); month_type t_month(1); day_type t_day(1); - + typedef std::num_get<CharT, InItrT> num_get; if(!std::has_facet<num_get>(a_ios.getloc())) { num_get* ng = new num_get(); std::locale loc = std::locale(a_ios.getloc(), ng); a_ios.imbue(loc); } - + const_itr itr(this->m_format.begin()); while (itr != this->m_format.end() && (sitr != stream_end)) { if (*itr == '%') { @@ -1065,7 +1066,7 @@ namespace date_time { break; } // time flags - case 'H': + case 'H': { match_results mr; hour = fixed_string_to_int<hour_type, CharT>(sitr, stream_end, mr, 2); @@ -1074,7 +1075,7 @@ namespace date_time { } break; } - case 'M': + case 'M': { match_results mr; min = fixed_string_to_int<min_type, CharT>(sitr, stream_end, mr, 2); @@ -1084,7 +1085,7 @@ namespace date_time { break; } case 's': - case 'S': + case 'S': { match_results mr; sec = fixed_string_to_int<sec_type, CharT>(sitr, stream_end, mr, 2); @@ -1101,7 +1102,7 @@ namespace date_time { if(*sitr == '.') { ++sitr; parse_frac_type(sitr, stream_end, frac); - // sitr will point to next expected char after this parsing + // sitr will point to next expected char after this parsing // is complete so no need to advance it use_current_char = true; } @@ -1110,13 +1111,13 @@ namespace date_time { } break; } - case 'F': + case 'F': { // check for decimal, skip if missing if(*sitr == '.') { ++sitr; parse_frac_type(sitr, stream_end, frac); - // sitr will point to next expected char after this parsing + // sitr will point to next expected char after this parsing // is complete so no need to advance it use_current_char = true; } @@ -1146,34 +1147,34 @@ namespace date_time { else { use_current_format_char = true; } - + } else { // nothing was parsed so we don't want to advance sitr use_current_char = true; } - + break; } default: {} // ignore what we don't understand? }// switch - } + } else { // itr == '%', second consecutive ++sitr; } - + if(use_current_format_char) { use_current_format_char = false; } else { ++itr; //advance past format specifier } - + } else { //skip past chars in format and in buffer ++itr; - // set use_current_char when sitr is already + // set use_current_char when sitr is already // pointing at the next character to process if (use_current_char) { use_current_char = false; @@ -1183,7 +1184,7 @@ namespace date_time { } } } - + date_type d(not_a_date_time); if (day_of_year > 0) { d = date_type(static_cast<unsigned short>(t_year-1),12,31) + date_duration_type(day_of_year); @@ -1198,8 +1199,8 @@ namespace date_time { } //! Helper function to check for special_value - /*! First character may have been consumed during original parse - * attempt. Parameter 'c' should be a copy of that character. + /*! First character may have been consumed during original parse + * attempt. Parameter 'c' should be a copy of that character. * Throws ios_base::failure if parse fails. */ template<class temporal_type> inline @@ -1215,13 +1216,13 @@ namespace date_time { boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + tmp + "'")); BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return sitr); // should never reach } - tt = temporal_type(static_cast<special_values>(mr.current_match)); + tt = temporal_type(static_cast<special_values>(mr.current_match)); return sitr; } //! Helper function for parsing a fractional second type from the stream - void parse_frac_type(InItrT& sitr, - InItrT& stream_end, + void parse_frac_type(InItrT& sitr, + InItrT& stream_end, fracional_seconds_type& frac) const { string_type cache; @@ -1242,7 +1243,7 @@ namespace date_time { } } } - + private: string_type m_time_duration_format; @@ -1263,60 +1264,60 @@ namespace date_time { template <class time_type, class CharT, class InItrT> std::locale::id time_input_facet<time_type, CharT, InItrT>::id; -template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* +template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::fractional_seconds_format = time_formats<CharT>::fractional_seconds_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::fractional_seconds_or_none_format = time_formats<CharT>::fractional_seconds_or_none_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::seconds_with_fractional_seconds_format = time_formats<CharT>::seconds_with_fractional_seconds_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::seconds_format = time_formats<CharT>::seconds_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::standard_format = time_formats<CharT>::standard_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::zone_abbrev_format = time_formats<CharT>::zone_abbrev_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::zone_name_format = time_formats<CharT>::zone_name_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::zone_iso_format = time_formats<CharT>::zone_iso_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::zone_iso_extended_format = time_formats<CharT>::zone_iso_extended_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::duration_seperator = time_formats<CharT>::duration_seperator; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::iso_time_format_specifier = time_formats<CharT>::iso_time_format_specifier; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::iso_time_format_extended_specifier = time_formats<CharT>::iso_time_format_extended_specifier; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::default_time_input_format = time_formats<CharT>::default_time_input_format; - template <class time_type, class CharT, class InItrT> - const typename time_input_facet<time_type, CharT, InItrT>::char_type* + template <class time_type, class CharT, class InItrT> + const typename time_input_facet<time_type, CharT, InItrT>::char_type* time_input_facet<time_type, CharT, InItrT>::default_time_duration_format = time_formats<CharT>::default_time_duration_format; diff --git a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp index 1487911..658f3d2 100644 --- a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp @@ -2,26 +2,27 @@ #define DATE_TIME_TIME_RESOLUTION_TRAITS_HPP /* Copyright (c) 2002,2003 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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $ */ -#include "boost/date_time/time_defs.hpp" -#include "boost/date_time/int_adapter.hpp" -#include "boost/cstdint.hpp" +#include <boost/cstdint.hpp> +#include <boost/date_time/time_defs.hpp> +#include <boost/date_time/int_adapter.hpp> +#include <boost/date_time/compiler_config.hpp> namespace boost { namespace date_time { //! Simple function to calculate absolute value of a numeric type - template <typename T> - // JDG [7/6/02 made a template], + template <typename T> + // JDG [7/6/02 made a template], // moved here from time_duration.hpp 2003-Sept-4. - inline T absolute_value(T x) + inline T absolute_value(T x) { return x < 0 ? -x : x; } @@ -58,16 +59,16 @@ namespace date_time { //! Used to determine if implemented type is int_adapter or int static bool is_adapted() { return true;} }; - - template<typename frac_sec_type, + + template<typename frac_sec_type, time_resolutions res, #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t resolution_adjust, + boost::int64_t resolution_adjust, #else - typename frac_sec_type::int_type resolution_adjust, + typename frac_sec_type::int_type resolution_adjust, #endif - unsigned short frac_digits, - typename v_type = boost::int32_t > + unsigned short frac_digits, + typename v_type = boost::int32_t > class time_resolution_traits { public: typedef typename frac_sec_type::int_type fractional_seconds_type; @@ -77,9 +78,9 @@ namespace date_time { typedef v_type hour_type; typedef v_type min_type; typedef v_type sec_type; - + // bring in function from frac_sec_type traits structs - static typename frac_sec_type::int_type as_number(typename frac_sec_type::impl_type i) + static fractional_seconds_type as_number(impl_type i) { return frac_sec_type::as_number(i); } @@ -87,11 +88,14 @@ namespace date_time { { return frac_sec_type::is_adapted(); } - + //Would like this to be frac_sec_type, but some compilers complain - BOOST_STATIC_CONSTANT(int, ticks_per_second = resolution_adjust); - // static const boost::int32_t ticks_per_second = resolution_adjust; - +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + BOOST_STATIC_CONSTANT(boost::int64_t, ticks_per_second = resolution_adjust); +#else + BOOST_STATIC_CONSTANT(fractional_seconds_type, ticks_per_second = resolution_adjust); +#endif + static time_resolutions resolution() { return res; @@ -116,16 +120,16 @@ namespace date_time { minutes = absolute_value(minutes); seconds = absolute_value(seconds); fs = absolute_value(fs); - return (((((fractional_seconds_type(hours)*3600) - + (fractional_seconds_type(minutes)*60) + return (((((fractional_seconds_type(hours)*3600) + + (fractional_seconds_type(minutes)*60) + seconds)*res_adjust()) + fs) * -1); } - return (((fractional_seconds_type(hours)*3600) - + (fractional_seconds_type(minutes)*60) + return (((fractional_seconds_type(hours)*3600) + + (fractional_seconds_type(minutes)*60) + seconds)*res_adjust()) + fs; } - + }; typedef time_resolution_traits<time_resolution_traits_adapted32_impl, milli, 1000, 3 > milli_res; |