summaryrefslogtreecommitdiff
path: root/boost/date_time/gregorian
diff options
context:
space:
mode:
Diffstat (limited to 'boost/date_time/gregorian')
-rw-r--r--boost/date_time/gregorian/greg_facet.hpp10
-rw-r--r--boost/date_time/gregorian/greg_year.hpp8
-rw-r--r--boost/date_time/gregorian/gregorian_io.hpp104
3 files changed, 62 insertions, 60 deletions
diff --git a/boost/date_time/gregorian/greg_facet.hpp b/boost/date_time/gregorian/greg_facet.hpp
index f720aac3bf..5352df1398 100644
--- a/boost/date_time/gregorian/greg_facet.hpp
+++ b/boost/date_time/gregorian/greg_facet.hpp
@@ -13,6 +13,7 @@
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/date_formatting_locales.hpp> // sets BOOST_DATE_TIME_NO_LOCALE
#include <boost/date_time/gregorian/parsers.hpp>
+#include <boost/io/ios_state.hpp>
//This file is basically commented out if locales are not supported
#ifndef BOOST_DATE_TIME_NO_LOCALE
@@ -75,9 +76,9 @@ namespace gregorian {
greg_month_formatter::format_month(m, os, f);
}
- else { //default to numeric
- charT fill_char = '0';
- os << std::setw(2) << std::setfill(fill_char) << m.as_number();
+ else { // default to numeric
+ boost::io::basic_ios_fill_saver<charT> ifs(os);
+ os << std::setw(2) << std::setfill(os.widen('0')) << m.as_number();
}
return os;
@@ -142,7 +143,8 @@ namespace gregorian {
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const partial_date& pd)
{
- os << std::setw(2) << std::setfill('0') << pd.day() << ' '
+ boost::io::basic_ios_fill_saver<charT> ifs(os);
+ os << std::setw(2) << std::setfill(os.widen('0')) << pd.day() << ' '
<< pd.month().as_short_string() ;
return os;
}
diff --git a/boost/date_time/gregorian/greg_year.hpp b/boost/date_time/gregorian/greg_year.hpp
index 3245518474..a278bdaa03 100644
--- a/boost/date_time/gregorian/greg_year.hpp
+++ b/boost/date_time/gregorian/greg_year.hpp
@@ -21,19 +21,19 @@ namespace gregorian {
struct BOOST_SYMBOL_VISIBLE bad_year : public std::out_of_range
{
bad_year() :
- std::out_of_range(std::string("Year is out of valid range: 1400..10000"))
+ std::out_of_range(std::string("Year is out of valid range: 1400..9999"))
{}
};
//! Policy class that declares error handling gregorian year type
- typedef CV::simple_exception_policy<unsigned short, 1400, 10000, bad_year> greg_year_policies;
+ typedef CV::simple_exception_policy<unsigned short, 1400, 9999, bad_year> greg_year_policies;
//! Generated representation for gregorian year
typedef CV::constrained_value<greg_year_policies> greg_year_rep;
- //! Represent a year (range 1400 - 10000)
+ //! Represent a year (range 1400 - 9999)
/*! This small class allows for simple conversion an integer value into
a year for the gregorian calendar. This currently only allows a
- range of 1400 to 10000. Both ends of the range are a bit arbitrary
+ range of 1400 to 9999. Both ends of the range are a bit arbitrary
at the moment, but they are the limits of current testing of the
library. As such they may be increased in the future.
*/
diff --git a/boost/date_time/gregorian/gregorian_io.hpp b/boost/date_time/gregorian/gregorian_io.hpp
index e0a23f3269..49e5d41ed8 100644
--- a/boost/date_time/gregorian/gregorian_io.hpp
+++ b/boost/date_time/gregorian/gregorian_io.hpp
@@ -77,14 +77,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, d);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, d);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, d);
@@ -138,14 +138,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, dd);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, dd);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, dd);
@@ -202,14 +202,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, dp);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, dp);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, dp);
@@ -261,14 +261,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, m);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, m);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, m);
@@ -318,14 +318,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, wd);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, wd);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, wd);
@@ -359,14 +359,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, gd);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, gd);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, gd);
@@ -400,14 +400,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, gy);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, gy);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, gy);
@@ -458,14 +458,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, pd);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, pd);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, pd);
@@ -515,14 +515,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, nday);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, nday);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, nday);
@@ -573,14 +573,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fkd);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fkd);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fkd);
@@ -631,14 +631,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, lkd);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, lkd);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, lkd);
@@ -690,14 +690,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fka);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fka);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fka);
@@ -749,14 +749,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
- typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
+ typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
- if(std::has_facet<date_input_facet>(is.getloc())) {
- std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fkb);
+ if(std::has_facet<date_input_facet_local>(is.getloc())) {
+ std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fkb);
}
else {
- date_input_facet* f = new date_input_facet();
+ date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fkb);