summaryrefslogtreecommitdiff
path: root/src/times.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-11 16:03:50 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-11 17:02:25 -0400
commitdea2aed0b509734ec4e1cd163ac2a4f013000da2 (patch)
tree7908da76c67ae5172882306a319bf26df81b73b4 /src/times.cc
parentd580079df892c30d023b3211d6c4611c17b11f8f (diff)
downloadfork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.tar.gz
fork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.tar.bz2
fork-ledger-dea2aed0b509734ec4e1cd163ac2a4f013000da2.zip
Untabified all source files
Diffstat (limited to 'src/times.cc')
-rw-r--r--src/times.cc884
1 files changed, 442 insertions, 442 deletions
diff --git a/src/times.cc b/src/times.cc
index 60e8e7cc..26e1dc21 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -60,17 +60,17 @@ namespace {
temporal_io_t(const char * _fmt_str, bool _input)
: fmt_str(_fmt_str),
- traits(icontains(fmt_str, "%y"),
- icontains(fmt_str, "%m") || icontains(fmt_str, "%b"),
- icontains(fmt_str, "%d")),
- input(_input) {
+ traits(icontains(fmt_str, "%y"),
+ icontains(fmt_str, "%m") || icontains(fmt_str, "%b"),
+ icontains(fmt_str, "%d")),
+ input(_input) {
#if defined(USE_BOOST_FACETS)
if (input) {
- input_facet = new InputFacetType(fmt_str);
- input_stream.imbue(std::locale(std::locale::classic(), input_facet));
+ input_facet = new InputFacetType(fmt_str);
+ input_stream.imbue(std::locale(std::locale::classic(), input_facet));
} else {
- output_facet = new OutputFacetType(fmt_str);
- output_stream.imbue(std::locale(std::locale::classic(), output_facet));
+ output_facet = new OutputFacetType(fmt_str);
+ output_stream.imbue(std::locale(std::locale::classic(), output_facet));
}
#endif // USE_BOOST_FACETS
}
@@ -78,14 +78,14 @@ namespace {
void set_format(const char * fmt) {
fmt_str = fmt;
traits = date_traits_t(icontains(fmt_str, "%y"),
- icontains(fmt_str, "%m") ||
- icontains(fmt_str, "%b"),
- icontains(fmt_str, "%d"));
+ icontains(fmt_str, "%m") ||
+ icontains(fmt_str, "%b"),
+ icontains(fmt_str, "%d"));
#if defined(USE_BOOST_FACETS)
if (input)
- input_facet->format(fmt_str);
+ input_facet->format(fmt_str);
else
- output_facet->format(fmt_str);
+ output_facet->format(fmt_str);
#endif // USE_BOOST_FACETS
}
@@ -110,7 +110,7 @@ namespace {
template <>
datetime_t temporal_io_t<datetime_t, posix_time::time_input_facet,
- posix_time::time_facet>
+ posix_time::time_facet>
::parse(const char * str)
{
#if defined(USE_BOOST_FACETS)
@@ -122,15 +122,15 @@ namespace {
input_stream >> when;
#if defined(DEBUG_ON)
if (when.is_not_a_date_time())
- DEBUG("times.parse", "Failed to parse date/time '" << str
- << "' using pattern '" << fmt_str << "'");
+ DEBUG("times.parse", "Failed to parse date/time '" << str
+ << "' using pattern '" << fmt_str << "'");
#endif
if (! when.is_not_a_date_time() &&
- input_stream.good() && ! input_stream.eof() &&
- input_stream.peek() != EOF) {
- DEBUG("times.parse", "This string has leftovers: '" << str << "'");
- return datetime_t();
+ input_stream.good() && ! input_stream.eof() &&
+ input_stream.peek() != EOF) {
+ DEBUG("times.parse", "This string has leftovers: '" << str << "'");
+ return datetime_t();
}
return when;
#else // USE_BOOST_FACETS
@@ -145,7 +145,7 @@ namespace {
template <>
date_t temporal_io_t<date_t, gregorian::date_input_facet,
- gregorian::date_facet>
+ gregorian::date_facet>
::parse(const char * str)
{
#if defined(USE_BOOST_FACETS)
@@ -157,21 +157,21 @@ namespace {
input_stream >> when;
#if defined(DEBUG_ON)
if (when.is_not_a_date())
- DEBUG("times.parse", "Failed to parse date '" << str
- << "' using pattern '" << fmt_str << "'");
+ DEBUG("times.parse", "Failed to parse date '" << str
+ << "' using pattern '" << fmt_str << "'");
#endif
if (! when.is_not_a_date() &&
- input_stream.good() && ! input_stream.eof() &&
- input_stream.peek() != EOF) {
- DEBUG("times.parse", "This string has leftovers: '" << str << "'");
- return date_t();
+ input_stream.good() && ! input_stream.eof() &&
+ input_stream.peek() != EOF) {
+ DEBUG("times.parse", "This string has leftovers: '" << str << "'");
+ return date_t();
}
return when;
#else // USE_BOOST_FACETS
std::tm data;
std::memset(&data, 0, sizeof(std::tm));
- data.tm_mday = 1; // some formats have no day
+ data.tm_mday = 1; // some formats have no day
if (strptime(str, fmt_str, &data))
return gregorian::date_from_tm(data);
else
@@ -180,9 +180,9 @@ namespace {
}
typedef temporal_io_t<datetime_t, posix_time::time_input_facet,
- posix_time::time_facet> datetime_io_t;
+ posix_time::time_facet> datetime_io_t;
typedef temporal_io_t<date_t, gregorian::date_input_facet,
- gregorian::date_facet> date_io_t;
+ gregorian::date_facet> date_io_t;
shared_ptr<datetime_io_t> input_datetime_io;
shared_ptr<date_io_t> input_date_io;
@@ -194,8 +194,8 @@ namespace {
std::vector<shared_ptr<date_io_t> > readers;
date_t parse_date_mask_routine(const char * date_str, date_io_t& io,
- optional_year year,
- date_traits_t * traits = NULL)
+ optional_year year,
+ date_traits_t * traits = NULL)
{
VERIFY(std::strlen(date_str) < 127);
@@ -204,7 +204,7 @@ namespace {
for (char * p = buf; *p; p++)
if (*p == '.' || *p == '-')
- *p = '/';
+ *p = '/';
date_t when = io.parse(buf);
@@ -219,41 +219,41 @@ namespace {
const char * p = when_str.c_str();
const char * q = buf;
for (; *p && *q; p++, q++) {
- if (*p != *q && *p == '0') p++;
- if (! *p || *p != *q) break;
+ if (*p != *q && *p == '0') p++;
+ if (! *p || *p != *q) break;
}
if (*p != '\0' || *q != '\0')
- throw_(date_error, _("Invalid date: %1") << date_str);
+ throw_(date_error, _("Invalid date: %1") << date_str);
if (traits)
- *traits = io.traits;
+ *traits = io.traits;
if (! io.traits.has_year) {
- when = date_t(year ? *year : CURRENT_DATE().year(),
- when.month(), when.day());
+ when = date_t(year ? *year : CURRENT_DATE().year(),
+ when.month(), when.day());
- if (! year && when.month() > CURRENT_DATE().month())
- when -= gregorian::years(1);
+ if (! year && when.month() > CURRENT_DATE().month())
+ when -= gregorian::years(1);
}
}
return when;
}
date_t parse_date_mask(const char * date_str, optional_year year,
- date_traits_t * traits = NULL)
+ date_traits_t * traits = NULL)
{
if (input_date_io.get()) {
date_t when = parse_date_mask_routine(date_str, *input_date_io.get(),
- year, traits);
+ year, traits);
if (! when.is_not_a_date())
- return when;
+ return when;
}
foreach (shared_ptr<date_io_t>& reader, readers) {
date_t when = parse_date_mask_routine(date_str, *reader.get(),
- year, traits);
+ year, traits);
if (! when.is_not_a_date())
- return when;
+ return when;
}
throw_(date_error, _("Invalid date: %1") << date_str);
@@ -344,8 +344,8 @@ date_t date_specifier_t::begin(const optional_year& current_year) const
// wday in that month; if the year is set, then in that year.
return gregorian::date(static_cast<date_t::year_type>(the_year),
- static_cast<date_t::month_type>(the_month),
- static_cast<date_t::day_type>(the_day));
+ static_cast<date_t::month_type>(the_month),
+ static_cast<date_t::day_type>(the_day));
}
date_t date_specifier_t::end(const optional_year& current_year) const
@@ -363,7 +363,7 @@ date_t date_specifier_t::end(const optional_year& current_year) const
}
std::ostream& operator<<(std::ostream& out,
- const date_duration_t& duration)
+ const date_duration_t& duration)
{
if (duration.quantum == date_duration_t::DAYS)
out << duration.length << " day(s)";
@@ -395,194 +395,194 @@ class date_parser_t
struct token_t
{
enum kind_t {
- UNKNOWN,
-
- TOK_DATE,
- TOK_INT,
- TOK_SLASH,
- TOK_DASH,
- TOK_DOT,
-
- TOK_A_YEAR,
- TOK_A_MONTH,
- TOK_A_WDAY,
-
- TOK_SINCE,
- TOK_UNTIL,
- TOK_IN,
- TOK_THIS,
- TOK_NEXT,
- TOK_LAST,
- TOK_EVERY,
-
- TOK_TODAY,
- TOK_TOMORROW,
- TOK_YESTERDAY,
-
- TOK_YEAR,
- TOK_QUARTER,
- TOK_MONTH,
- TOK_WEEK,
- TOK_DAY,
-
- TOK_YEARLY,
- TOK_QUARTERLY,
- TOK_BIMONTHLY,
- TOK_MONTHLY,
- TOK_BIWEEKLY,
- TOK_WEEKLY,
- TOK_DAILY,
-
- TOK_YEARS,
- TOK_QUARTERS,
- TOK_MONTHS,
- TOK_WEEKS,
- TOK_DAYS,
-
- END_REACHED
+ UNKNOWN,
+
+ TOK_DATE,
+ TOK_INT,
+ TOK_SLASH,
+ TOK_DASH,
+ TOK_DOT,
+
+ TOK_A_YEAR,
+ TOK_A_MONTH,
+ TOK_A_WDAY,
+
+ TOK_SINCE,
+ TOK_UNTIL,
+ TOK_IN,
+ TOK_THIS,
+ TOK_NEXT,
+ TOK_LAST,
+ TOK_EVERY,
+
+ TOK_TODAY,
+ TOK_TOMORROW,
+ TOK_YESTERDAY,
+
+ TOK_YEAR,
+ TOK_QUARTER,
+ TOK_MONTH,
+ TOK_WEEK,
+ TOK_DAY,
+
+ TOK_YEARLY,
+ TOK_QUARTERLY,
+ TOK_BIMONTHLY,
+ TOK_MONTHLY,
+ TOK_BIWEEKLY,
+ TOK_WEEKLY,
+ TOK_DAILY,
+
+ TOK_YEARS,
+ TOK_QUARTERS,
+ TOK_MONTHS,
+ TOK_WEEKS,
+ TOK_DAYS,
+
+ END_REACHED
} kind;
typedef variant<unsigned short,
- string,
- date_specifier_t::year_type,
- date_time::months_of_year,
- date_time::weekdays,
- date_specifier_t> content_t;
+ string,
+ date_specifier_t::year_type,
+ date_time::months_of_year,
+ date_time::weekdays,
+ date_specifier_t> content_t;
optional<content_t> value;
explicit token_t(kind_t _kind = UNKNOWN,
- const optional<content_t>& _value =
- content_t(empty_string))
- : kind(_kind), value(_value) {
- TRACE_CTOR(date_parser_t::lexer_t::token_t, "");
+ const optional<content_t>& _value =
+ content_t(empty_string))
+ : kind(_kind), value(_value) {
+ TRACE_CTOR(date_parser_t::lexer_t::token_t, "");
}
token_t(const token_t& tok)
- : kind(tok.kind), value(tok.value) {
- TRACE_CTOR(date_parser_t::lexer_t::token_t, "copy");
+ : kind(tok.kind), value(tok.value) {
+ TRACE_CTOR(date_parser_t::lexer_t::token_t, "copy");
}
~token_t() throw() {
- TRACE_DTOR(date_parser_t::lexer_t::token_t);
+ TRACE_DTOR(date_parser_t::lexer_t::token_t);
}
token_t& operator=(const token_t& tok) {
- if (this != &tok) {
- kind = tok.kind;
- value = tok.value;
- }
- return *this;
+ if (this != &tok) {
+ kind = tok.kind;
+ value = tok.value;
+ }
+ return *this;
}
operator bool() const {
- return kind != END_REACHED;
+ return kind != END_REACHED;
}
string to_string() const {
- std::ostringstream out;
-
- switch (kind) {
- case UNKNOWN:
- out << boost::get<string>(*value);
- break;
- case TOK_DATE:
- return boost::get<date_specifier_t>(*value).to_string();
- case TOK_INT:
- out << boost::get<unsigned short>(*value);
- break;
- case TOK_SLASH: return "/";
- case TOK_DASH: return "-";
- case TOK_DOT: return ".";
- case TOK_A_YEAR:
- out << boost::get<date_specifier_t::year_type>(*value);
- break;
- case TOK_A_MONTH:
- out << date_specifier_t::month_type
- (boost::get<date_time::months_of_year>(*value));
- break;
- case TOK_A_WDAY:
- out << date_specifier_t::day_of_week_type
- (boost::get<date_time::weekdays>(*value));
- break;
- case TOK_SINCE: return "since";
- case TOK_UNTIL: return "until";
- case TOK_IN: return "in";
- case TOK_THIS: return "this";
- case TOK_NEXT: return "next";
- case TOK_LAST: return "last";
- case TOK_EVERY: return "every";
- case TOK_TODAY: return "today";
- case TOK_TOMORROW: return "tomorrow";
- case TOK_YESTERDAY: return "yesterday";
- case TOK_YEAR: return "year";
- case TOK_QUARTER: return "quarter";
- case TOK_MONTH: return "month";
- case TOK_WEEK: return "week";
- case TOK_DAY: return "day";
- case TOK_YEARLY: return "yearly";
- case TOK_QUARTERLY: return "quarterly";
- case TOK_BIMONTHLY: return "bimonthly";
- case TOK_MONTHLY: return "monthly";
- case TOK_BIWEEKLY: return "biweekly";
- case TOK_WEEKLY: return "weekly";
- case TOK_DAILY: return "daily";
- case TOK_YEARS: return "years";
- case TOK_QUARTERS: return "quarters";
- case TOK_MONTHS: return "months";
- case TOK_WEEKS: return "weeks";
- case TOK_DAYS: return "days";
- case END_REACHED: return "<EOF>";
- default:
- assert(false);
- return empty_string;
- }
-
- return out.str();
+ std::ostringstream out;
+
+ switch (kind) {
+ case UNKNOWN:
+ out << boost::get<string>(*value);
+ break;
+ case TOK_DATE:
+ return boost::get<date_specifier_t>(*value).to_string();
+ case TOK_INT:
+ out << boost::get<unsigned short>(*value);
+ break;
+ case TOK_SLASH: return "/";
+ case TOK_DASH: return "-";
+ case TOK_DOT: return ".";
+ case TOK_A_YEAR:
+ out << boost::get<date_specifier_t::year_type>(*value);
+ break;
+ case TOK_A_MONTH:
+ out << date_specifier_t::month_type
+ (boost::get<date_time::months_of_year>(*value));
+ break;
+ case TOK_A_WDAY:
+ out << date_specifier_t::day_of_week_type
+ (boost::get<date_time::weekdays>(*value));
+ break;
+ case TOK_SINCE: return "since";
+ case TOK_UNTIL: return "until";
+ case TOK_IN: return "in";
+ case TOK_THIS: return "this";
+ case TOK_NEXT: return "next";
+ case TOK_LAST: return "last";
+ case TOK_EVERY: return "every";
+ case TOK_TODAY: return "today";
+ case TOK_TOMORROW: return "tomorrow";
+ case TOK_YESTERDAY: return "yesterday";
+ case TOK_YEAR: return "year";
+ case TOK_QUARTER: return "quarter";
+ case TOK_MONTH: return "month";
+ case TOK_WEEK: return "week";
+ case TOK_DAY: return "day";
+ case TOK_YEARLY: return "yearly";
+ case TOK_QUARTERLY: return "quarterly";
+ case TOK_BIMONTHLY: return "bimonthly";
+ case TOK_MONTHLY: return "monthly";
+ case TOK_BIWEEKLY: return "biweekly";
+ case TOK_WEEKLY: return "weekly";
+ case TOK_DAILY: return "daily";
+ case TOK_YEARS: return "years";
+ case TOK_QUARTERS: return "quarters";
+ case TOK_MONTHS: return "months";
+ case TOK_WEEKS: return "weeks";
+ case TOK_DAYS: return "days";
+ case END_REACHED: return "<EOF>";
+ default:
+ assert(false);
+ return empty_string;
+ }
+
+ return out.str();
}
void dump(std::ostream& out) const {
- switch (kind) {
- case UNKNOWN: out << "UNKNOWN"; break;
- case TOK_DATE: out << "TOK_DATE"; break;
- case TOK_INT: out << "TOK_INT"; break;
- case TOK_SLASH: out << "TOK_SLASH"; break;
- case TOK_DASH: out << "TOK_DASH"; break;
- case TOK_DOT: out << "TOK_DOT"; break;
- case TOK_A_YEAR: out << "TOK_A_YEAR"; break;
- case TOK_A_MONTH: out << "TOK_A_MONTH"; break;
- case TOK_A_WDAY: out << "TOK_A_WDAY"; break;
- case TOK_SINCE: out << "TOK_SINCE"; break;
- case TOK_UNTIL: out << "TOK_UNTIL"; break;
- case TOK_IN: out << "TOK_IN"; break;
- case TOK_THIS: out << "TOK_THIS"; break;
- case TOK_NEXT: out << "TOK_NEXT"; break;
- case TOK_LAST: out << "TOK_LAST"; break;
- case TOK_EVERY: out << "TOK_EVERY"; break;
- case TOK_TODAY: out << "TOK_TODAY"; break;
- case TOK_TOMORROW: out << "TOK_TOMORROW"; break;
- case TOK_YESTERDAY: out << "TOK_YESTERDAY"; break;
- case TOK_YEAR: out << "TOK_YEAR"; break;
- case TOK_QUARTER: out << "TOK_QUARTER"; break;
- case TOK_MONTH: out << "TOK_MONTH"; break;
- case TOK_WEEK: out << "TOK_WEEK"; break;
- case TOK_DAY: out << "TOK_DAY"; break;
- case TOK_YEARLY: out << "TOK_YEARLY"; break;
- case TOK_QUARTERLY: out << "TOK_QUARTERLY"; break;
- case TOK_BIMONTHLY: out << "TOK_BIMONTHLY"; break;
- case TOK_MONTHLY: out << "TOK_MONTHLY"; break;
- case TOK_BIWEEKLY: out << "TOK_BIWEEKLY"; break;
- case TOK_WEEKLY: out << "TOK_WEEKLY"; break;
- case TOK_DAILY: out << "TOK_DAILY"; break;
- case TOK_YEARS: out << "TOK_YEARS"; break;
- case TOK_QUARTERS: out << "TOK_QUARTERS"; break;
- case TOK_MONTHS: out << "TOK_MONTHS"; break;
- case TOK_WEEKS: out << "TOK_WEEKS"; break;
- case TOK_DAYS: out << "TOK_DAYS"; break;
- case END_REACHED: out << "END_REACHED"; break;
- default:
- assert(false);
- break;
- }
+ switch (kind) {
+ case UNKNOWN: out << "UNKNOWN"; break;
+ case TOK_DATE: out << "TOK_DATE"; break;
+ case TOK_INT: out << "TOK_INT"; break;
+ case TOK_SLASH: out << "TOK_SLASH"; break;
+ case TOK_DASH: out << "TOK_DASH"; break;
+ case TOK_DOT: out << "TOK_DOT"; break;
+ case TOK_A_YEAR: out << "TOK_A_YEAR"; break;
+ case TOK_A_MONTH: out << "TOK_A_MONTH"; break;
+ case TOK_A_WDAY: out << "TOK_A_WDAY"; break;
+ case TOK_SINCE: out << "TOK_SINCE"; break;
+ case TOK_UNTIL: out << "TOK_UNTIL"; break;
+ case TOK_IN: out << "TOK_IN"; break;
+ case TOK_THIS: out << "TOK_THIS"; break;
+ case TOK_NEXT: out << "TOK_NEXT"; break;
+ case TOK_LAST: out << "TOK_LAST"; break;
+ case TOK_EVERY: out << "TOK_EVERY"; break;
+ case TOK_TODAY: out << "TOK_TODAY"; break;
+ case TOK_TOMORROW: out << "TOK_TOMORROW"; break;
+ case TOK_YESTERDAY: out << "TOK_YESTERDAY"; break;
+ case TOK_YEAR: out << "TOK_YEAR"; break;
+ case TOK_QUARTER: out << "TOK_QUARTER"; break;
+ case TOK_MONTH: out << "TOK_MONTH"; break;
+ case TOK_WEEK: out << "TOK_WEEK"; break;
+ case TOK_DAY: out << "TOK_DAY"; break;
+ case TOK_YEARLY: out << "TOK_YEARLY"; break;
+ case TOK_QUARTERLY: out << "TOK_QUARTERLY"; break;
+ case TOK_BIMONTHLY: out << "TOK_BIMONTHLY"; break;
+ case TOK_MONTHLY: out << "TOK_MONTHLY"; break;
+ case TOK_BIWEEKLY: out << "TOK_BIWEEKLY"; break;
+ case TOK_WEEKLY: out << "TOK_WEEKLY"; break;
+ case TOK_DAILY: out << "TOK_DAILY"; break;
+ case TOK_YEARS: out << "TOK_YEARS"; break;
+ case TOK_QUARTERS: out << "TOK_QUARTERS"; break;
+ case TOK_MONTHS: out << "TOK_MONTHS"; break;
+ case TOK_WEEKS: out << "TOK_WEEKS"; break;
+ case TOK_DAYS: out << "TOK_DAYS"; break;
+ case END_REACHED: out << "END_REACHED"; break;
+ default:
+ assert(false);
+ break;
+ }
}
void unexpected();
@@ -592,14 +592,14 @@ class date_parser_t
token_t token_cache;
lexer_t(string::const_iterator _begin,
- string::const_iterator _end)
+ string::const_iterator _end)
: begin(_begin), end(_end)
{
TRACE_CTOR(date_parser_t::lexer_t, "");
}
lexer_t(const lexer_t& lexer)
: begin(lexer.begin), end(lexer.end),
- token_cache(lexer.token_cache)
+ token_cache(lexer.token_cache)
{
TRACE_CTOR(date_parser_t::lexer_t, "copy");
}
@@ -614,7 +614,7 @@ class date_parser_t
}
token_t peek_token() {
if (token_cache.kind == token_t::UNKNOWN)
- token_cache = next_token();
+ token_cache = next_token();
return token_cache;
}
};
@@ -642,7 +642,7 @@ private:
};
void date_parser_t::determine_when(date_parser_t::lexer_t::token_t& tok,
- date_specifier_t& specifier)
+ date_specifier_t& specifier)
{
switch (tok.kind) {
case lexer_t::token_t::TOK_DATE:
@@ -680,8 +680,8 @@ date_interval_t date_parser_t::parse()
optional<date_specifier_t> inclusion_specifier;
date_interval_t period;
- date_t today = CURRENT_DATE();
- bool end_inclusive = false;
+ date_t today = CURRENT_DATE();
+ bool end_inclusive = false;
for (lexer_t::token_t tok = lexer.next_token();
tok.kind != lexer_t::token_t::END_REACHED;
@@ -697,77 +697,77 @@ date_interval_t date_parser_t::parse()
case lexer_t::token_t::TOK_DATE:
if (! inclusion_specifier)
- inclusion_specifier = date_specifier_t();
+ inclusion_specifier = date_specifier_t();
determine_when(tok, *inclusion_specifier);
break;
case lexer_t::token_t::TOK_INT:
if (! inclusion_specifier)
- inclusion_specifier = date_specifier_t();
+ inclusion_specifier = date_specifier_t();
determine_when(tok, *inclusion_specifier);
break;
case lexer_t::token_t::TOK_A_YEAR:
if (! inclusion_specifier)
- inclusion_specifier = date_specifier_t();
+ inclusion_specifier = date_specifier_t();
determine_when(tok, *inclusion_specifier);
break;
case lexer_t::token_t::TOK_A_MONTH:
if (! inclusion_specifier)
- inclusion_specifier = date_specifier_t();
+ inclusion_specifier = date_specifier_t();
determine_when(tok, *inclusion_specifier);
break;
case lexer_t::token_t::TOK_A_WDAY:
if (! inclusion_specifier)
- inclusion_specifier = date_specifier_t();
+ inclusion_specifier = date_specifier_t();
determine_when(tok, *inclusion_specifier);
break;
case lexer_t::token_t::TOK_DASH:
if (inclusion_specifier) {
- since_specifier = inclusion_specifier;
- until_specifier = date_specifier_t();
- inclusion_specifier = none;
+ since_specifier = inclusion_specifier;
+ until_specifier = date_specifier_t();
+ inclusion_specifier = none;
- tok = lexer.next_token();
- determine_when(tok, *until_specifier);
+ tok = lexer.next_token();
+ determine_when(tok, *until_specifier);
- // The dash operator is special: it has an _inclusive_ end.
- end_inclusive = true;
+ // The dash operator is special: it has an _inclusive_ end.
+ end_inclusive = true;
} else {
- tok.unexpected();
+ tok.unexpected();
}
break;
case lexer_t::token_t::TOK_SINCE:
if (since_specifier) {
- tok.unexpected();
+ tok.unexpected();
} else {
- since_specifier = date_specifier_t();
- tok = lexer.next_token();
- determine_when(tok, *since_specifier);
+ since_specifier = date_specifier_t();
+ tok = lexer.next_token();
+ determine_when(tok, *since_specifier);
}
break;
case lexer_t::token_t::TOK_UNTIL:
if (until_specifier) {
- tok.unexpected();
+ tok.unexpected();
} else {
- until_specifier = date_specifier_t();
- tok = lexer.next_token();
- determine_when(tok, *until_specifier);
+ until_specifier = date_specifier_t();
+ tok = lexer.next_token();
+ determine_when(tok, *until_specifier);
}
break;
case lexer_t::token_t::TOK_IN:
if (inclusion_specifier) {
- tok.unexpected();
+ tok.unexpected();
} else {
- inclusion_specifier = date_specifier_t();
- tok = lexer.next_token();
- determine_when(tok, *inclusion_specifier);
+ inclusion_specifier = date_specifier_t();
+ tok = lexer.next_token();
+ determine_when(tok, *inclusion_specifier);
}
break;
@@ -776,90 +776,90 @@ date_interval_t date_parser_t::parse()
case lexer_t::token_t::TOK_LAST: {
int8_t adjust = 0;
if (tok.kind == lexer_t::token_t::TOK_NEXT)
- adjust = 1;
+ adjust = 1;
else if (tok.kind == lexer_t::token_t::TOK_LAST)
- adjust = -1;
+ adjust = -1;
tok = lexer.next_token();
switch (tok.kind) {
case lexer_t::token_t::TOK_INT:
- // jww (2009-11-18): Allow things like "last 5 weeks"
- assert(! "Need to allow for expressions like \"last 5 weeks\"");
- tok.unexpected();
- break;
+ // jww (2009-11-18): Allow things like "last 5 weeks"
+ assert(! "Need to allow for expressions like \"last 5 weeks\"");
+ tok.unexpected();
+ break;
case lexer_t::token_t::TOK_A_MONTH: {
- inclusion_specifier = date_specifier_t();
- determine_when(tok, *inclusion_specifier);
-
- date_t temp(today.year(), *inclusion_specifier->month, 1);
- temp += gregorian::years(adjust);
- inclusion_specifier =
- date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
- temp.month());
- break;
+ inclusion_specifier = date_specifier_t();
+ determine_when(tok, *inclusion_specifier);
+
+ date_t temp(today.year(), *inclusion_specifier->month, 1);
+ temp += gregorian::years(adjust);
+ inclusion_specifier =
+ date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
+ temp.month());
+ break;
}
case lexer_t::token_t::TOK_A_WDAY: {
- inclusion_specifier = date_specifier_t();
- determine_when(tok, *inclusion_specifier);
-
- date_t temp =
- date_duration_t::find_nearest(today, date_duration_t::WEEKS);
- while (temp.day_of_week() != inclusion_specifier->wday)
- temp += gregorian::days(1);
- temp += gregorian::days(7 * adjust);
- inclusion_specifier = date_specifier_t(temp);
- break;
+ inclusion_specifier = date_specifier_t();
+ determine_when(tok, *inclusion_specifier);
+
+ date_t temp =
+ date_duration_t::find_nearest(today, date_duration_t::WEEKS);
+ while (temp.day_of_week() != inclusion_specifier->wday)
+ temp += gregorian::days(1);
+ temp += gregorian::days(7 * adjust);
+ inclusion_specifier = date_specifier_t(temp);
+ break;
}
case lexer_t::token_t::TOK_YEAR: {
- date_t temp(today);
- temp += gregorian::years(adjust);
- inclusion_specifier =
- date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()));
- break;
+ date_t temp(today);
+ temp += gregorian::years(adjust);
+ inclusion_specifier =
+ date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()));
+ break;
}
case lexer_t::token_t::TOK_QUARTER: {
- date_t temp =
- date_duration_t::find_nearest(today, date_duration_t::QUARTERS);
- temp += gregorian::months(3 * adjust);
- inclusion_specifier =
- date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
- temp.month());
+ date_t temp =
+ date_duration_t::find_nearest(today, date_duration_t::QUARTERS);
+ temp += gregorian::months(3 * adjust);
+ inclusion_specifier =
+ date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
+ temp.month());
#if 0
- period.duration = date_duration_t(date_duration_t::QUARTERS, 1);
+ period.duration = date_duration_t(date_duration_t::QUARTERS, 1);
#endif
- break;
+ break;
}
case lexer_t::token_t::TOK_WEEK: {
- date_t temp =
- date_duration_t::find_nearest(today, date_duration_t::WEEKS);
- temp += gregorian::days(7 * adjust);
- inclusion_specifier = date_specifier_t(today);
+ date_t temp =
+ date_duration_t::find_nearest(today, date_duration_t::WEEKS);
+ temp += gregorian::days(7 * adjust);
+ inclusion_specifier = date_specifier_t(today);
#if 0
- period.duration = date_duration_t(date_duration_t::WEEKS, 1);
+ period.duration = date_duration_t(date_duration_t::WEEKS, 1);
#endif
- break;
+ break;
}
case lexer_t::token_t::TOK_DAY: {
- date_t temp(today);
- temp += gregorian::days(adjust);
- inclusion_specifier = date_specifier_t(temp);
- break;
+ date_t temp(today);
+ temp += gregorian::days(adjust);
+ inclusion_specifier = date_specifier_t(temp);
+ break;
}
default:
case lexer_t::token_t::TOK_MONTH: {
- date_t temp(today);
- temp += gregorian::months(adjust);
- inclusion_specifier =
- date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
- temp.month());
- break;
+ date_t temp(today);
+ temp += gregorian::months(adjust);
+ inclusion_specifier =
+ date_specifier_t(static_cast<date_specifier_t::year_type>(temp.year()),
+ temp.month());
+ break;
}
}
}
@@ -877,49 +877,49 @@ date_interval_t date_parser_t::parse()
case lexer_t::token_t::TOK_EVERY:
tok = lexer.next_token();
if (tok == lexer_t::token_t::TOK_INT) {
- int quantity = boost::get<unsigned short>(*tok.value);
- tok = lexer.next_token();
- switch (tok.kind) {
- case lexer_t::token_t::TOK_YEARS:
- period.duration = date_duration_t(date_duration_t::YEARS, quantity);
- break;
- case lexer_t::token_t::TOK_QUARTERS:
- period.duration = date_duration_t(date_duration_t::QUARTERS, quantity);
- break;
- case lexer_t::token_t::TOK_MONTHS:
- period.duration = date_duration_t(date_duration_t::MONTHS, quantity);
- break;
- case lexer_t::token_t::TOK_WEEKS:
- period.duration = date_duration_t(date_duration_t::WEEKS, quantity);
- break;
- case lexer_t::token_t::TOK_DAYS:
- period.duration = date_duration_t(date_duration_t::DAYS, quantity);
- break;
- default:
- tok.unexpected();
- break;
- }
+ int quantity = boost::get<unsigned short>(*tok.value);
+ tok = lexer.next_token();
+ switch (tok.kind) {
+ case lexer_t::token_t::TOK_YEARS:
+ period.duration = date_duration_t(date_duration_t::YEARS, quantity);
+ break;
+ case lexer_t::token_t::TOK_QUARTERS:
+ period.duration = date_duration_t(date_duration_t::QUARTERS, quantity);
+ break;
+ case lexer_t::token_t::TOK_MONTHS:
+ period.duration = date_duration_t(date_duration_t::MONTHS, quantity);
+ break;
+ case lexer_t::token_t::TOK_WEEKS:
+ period.duration = date_duration_t(date_duration_t::WEEKS, quantity);
+ break;
+ case lexer_t::token_t::TOK_DAYS:
+ period.duration = date_duration_t(date_duration_t::DAYS, quantity);
+ break;
+ default:
+ tok.unexpected();
+ break;
+ }
} else {
- switch (tok.kind) {
- case lexer_t::token_t::TOK_YEAR:
- period.duration = date_duration_t(date_duration_t::YEARS, 1);
- break;
- case lexer_t::token_t::TOK_QUARTER:
- period.duration = date_duration_t(date_duration_t::QUARTERS, 1);
- break;
- case lexer_t::token_t::TOK_MONTH:
- period.duration = date_duration_t(date_duration_t::MONTHS, 1);
- break;
- case lexer_t::token_t::TOK_WEEK:
- period.duration = date_duration_t(date_duration_t::WEEKS, 1);
- break;
- case lexer_t::token_t::TOK_DAY:
- period.duration = date_duration_t(date_duration_t::DAYS, 1);
- break;
- default:
- tok.unexpected();
- break;
- }
+ switch (tok.kind) {
+ case lexer_t::token_t::TOK_YEAR:
+ period.duration = date_duration_t(date_duration_t::YEARS, 1);
+ break;
+ case lexer_t::token_t::TOK_QUARTER:
+ period.duration = date_duration_t(date_duration_t::QUARTERS, 1);
+ break;
+ case lexer_t::token_t::TOK_MONTH:
+ period.duration = date_duration_t(date_duration_t::MONTHS, 1);
+ break;
+ case lexer_t::token_t::TOK_WEEK:
+ period.duration = date_duration_t(date_duration_t::WEEKS, 1);
+ break;
+ case lexer_t::token_t::TOK_DAY:
+ period.duration = date_duration_t(date_duration_t::DAYS, 1);
+ break;
+ default:
+ tok.unexpected();
+ break;
+ }
}
break;
@@ -983,13 +983,13 @@ void date_interval_t::resolve_end()
if (start && ! end_of_duration) {
end_of_duration = duration->add(*start);
DEBUG("times.interval",
- "stabilize: end_of_duration = " << *end_of_duration);
+ "stabilize: end_of_duration = " << *end_of_duration);
}
if (finish && *end_of_duration > *finish) {
end_of_duration = finish;
DEBUG("times.interval",
- "stabilize: end_of_duration reset to end: " << *end_of_duration);
+ "stabilize: end_of_duration reset to end: " << *end_of_duration);
}
if (start && ! next) {
@@ -1009,9 +1009,9 @@ date_t date_duration_t::find_nearest(const date_t& date, skip_quantum_t skip)
case date_duration_t::QUARTERS:
result = date_t(date.year(), date.month(), 1);
while (result.month() != gregorian::Jan &&
- result.month() != gregorian::Apr &&
- result.month() != gregorian::Jul &&
- result.month() != gregorian::Oct)
+ result.month() != gregorian::Apr &&
+ result.month() != gregorian::Jul &&
+ result.month() != gregorian::Oct)
result -= gregorian::months(1);
break;
case date_duration_t::MONTHS:
@@ -1043,7 +1043,7 @@ void date_interval_t::stabilize(const optional<date_t>& date)
DEBUG("times.interval", "stabilize: date passed, but not aligned");
if (duration) {
DEBUG("times.interval",
- "stabilize: aligning with a duration: " << *duration);
+ "stabilize: aligning with a duration: " << *duration);
// The interval object has not been seeded with a start date yet, so
// find the nearest period before on on date which fits, if possible.
@@ -1057,71 +1057,71 @@ void date_interval_t::stabilize(const optional<date_t>& date)
#if defined(DEBUG_ON)
if (initial_start)
- DEBUG("times.interval",
- "stabilize: initial_start = " << *initial_start);
+ DEBUG("times.interval",
+ "stabilize: initial_start = " << *initial_start);
if (initial_finish)
- DEBUG("times.interval",
- "stabilize: initial_finish = " << *initial_finish);
+ DEBUG("times.interval",
+ "stabilize: initial_finish = " << *initial_finish);
#endif
date_t when = start ? *start : *date;
if (duration->quantum == date_duration_t::MONTHS ||
- duration->quantum == date_duration_t::QUARTERS ||
- duration->quantum == date_duration_t::YEARS) {
- DEBUG("times.interval",
- "stabilize: monthly, quarterly or yearly duration");
- start = date_duration_t::find_nearest(when, duration->quantum);
+ duration->quantum == date_duration_t::QUARTERS ||
+ duration->quantum == date_duration_t::YEARS) {
+ DEBUG("times.interval",
+ "stabilize: monthly, quarterly or yearly duration");
+ start = date_duration_t::find_nearest(when, duration->quantum);
} else {
- DEBUG("times.interval", "stabilize: daily or weekly duration");
- start = date_duration_t::find_nearest(when - gregorian::days(400),
- duration->quantum);
+ DEBUG("times.interval", "stabilize: daily or weekly duration");
+ start = date_duration_t::find_nearest(when - gregorian::days(400),
+ duration->quantum);
}
DEBUG("times.interval",
- "stabilize: beginning start date = " << *start);
+ "stabilize: beginning start date = " << *start);
while (*start < *date) {
- date_interval_t next_interval(*this);
- ++next_interval;
-
- if (next_interval.start && *next_interval.start < *date) {
- *this = next_interval;
- } else {
- end_of_duration = none;
- next = none;
- break;
- }
+ date_interval_t next_interval(*this);
+ ++next_interval;
+
+ if (next_interval.start && *next_interval.start < *date) {
+ *this = next_interval;
+ } else {
+ end_of_duration = none;
+ next = none;
+ break;
+ }
}
DEBUG("times.interval", "stabilize: proposed start date = " << *start);
if (initial_start && (! start || *start < *initial_start)) {
- // Using the discovered start, find the end of the period
- resolve_end();
+ // Using the discovered start, find the end of the period
+ resolve_end();
- start = initial_start;
- DEBUG("times.interval", "stabilize: start reset to initial start");
+ start = initial_start;
+ DEBUG("times.interval", "stabilize: start reset to initial start");
}
if (initial_finish && (! finish || *finish > *initial_finish)) {
- finish = initial_finish;
- DEBUG("times.interval", "stabilize: finish reset to initial finish");
+ finish = initial_finish;
+ DEBUG("times.interval", "stabilize: finish reset to initial finish");
}
#if defined(DEBUG_ON)
if (start)
- DEBUG("times.interval", "stabilize: final start = " << *start);
+ DEBUG("times.interval", "stabilize: final start = " << *start);
if (finish)
- DEBUG("times.interval", "stabilize: final finish = " << *finish);
+ DEBUG("times.interval", "stabilize: final finish = " << *finish);
#endif
}
else if (range) {
if (date) {
- start = range->begin(date->year());
- finish = range->end(date->year());
+ start = range->begin(date->year());
+ finish = range->end(date->year());
} else {
- start = range->begin();
- finish = range->end();
+ start = range->begin();
+ finish = range->end();
}
}
aligned = true;
@@ -1134,7 +1134,7 @@ void date_interval_t::stabilize(const optional<date_t>& date)
if (! start && ! finish)
throw_(date_error,
- _("Invalid date interval: neither start, nor finish, nor duration"));
+ _("Invalid date interval: neither start, nor finish, nor duration"));
} else {
resolve_end();
}
@@ -1146,7 +1146,7 @@ bool date_interval_t::find_period(const date_t& date)
if (finish && date > *finish) {
DEBUG("times.interval",
- "false: date [" << date << "] > finish [" << *finish << "]");
+ "false: date [" << date << "] > finish [" << *finish << "]");
return false;
}
@@ -1155,15 +1155,15 @@ bool date_interval_t::find_period(const date_t& date)
}
else if (date < *start) {
DEBUG("times.interval",
- "false: date [" << date << "] < start [" << *start << "]");
+ "false: date [" << date << "] < start [" << *start << "]");
return false;
}
if (end_of_duration) {
if (date < *end_of_duration) {
DEBUG("times.interval",
- "true: date [" << date << "] < end_of_duration ["
- << *end_of_duration << "]");
+ "true: date [" << date << "] < end_of_duration ["
+ << *end_of_duration << "]");
return true;
}
} else {
@@ -1185,17 +1185,17 @@ bool date_interval_t::find_period(const date_t& date)
while (date >= scan && (! finish || scan < *finish)) {
if (date < end_of_scan) {
- start = scan;
+ start = scan;
end_of_duration = end_of_scan;
- next = none;
+ next = none;
- DEBUG("times.interval", "true: start = " << *start);
+ DEBUG("times.interval", "true: start = " << *start);
DEBUG("times.interval", "true: end_of_duration = " << *end_of_duration);
return true;
}
- scan = duration->add(scan);
+ scan = duration->add(scan);
end_of_scan = duration->add(scan);
}
@@ -1211,7 +1211,7 @@ date_interval_t& date_interval_t::operator++()
if (! duration)
throw_(date_error,
- _("Cannot increment a date interval without a duration"));
+ _("Cannot increment a date interval without a duration"));
assert(next);
@@ -1319,16 +1319,16 @@ date_parser_t::lexer_t::token_t date_parser_t::lexer_t::next_token()
date_traits_t traits;
date_t when = parse_date_mask(possible_date.c_str(), none, &traits);
if (! when.is_not_a_date()) {
- begin = i;
- return token_t(token_t::TOK_DATE,
- token_t::content_t(date_specifier_t(when, traits)));
+ begin = i;
+ return token_t(token_t::TOK_DATE,
+ token_t::content_t(date_specifier_t(when, traits)));
}
}
catch (date_error&) {
if (contains(possible_date, "/") ||
- contains(possible_date, "-") ||
- contains(possible_date, "."))
- throw;
+ contains(possible_date, "-") ||
+ contains(possible_date, "."))
+ throw;
}
}
@@ -1337,85 +1337,85 @@ date_parser_t::lexer_t::token_t date_parser_t::lexer_t::next_token()
string term;
bool alnum = std::isalnum(*begin);
for (; (begin != end && ! std::isspace(*begin) &&
- ((alnum && static_cast<bool>(std::isalnum(*begin))) ||
- (! alnum && ! static_cast<bool>(std::isalnum(*begin))))); begin++)
+ ((alnum && static_cast<bool>(std::isalnum(*begin))) ||
+ (! alnum && ! static_cast<bool>(std::isalnum(*begin))))); begin++)
term.push_back(*begin);
if (! term.empty()) {
if (std::isdigit(term[0])) {
if (term.length() == 4)
- return token_t(token_t::TOK_A_YEAR,
- token_t::content_t
- (lexical_cast<date_specifier_t::year_type>(term)));
+ return token_t(token_t::TOK_A_YEAR,
+ token_t::content_t
+ (lexical_cast<date_specifier_t::year_type>(term)));
else
- return token_t(token_t::TOK_INT,
- token_t::content_t(lexical_cast<unsigned short>(term)));
+ return token_t(token_t::TOK_INT,
+ token_t::content_t(lexical_cast<unsigned short>(term)));
}
else if (std::isalpha(term[0])) {
to_lower(term);
if (optional<date_time::months_of_year> month =
- string_to_month_of_year(term)) {
- return token_t(token_t::TOK_A_MONTH, token_t::content_t(*month));
+ string_to_month_of_year(term)) {
+ return token_t(token_t::TOK_A_MONTH, token_t::content_t(*month));
}
else if (optional<date_time::weekdays> wday =
- string_to_day_of_week(term)) {
- return token_t(token_t::TOK_A_WDAY, token_t::content_t(*wday));
+ string_to_day_of_week(term)) {
+ return token_t(token_t::TOK_A_WDAY, token_t::content_t(*wday));
}
else if (term == _("from") || term == _("since"))
- return token_t(token_t::TOK_SINCE);
+ return token_t(token_t::TOK_SINCE);
else if (term == _("to") || term == _("until"))
- return token_t(token_t::TOK_UNTIL);
+ return token_t(token_t::TOK_UNTIL);
else if (term == _("in"))
- return token_t(token_t::TOK_IN);
+ return token_t(token_t::TOK_IN);
else if (term == _("this"))
- return token_t(token_t::TOK_THIS);
+ return token_t(token_t::TOK_THIS);
else if (term == _("next"))
- return token_t(token_t::TOK_NEXT);
+ return token_t(token_t::TOK_NEXT);
else if (term == _("last"))
- return token_t(token_t::TOK_LAST);
+ return token_t(token_t::TOK_LAST);
else if (term == _("every"))
- return token_t(token_t::TOK_EVERY);
+ return token_t(token_t::TOK_EVERY);
else if (term == _("today"))
- return token_t(token_t::TOK_TODAY);
+ return token_t(token_t::TOK_TODAY);
else if (term == _("tomorrow"))
- return token_t(token_t::TOK_TOMORROW);
+ return token_t(token_t::TOK_TOMORROW);
else if (term == _("yesterday"))
- return token_t(token_t::TOK_YESTERDAY);
+ return token_t(token_t::TOK_YESTERDAY);
else if (term == _("year"))
- return token_t(token_t::TOK_YEAR);
+ return token_t(token_t::TOK_YEAR);
else if (term == _("quarter"))
- return token_t(token_t::TOK_QUARTER);
+ return token_t(token_t::TOK_QUARTER);
else if (term == _("month"))
- return token_t(token_t::TOK_MONTH);
+ return token_t(token_t::TOK_MONTH);
else if (term == _("week"))
- return token_t(token_t::TOK_WEEK);
+ return token_t(token_t::TOK_WEEK);
else if (term == _("day"))
- return token_t(token_t::TOK_DAY);
+ return token_t(token_t::TOK_DAY);
else if (term == _("yearly"))
- return token_t(token_t::TOK_YEARLY);
+ return token_t(token_t::TOK_YEARLY);
else if (term == _("quarterly"))
- return token_t(token_t::TOK_QUARTERLY);
+ return token_t(token_t::TOK_QUARTERLY);
else if (term == _("bimonthly"))
- return token_t(token_t::TOK_BIMONTHLY);
+ return token_t(token_t::TOK_BIMONTHLY);
else if (term == _("monthly"))
- return token_t(token_t::TOK_MONTHLY);
+ return token_t(token_t::TOK_MONTHLY);
else if (term == _("biweekly"))
- return token_t(token_t::TOK_BIWEEKLY);
+ return token_t(token_t::TOK_BIWEEKLY);
else if (term == _("weekly"))
- return token_t(token_t::TOK_WEEKLY);
+ return token_t(token_t::TOK_WEEKLY);
else if (term == _("daily"))
- return token_t(token_t::TOK_DAILY);
+ return token_t(token_t::TOK_DAILY);
else if (term == _("years"))
- return token_t(token_t::TOK_YEARS);
+ return token_t(token_t::TOK_YEARS);
else if (term == _("quarters"))
- return token_t(token_t::TOK_QUARTERS);
+ return token_t(token_t::TOK_QUARTERS);
else if (term == _("months"))
- return token_t(token_t::TOK_MONTHS);
+ return token_t(token_t::TOK_MONTHS);
else if (term == _("weeks"))
- return token_t(token_t::TOK_WEEKS);
+ return token_t(token_t::TOK_WEEKS);
else if (term == _("days"))
- return token_t(token_t::TOK_DAYS);
+ return token_t(token_t::TOK_DAYS);
}
else {
token_t::expected('\0', term[0]);
@@ -1462,12 +1462,12 @@ namespace {
typedef std::map<std::string, date_io_t *> date_io_map;
datetime_io_map temp_datetime_io;
- date_io_map temp_date_io;
+ date_io_map temp_date_io;
}
-std::string format_datetime(const datetime_t& when,
- const format_type_t format_type,
- const optional<const char *>& format)
+std::string format_datetime(const datetime_t& when,
+ const format_type_t format_type,
+ const optional<const char *>& format)
{
if (format_type == FMT_WRITTEN) {
return written_datetime_io->format(when);
@@ -1491,9 +1491,9 @@ std::string format_datetime(const datetime_t& when,
}
}
-std::string format_date(const date_t& when,
- const format_type_t format_type,
- const optional<const char *>& format)
+std::string format_date(const date_t& when,
+ const format_type_t format_type,
+ const optional<const char *>& format)
{
if (format_type == FMT_WRITTEN) {
return written_date_io->format(when);