From be2b60a3ee7e4b2bcdc9280fc327878c87151d60 Mon Sep 17 00:00:00 2001 From: Jeff Garland Date: Fri, 19 Dec 2003 14:20:30 +0000 Subject: [PATCH] enable facet-based I/O for borland 554 [SVN r21340] --- .../date_time/date_formatting_locales.hpp | 62 +++++++++---------- include/boost/date_time/locale_config.hpp | 8 +-- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/boost/date_time/date_formatting_locales.hpp b/include/boost/date_time/date_formatting_locales.hpp index a86bb12..9902c92 100644 --- a/include/boost/date_time/date_formatting_locales.hpp +++ b/include/boost/date_time/date_formatting_locales.hpp @@ -2,10 +2,10 @@ #define DATE_TIME_DATE_FORMATTING_LOCALES_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 or http://www.boost.org/LICENSE-1.0) - * Author: Jeff Garland + * Author: Jeff Garland * $Date$ */ @@ -40,33 +40,33 @@ namespace date_time { const facet_type& f) { - switch (f.month_format()) + switch (f.month_format()) { - case month_as_short_string: - { + case month_as_short_string: + { std::ostreambuf_iterator oitr(os); f.put_month_short(oitr, month.as_enum()); break; } - case month_as_long_string: - { + case month_as_long_string: + { std::ostreambuf_iterator oitr(os); f.put_month_long(oitr, month.as_enum()); break; } - case month_as_integer: - { + case month_as_integer: + { os << std::setw(2) << std::setfill('0') << month.as_number(); break; } - + } } // format_month }; - //! Formats a weekday + //! Formats a weekday template @@ -90,7 +90,7 @@ namespace date_time { else { f.put_weekday_short(oitr, wd.as_enum()); } - + } // format_weekday }; @@ -104,19 +104,19 @@ namespace date_time { { public: typedef typename ymd_type::month_type month_type; - typedef ostream_month_formatter month_formatter; + typedef ostream_month_formatter month_formatter_type; typedef std::basic_ostream ostream_type; typedef std::basic_string foo_type; //! Convert ymd to a standard string formatting policies /*! This is standard code for handling date formatting with - * year-month-day based date information. This function + * year-month-day based date information. This function * uses the format_type to control whether the string will * contain separator characters, and if so what the character * will be. In addtion, it can format the month as either - * an integer or a string as controled by the formatting + * an integer or a string as controled by the formatting * policy - */ + */ // static string_type ymd_to_string(ymd_type ymd) // { // std::ostringstream ss; @@ -127,7 +127,7 @@ namespace date_time { // Put ymd to ostream -- part of ostream refactor - static void ymd_put(ymd_type ymd, + static void ymd_put(ymd_type ymd, ostream_type& os, const facet_type& f) { @@ -138,20 +138,20 @@ namespace date_time { if (f.has_date_sep_chars()) { f.month_sep_char(oitr); } - month_formatter::format_month(ymd.month, os, f); + month_formatter_type::format_month(ymd.month, os, f); if (f.has_date_sep_chars()) { f.day_sep_char(oitr); } - os << std::setw(2) << std::setfill('0') + os << std::setw(2) << std::setfill('0') << ymd.day; break; } case ymd_order_us: { - month_formatter::format_month(ymd.month, os, f); + month_formatter_type::format_month(ymd.month, os, f); if (f.has_date_sep_chars()) { f.day_sep_char(oitr); } - os << std::setw(2) << std::setfill('0') + os << std::setw(2) << std::setfill('0') << ymd.day; if (f.has_date_sep_chars()) { f.month_sep_char(oitr); @@ -160,12 +160,12 @@ namespace date_time { break; } case ymd_order_dmy: { - os << std::setw(2) << std::setfill('0') + os << std::setw(2) << std::setfill('0') << ymd.day; if (f.has_date_sep_chars()) { f.day_sep_char(oitr); } - month_formatter::format_month(ymd.month, os, f); + month_formatter_type::format_month(ymd.month, os, f); if (f.has_date_sep_chars()) { f.month_sep_char(oitr); } @@ -187,8 +187,8 @@ namespace date_time { typedef std::basic_ostream ostream_type; typedef typename date_type::ymd_type ymd_type; - //! Put date into an ostream - static void date_put(const date_type& d, + //! Put date into an ostream + static void date_put(const date_type& d, ostream_type& os, const facet_type& f) { @@ -201,11 +201,11 @@ namespace date_time { std::ostreambuf_iterator coi(os); f.put_special_value(coi, sv); } - } - + } - //! Put date into an ostream - static void date_put(const date_type& d, + + //! Put date into an ostream + static void date_put(const date_type& d, ostream_type& os) { //retrieve the local from the ostream @@ -219,10 +219,10 @@ namespace date_time { facet_type default_facet; date_put(d, os, default_facet); } - } // date_to_ostream + } // date_to_ostream }; //class date_formatter - + } } //namespace date_time #endif diff --git a/include/boost/date_time/locale_config.hpp b/include/boost/date_time/locale_config.hpp index 87ee981..79c443d 100644 --- a/include/boost/date_time/locale_config.hpp +++ b/include/boost/date_time/locale_config.hpp @@ -2,10 +2,10 @@ #define DATE_TIME_LOCALE_CONFIG_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 or http://www.boost.org/LICENSE-1.0) - * Author: Jeff Garland + * Author: Jeff Garland * $Date$ */ @@ -13,13 +13,13 @@ // iostream based i/o. Even if a compiler has some support for locales, // any failure to be compatible gets the compiler on the exclusion list. // -// At the moment this is defined for MSVC 6 and any compiler that +// At the moment this is defined for MSVC 6 and any compiler that // defines BOOST_NO_STD_LOCALE (gcc 2.95.x) #include "boost/config.hpp" //sets BOOST_NO_STD_LOCALE //This file basically becomes a noop if locales are not properly supported -#if (defined(BOOST_NO_STD_LOCALE) || (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) || (defined(__BORLANDC__))) +#if (defined(BOOST_NO_STD_LOCALE) || (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) || (defined(__BORLANDC__) && (__BORLANDC__ < 0x564 ))) #define BOOST_DATE_TIME_NO_LOCALE #endif