8#ifndef INCLUDED_BDLT_DATETIMEFORMATTER
9#define INCLUDED_BDLT_DATETIMEFORMATTER
77#include <bdlscm_version.h>
89#include <bsl_iosfwd.h>
90#include <bsl_string_view.h>
95class DatetimeFormatter_Cache;
105template <
class t_CHAR>
166 template <
class t_ITERATOR>
173 template <
class t_ITERATOR>
178 template <
class t_ITERATOR>
220template <
class t_CHAR>
229template <
class t_CHAR>
233 d_dateFormatter.parseDefault();
235 d_timeFormatter.parseDefault();
238template <
class t_CHAR>
242 d_dateFormatter.parseIso8601();
244 d_timeFormatter.parseIso8601();
247template <
class t_CHAR>
251 return d_dateFormatter.parseNextModifier(specInOut) ||
252 d_timeFormatter.parseNextModifier(specInOut);
255template <
class t_CHAR>
261 if (t_CHAR(
'i') == specInOut->
front()) {
269 return d_dateFormatter.parseNextSpecifier(specInOut) ||
270 d_timeFormatter.parseNextSpecifier(specInOut);
273template <
class t_CHAR>
278 d_dateFormatter.postprocess(spec);
279 d_timeFormatter.postprocess(spec);
283template <
class t_CHAR>
287 return d_dateFormatter.extraSections() |
288 d_timeFormatter.extraSections();
291template <
class t_CHAR>
295 return d_fixedWidth + d_dateFormatter.totalWidth(value.
date()) +
296 d_timeFormatter.totalWidth(value.
time());
299template <
class t_CHAR>
300template <
class t_ITERATOR>
309 if (t_CHAR(
'i') == specInOut->
front()) {
310 *outIt = formatIso8601(*outIt, value);
316 return d_dateFormatter.formatNextSpecifier(specInOut, outIt, value.
date())
317 || d_timeFormatter.formatNextSpecifier(specInOut, outIt, value.
time());
320template <
class t_CHAR>
321template <
class t_ITERATOR>
326 out = d_dateFormatter.formatDefault(out, value.
date());
327 *out++ = t_CHAR(
'_');
328 return d_timeFormatter.formatDefault(out, value.
time());
331template <
class t_CHAR>
332template <
class t_ITERATOR>
337 out = d_dateFormatter.formatIso8601(out, value.
date());
338 *out++ = t_CHAR(
'T');
339 return d_timeFormatter.formatIso8601(out, value.
time());
349: d_dateFormatCache(value.date())
350, d_timeFormatCache(value.time())
358 return d_dateFormatCache;
364 return d_timeFormatCache;
373template <
class t_CHAR>
376 typedef BloombergLP::bdlt::Datetime Datetime;
377 typedef BloombergLP::bdlt::DatetimeFormatter_Cache FormatCache;
378 typedef BloombergLP::bdlt::Formatter<
379 BloombergLP::bdlt::DatetimeFormatter, t_CHAR> Formatter;
382 Formatter d_formatter;
388 template <
class t_PARSE_CONTEXT>
390 t_PARSE_CONTEXT& context)
392 return d_formatter.parse(context);
400 template <
class t_FORMAT_CONTEXT>
401 typename t_FORMAT_CONTEXT::iterator
format(
402 const Datetime& value,
403 t_FORMAT_CONTEXT& formatContext)
const
405 return d_formatter.format(FormatCache(value), formatContext);
Definition bdlt_datetime.h:330
Definition bslstl_stringview.h:471
BSLS_KEYWORD_CONSTEXPR_CPP14 const_reference front() const
Definition bslstl_stringview.h:1966
BSLS_KEYWORD_CONSTEXPR_CPP14 void remove_prefix(size_type numChars)
Definition bslstl_stringview.h:1800
BSLS_KEYWORD_CONSTEXPR bool empty() const BSLS_KEYWORD_NOEXCEPT
Return true if this view has length 0, and false otherwise.
Definition bslstl_stringview.h:1931
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_CONSTEXPR_CPP20
Definition bsls_keyword.h:645
Definition bbldc_basicisma30360.h:112
Definition bdlat_valuetypefunctions.h:939