30 template <
typename Char,
typename Handler>
52 const char newline[] =
"\n";
53 handler.on_text(newline, newline + 1);
57 const char tab[] =
"\t";
188 template <
typename Char>
213 template <
typename Int>
217 return static_cast<int>(
value);
220 template <
typename FormatContext,
typename OutputIt>
230 : context(ctx), out(o) {}
235 auto hour =
to_int((s.count() / 3600) % 12);
236 return hour > 0 ? hour : 12;
243 auto time = std::tm();
244 time.tm_hour = hour();
245 time.tm_min = minute();
254 if (width > num_digits)
255 out = std::fill_n(out, width - num_digits,
'0');
256 out = format_decimal<char_type>(out,
n, num_digits);
260 auto locale = context.locale().template get<std::locale>();
261 auto &facet = std::use_facet<std::time_put<char_type>>(locale);
262 std::basic_ostringstream<char_type> os;
264 facet.put(os, os,
' ', &time, format, format + std::strlen(format));
290 return write(hour(), 2);
292 time.tm_hour = hour();
293 format_localized(
time,
"%OH");
298 return write(hour12(), 2);
300 time.tm_hour = hour();
301 format_localized(
time,
"%OI");
306 return write(minute(), 2);
308 time.tm_min = minute();
309 format_localized(
time,
"%OM");
323 format_localized(
time,
"%OS");
347 template <>
FMT_CONSTEXPR const char *get_units<std::atto>() {
return "as"; }
348 template <>
FMT_CONSTEXPR const char *get_units<std::femto>() {
return "fs"; }
349 template <>
FMT_CONSTEXPR const char *get_units<std::pico>() {
return "ps"; }
350 template <>
FMT_CONSTEXPR const char *get_units<std::nano>() {
return "ns"; }
351 template <>
FMT_CONSTEXPR const char *get_units<std::micro>() {
return "µs"; }
352 template <>
FMT_CONSTEXPR const char *get_units<std::milli>() {
return "ms"; }
353 template <>
FMT_CONSTEXPR const char *get_units<std::centi>() {
return "cs"; }
354 template <>
FMT_CONSTEXPR const char *get_units<std::deci>() {
return "ds"; }
355 template <>
FMT_CONSTEXPR const char *get_units<std::ratio<1>>() {
return "s"; }
356 template <>
FMT_CONSTEXPR const char *get_units<std::deca>() {
return "das"; }
357 template <>
FMT_CONSTEXPR const char *get_units<std::hecto>() {
return "hs"; }
358 template <>
FMT_CONSTEXPR const char *get_units<std::kilo>() {
return "ks"; }
359 template <>
FMT_CONSTEXPR const char *get_units<std::mega>() {
return "Ms"; }
360 template <>
FMT_CONSTEXPR const char *get_units<std::giga>() {
return "Gs"; }
361 template <>
FMT_CONSTEXPR const char *get_units<std::tera>() {
return "Ts"; }
362 template <>
FMT_CONSTEXPR const char *get_units<std::peta>() {
return "Ps"; }
363 template <>
FMT_CONSTEXPR const char *get_units<std::exa>() {
return "Es"; }
371 template <
typename Rep,
typename Period,
typename Char>
377 typedef std::chrono::duration<Rep, Period>
duration;
379 struct spec_handler {
385 template <
typename Id>
388 return arg_ref_type(arg_id);
400 template <
typename Id>
402 f.width_ref = make_arg_ref(arg_id);
410 -> decltype(ctx.begin()) {
411 auto begin = ctx.begin(),
end = ctx.end();
413 spec_handler
handler{*
this, ctx};
422 template <
typename FormatContext>
423 auto format(
const duration &
d, FormatContext &ctx)
424 -> decltype(ctx.out()) {
430 if (
const char *unit = get_units<Period>())
432 else if (Period::den == 1)
436 internal::handle_dynamic_spec<internal::width_checker>(
437 spec.
width_, width_ref, ctx);
439 auto out = std::back_inserter(buf);
445 w.write(buf.
data(), buf.
size(), spec);
452 #endif // FMT_CHRONO_H_ FMT_CONSTEXPR bool check_arg_id(unsigned)
FMT_CONSTEXPR const Char * parse_width(const Char *begin, const Char *end, Handler &&handler)
void msg(const char *fmt,...)
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
FMT_CONSTEXPR const char * get_units()
void write(std::basic_ostream< Char > &os, basic_buffer< Char > &buf)
#define FMT_END_NAMESPACE
std::enable_if< is_contiguous< Container >::value &&internal::is_string< S >::value, std::back_insert_iterator< Container > >::type format_to(std::back_insert_iterator< Container > out, const S &format_str, const Args &...args)
FMT_CONSTEXPR auto end(const C &c) -> decltype(c.end())
second seconds
Alias for common language habits.
std::size_t size() const FMT_NOEXCEPT
std::string str(const std::pair< Type, Type > &tt)
static int max(int a, int b)
millisecond milliseconds
Alias for common language habits.
FMT_CONSTEXPR std::make_unsigned< Int >::type to_unsigned(Int value)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const GenericPointer< typename T::ValueType > T2 value
FMT_CONSTEXPR const Char * parse_chrono_format(const Char *begin, const Char *end, Handler &&handler)
FMT_CONSTEXPR iterator end() const
static msg_handler handler
FMT_CONSTEXPR const Char * parse_align(const Char *begin, const Char *end, Handler &&handler)
#define FMT_ASSERT(condition, message)
static QCString align(DocHtmlCell *cell)
FMT_CONSTEXPR iterator begin() const
second_as<> second
Type of time stored in seconds, in double precision.
FMT_CONSTEXPR unsigned next_arg_id()
int count_digits(uint64_t n)