summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-01 08:48:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-01 09:24:28 (GMT)
commit2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch)
treed46294f35150c4f0f43deaf2d31fceaf945ae715 /3rdParty/Boost/libs/date_time/src
downloadswift-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip
swift-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2
Import.
Diffstat (limited to '3rdParty/Boost/libs/date_time/src')
-rw-r--r--3rdParty/Boost/libs/date_time/src/gregorian/date_generators.cpp38
-rw-r--r--3rdParty/Boost/libs/date_time/src/gregorian/greg_month.cpp173
-rw-r--r--3rdParty/Boost/libs/date_time/src/gregorian/greg_names.hpp43
-rw-r--r--3rdParty/Boost/libs/date_time/src/gregorian/greg_weekday.cpp50
-rw-r--r--3rdParty/Boost/libs/date_time/src/gregorian/gregorian_types.cpp62
-rw-r--r--3rdParty/Boost/libs/date_time/src/posix_time/posix_time_types.cpp35
6 files changed, 401 insertions, 0 deletions
diff --git a/3rdParty/Boost/libs/date_time/src/gregorian/date_generators.cpp b/3rdParty/Boost/libs/date_time/src/gregorian/date_generators.cpp
new file mode 100644
index 0000000..bbef7f6
--- /dev/null
+++ b/3rdParty/Boost/libs/date_time/src/gregorian/date_generators.cpp
@@ -0,0 +1,38 @@
+/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
+ * 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) $
+ */
+
+
+
+#ifndef BOOST_DATE_TIME_SOURCE
+#define BOOST_DATE_TIME_SOURCE
+#endif
+#include "boost/date_time/date_generators.hpp"
+
+namespace boost {
+namespace date_time {
+
+ const char* const _nth_as_str[] = {"out of range", "first", "second",
+ "third", "fourth", "fifth"};
+
+ //! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5.
+ BOOST_DATE_TIME_DECL const char* nth_as_str(int ele)
+ {
+ if(ele >= 1 || ele <= 5) {
+ return _nth_as_str[ele];
+ }
+ else {
+ return _nth_as_str[0];
+ }
+ }
+
+} } //namespace date_time
+
+
+
+
+
diff --git a/3rdParty/Boost/libs/date_time/src/gregorian/greg_month.cpp b/3rdParty/Boost/libs/date_time/src/gregorian/greg_month.cpp
new file mode 100644
index 0000000..efca973
--- /dev/null
+++ b/3rdParty/Boost/libs/date_time/src/gregorian/greg_month.cpp
@@ -0,0 +1,173 @@
+/* Copyright (c) 2002-2005 CrystalClear Software, Inc.
+ * 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) $
+ */
+
+
+
+#ifndef BOOST_DATE_TIME_SOURCE
+#define BOOST_DATE_TIME_SOURCE
+#endif
+#include "boost/date_time/gregorian/greg_month.hpp"
+#include "boost/date_time/gregorian/greg_facet.hpp"
+#include "boost/date_time/date_format_simple.hpp"
+#include "boost/date_time/compiler_config.hpp"
+#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
+#include "boost/date_time/date_parsing.hpp"
+#include "boost/date_time/gregorian/parsers.hpp"
+
+#include "greg_names.hpp"
+namespace boost {
+namespace gregorian {
+
+ /*! Returns a shared pointer to a map of Month strings & numbers.
+ * Strings are both full names and abbreviations.
+ * Ex. ("jan",1), ("february",2), etc...
+ * Note: All characters are lowercase - for case insensitivity
+ */
+ greg_month::month_map_ptr_type greg_month::get_month_map_ptr()
+ {
+ static month_map_ptr_type month_map_ptr(new greg_month::month_map_type());
+
+ if(month_map_ptr->empty()) {
+ std::string s("");
+ for(unsigned short i = 1; i <= 12; ++i) {
+ greg_month m(static_cast<month_enum>(i));
+ s = m.as_long_string();
+ s = date_time::convert_to_lower(s);
+ month_map_ptr->insert(std::make_pair(s, i));
+ s = m.as_short_string();
+ s = date_time::convert_to_lower(s);
+ month_map_ptr->insert(std::make_pair(s, i));
+ }
+ }
+ return month_map_ptr;
+ }
+
+
+ //! Returns 3 char english string for the month ex: Jan, Feb, Mar, Apr
+ const char*
+ greg_month::as_short_string() const
+ {
+ return short_month_names[value_-1];
+ }
+
+ //! Returns full name of month as string in english ex: January, February
+ const char*
+ greg_month::as_long_string() const
+ {
+ return long_month_names[value_-1];
+ }
+
+ //! Return special_value from string argument
+ /*! Return special_value from string argument. If argument is
+ * not one of the special value names (defined in names.hpp),
+ * return 'not_special' */
+ special_values special_value_from_string(const std::string& s) {
+ short i = date_time::find_match(special_value_names,
+ special_value_names,
+ date_time::NumSpecialValues,
+ s);
+ if(i >= date_time::NumSpecialValues) { // match not found
+ return not_special;
+ }
+ else {
+ return static_cast<special_values>(i);
+ }
+ }
+
+
+#ifndef BOOST_NO_STD_WSTRING
+ //! Returns 3 wchar_t english string for the month ex: Jan, Feb, Mar, Apr
+ const wchar_t*
+ greg_month::as_short_wstring() const
+ {
+ return w_short_month_names[value_-1];
+ }
+
+ //! Returns full name of month as wchar_t string in english ex: January, February
+ const wchar_t*
+ greg_month::as_long_wstring() const
+ {
+ return w_long_month_names[value_-1];
+ }
+#endif // BOOST_NO_STD_WSTRING
+
+#ifndef BOOST_DATE_TIME_NO_LOCALE
+ /*! creates an all_date_names_put object with the correct set of names.
+ * This function is only called in the event of an exception where
+ * the imbued locale containing the needed facet is for some reason
+ * unreachable.
+ */
+ BOOST_DATE_TIME_DECL
+ boost::date_time::all_date_names_put<greg_facet_config, char>*
+ create_facet_def(char type)
+ {
+ typedef
+ boost::date_time::all_date_names_put<greg_facet_config, char> facet_def;
+
+ return new facet_def(short_month_names,
+ long_month_names,
+ special_value_names,
+ short_weekday_names,
+ long_weekday_names);
+ }
+
+ //! generates a locale with the set of gregorian name-strings of type char*
+ BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, char type){
+ typedef boost::date_time::all_date_names_put<greg_facet_config, char> facet_def;
+ return std::locale(loc, new facet_def(short_month_names,
+ long_month_names,
+ special_value_names,
+ short_weekday_names,
+ long_weekday_names)
+ );
+ }
+
+#ifndef BOOST_NO_STD_WSTRING
+ /*! creates an all_date_names_put object with the correct set of names.
+ * This function is only called in the event of an exception where
+ * the imbued locale containing the needed facet is for some reason
+ * unreachable.
+ */
+ BOOST_DATE_TIME_DECL
+ boost::date_time::all_date_names_put<greg_facet_config, wchar_t>*
+ create_facet_def(wchar_t type)
+ {
+ typedef
+ boost::date_time::all_date_names_put<greg_facet_config,wchar_t> facet_def;
+
+ return new facet_def(w_short_month_names,
+ w_long_month_names,
+ w_special_value_names,
+ w_short_weekday_names,
+ w_long_weekday_names);
+ }
+
+ //! generates a locale with the set of gregorian name-strings of type wchar_t*
+ BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, wchar_t type){
+ typedef boost::date_time::all_date_names_put<greg_facet_config, wchar_t> facet_def;
+ return std::locale(loc, new facet_def(w_short_month_names,
+ w_long_month_names,
+ w_special_value_names,
+ w_short_weekday_names,
+ w_long_weekday_names)
+ );
+ }
+#endif // BOOST_NO_STD_WSTRING
+#endif // BOOST_DATE_TIME_NO_LOCALE
+
+} } //namespace gregorian
+
+
+
+
+
+
diff --git a/3rdParty/Boost/libs/date_time/src/gregorian/greg_names.hpp b/3rdParty/Boost/libs/date_time/src/gregorian/greg_names.hpp
new file mode 100644
index 0000000..76a1a24
--- /dev/null
+++ b/3rdParty/Boost/libs/date_time/src/gregorian/greg_names.hpp
@@ -0,0 +1,43 @@
+/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
+ * 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) $
+ */
+
+
+
+#ifndef DATE_TIME_SRC_GREG_NAMES_HPP___
+#define DATE_TIME_SRC_GREG_NAMES_HPP___
+
+#include "boost/date_time/gregorian/greg_month.hpp"
+#include "boost/date_time/special_defs.hpp"
+namespace boost {
+namespace gregorian {
+
+
+ const char* const short_month_names[NumMonths]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec", "NAM"};
+ const char* const long_month_names[NumMonths]={"January","February","March","April","May","June","July","August","September","October","November","December","NotAMonth"};
+ const char* const special_value_names[date_time::NumSpecialValues]={"not-a-date-time","-infinity","+infinity","min_date_time","max_date_time","not_special"};
+
+
+ const char* const short_weekday_names[]={"Sun", "Mon", "Tue",
+ "Wed", "Thu", "Fri", "Sat"};
+ const char* const long_weekday_names[]= {"Sunday","Monday","Tuesday",
+ "Wednesday", "Thursday",
+ "Friday", "Saturday"};
+
+#ifndef BOOST_NO_STD_WSTRING
+ const wchar_t* const w_short_month_names[NumMonths]={L"Jan",L"Feb",L"Mar",L"Apr",L"May",L"Jun",L"Jul",L"Aug",L"Sep",L"Oct",L"Nov",L"Dec",L"NAM"};
+ const wchar_t* const w_long_month_names[NumMonths]={L"January",L"February",L"March",L"April",L"May",L"June",L"July",L"August",L"September",L"October",L"November",L"December",L"NotAMonth"};
+ const wchar_t* const w_special_value_names[date_time::NumSpecialValues]={L"not-a-date-time",L"-infinity",L"+infinity",L"min_date_time",L"max_date_time",L"not_special"};
+
+ const wchar_t* const w_short_weekday_names[]={L"Sun", L"Mon", L"Tue",
+ L"Wed", L"Thu", L"Fri", L"Sat"};
+ const wchar_t* const w_long_weekday_names[]= {L"Sunday",L"Monday",L"Tuesday",
+ L"Wednesday", L"Thursday",
+ L"Friday", L"Saturday"};
+#endif // BOOST_NO_STD_WSTRING
+} } // boost::gregorian
+#endif // DATE_TIME_SRC_GREG_NAMES_HPP___
diff --git a/3rdParty/Boost/libs/date_time/src/gregorian/greg_weekday.cpp b/3rdParty/Boost/libs/date_time/src/gregorian/greg_weekday.cpp
new file mode 100644
index 0000000..4057d29
--- /dev/null
+++ b/3rdParty/Boost/libs/date_time/src/gregorian/greg_weekday.cpp
@@ -0,0 +1,50 @@
+/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
+ * 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) $
+ */
+
+
+
+#ifndef BOOST_DATE_TIME_SOURCE
+#define BOOST_DATE_TIME_SOURCE
+#endif
+#include "boost/date_time/gregorian/greg_weekday.hpp"
+
+#include "greg_names.hpp"
+
+namespace boost {
+namespace gregorian {
+
+ //! Return a 3 digit english string of the day of week (eg: Sun)
+ const char*
+ greg_weekday::as_short_string() const
+ {
+ return short_weekday_names[value_];
+ }
+ //! Return a point to a long english string representing day of week
+ const char*
+ greg_weekday::as_long_string() const
+ {
+ return long_weekday_names[value_];
+ }
+
+#ifndef BOOST_NO_STD_WSTRING
+ //! Return a 3 digit english wchar_t string of the day of week (eg: Sun)
+ const wchar_t*
+ greg_weekday::as_short_wstring() const
+ {
+ return w_short_weekday_names[value_];
+ }
+ //! Return a point to a long english wchar_t string representing day of week
+ const wchar_t*
+ greg_weekday::as_long_wstring() const
+ {
+ return w_long_weekday_names[value_];
+ }
+#endif // BOOST_NO_STD_WSTRING
+
+} } //namespace gregorian
+
diff --git a/3rdParty/Boost/libs/date_time/src/gregorian/gregorian_types.cpp b/3rdParty/Boost/libs/date_time/src/gregorian/gregorian_types.cpp
new file mode 100644
index 0000000..a856e79
--- /dev/null
+++ b/3rdParty/Boost/libs/date_time/src/gregorian/gregorian_types.cpp
@@ -0,0 +1,62 @@
+/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
+ * 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) $
+ */
+
+
+/** @defgroup date_basics Date Basics
+ This page summarizes some of the key user types and functions needed
+ to write programs using the gregorian date system. This is not a
+ comprehensive list, but rather some key types to start exploring.
+
+
+**/
+
+/** @defgroup date_alg Date Algorithms / Generators
+ Date algorithms or generators are tools for generating other dates or
+ schedules of dates. A generator function starts with some part of a
+ date such as a month and day and is supplied another part to then
+ generate a final date.
+
+**/
+
+/** @defgroup date_format Date Formatting
+ The functions on these page are some of the key formatting functions
+ for dates.
+**/
+
+
+//File doesn't have a current purpose except to generate docs
+//and keep it changeable without recompiles
+/*! @example days_alive.cpp
+ Calculate the number of days you have been living using durations and dates.
+*/
+/*! @example days_till_new_year.cpp
+ Calculate the number of days till new years
+*/
+/*! @example print_month.cpp
+ Simple utility to print out days of the month with the days of a month. Demontstrates date iteration (date_time::date_itr).
+*/
+/*! @example localization.cpp
+ An example showing localized stream-based I/O.
+*/
+/*! @example dates_as_strings.cpp
+ Various parsing and output of strings (mostly supported for
+ compilers that do not support localized streams).
+*/
+/*! @example period_calc.cpp
+ Calculates if a date is in an 'irregular' collection of periods using
+ period calculation functions.
+*/
+/*! @example print_holidays.cpp
+ This is an example of using functors to define a holiday schedule
+ */
+/*! @example localization.cpp
+ Demonstrates the use of facets to localize date output for Gregorian dates.
+ */
+
+
+
diff --git a/3rdParty/Boost/libs/date_time/src/posix_time/posix_time_types.cpp b/3rdParty/Boost/libs/date_time/src/posix_time/posix_time_types.cpp
new file mode 100644
index 0000000..06ef563
--- /dev/null
+++ b/3rdParty/Boost/libs/date_time/src/posix_time/posix_time_types.cpp
@@ -0,0 +1,35 @@
+
+/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
+ * 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) $
+ */
+
+
+//File doesn't have a current purpose except to generate docs
+//and keep it changeable without recompiles
+
+/** @defgroup time_basics Time Basics
+
+**/
+
+/** @defgroup time_format Time Formatting
+
+**/
+
+
+
+/*! @example local_utc_conversion.cpp
+ Demonstrate utc to local and local to utc calculations including dst.
+*/
+/*! @example time_periods.cpp Demonstrate some simple uses of time periods.
+*/
+/*! @example print_hours.cpp Demonstrate time iteration, clock retrieval, and simple calculation.
+ */
+/*! @example time_math.cpp Various types of calculations with times and time durations.
+ */
+
+
+