forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathto_string.cc
54 lines (48 loc) · 1.79 KB
/
to_string.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "utils/to_string.hh"
#include "utils/user_provided_param.hh"
auto fmt::formatter<std::strong_ordering>::format(std::strong_ordering order, fmt::format_context& ctx) const
-> decltype(ctx.out()) {
if (order > 0) {
return fmt::format_to(ctx.out(), "gt");
} else if (order < 0) {
return fmt::format_to(ctx.out(), "lt");
} else {
return fmt::format_to(ctx.out(), "eq");
}
}
auto fmt::formatter<std::weak_ordering>::format(std::weak_ordering order, fmt::format_context& ctx) const
-> decltype(ctx.out()) {
if (order > 0) {
return fmt::format_to(ctx.out(), "gt");
} else if (order < 0) {
return fmt::format_to(ctx.out(), "lt");
} else {
return fmt::format_to(ctx.out(), "eq");
}
}
auto fmt::formatter<std::partial_ordering>::format(std::partial_ordering order, fmt::format_context& ctx) const
-> decltype(ctx.out()) {
if (order == std::partial_ordering::unordered) {
return fmt::format_to(ctx.out(), "unordered");
} else if (order > 0) {
return fmt::format_to(ctx.out(), "gt");
} else if (order < 0) {
return fmt::format_to(ctx.out(), "lt");
} else {
return fmt::format_to(ctx.out(), "eq");
}
}
auto fmt::formatter<utils::optional_param_flags_set>::format(const utils::optional_param_flags_set& flags, fmt::format_context& ctx) const
-> decltype(ctx.out()) {
auto ret = fmt::format_to(ctx.out(), "{}", flags.contains(utils::optional_param_flag::user_provided) ? "user-provided" : "implicit");
if (flags.contains(utils::optional_param_flag::force)) {
ret = fmt::format_to(ctx.out(), ",force");
}
return ret;
}