di 0.1.0
Loading...
Searching...
No Matches
bool.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace di::format {
8template<concepts::Encoding Enc>
10 return parse<detail::BoolFormat>(parse_context.current_format_string()) % [](detail::BoolFormat format) {
11 return [=](concepts::FormatContext auto& context, bool value) -> Result<void> {
12 auto type = format.type;
13 auto width = format.width.transform(&detail::Width::value);
14 if (type == detail::BoolType::String) {
15 using namespace string_literals;
16 return detail::present_string_view_to(context, format.fill_and_align, width, nullopt, false,
17 value ? "true"_sv : "false"_sv);
18 }
19 return detail::present_integer_to<Enc>(context, format.fill_and_align, format.sign, format.hash_tag,
20 format.zero, width, static_cast<detail::IntegerType>(type), false,
21 static_cast<i8>(value));
22 };
23 };
24}
25}
Definition format_parse_context.h:14
constexpr auto current_format_string() const -> View
Definition format_parse_context.h:191
Definition format_context.h:9
Definition bounded_format_context.h:7
Definition string.h:17
__INT8_TYPE__ i8
Definition integers.h:14
di::meta::Decay< decltype(T)> Tag
Definition tag_invoke.h:28
Expected< T, Error > Result
Definition result.h:8
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
constexpr auto nullopt
Definition nullopt.h:15
constexpr auto parse
Definition parse.h:23
Definition in_place_type.h:5