Files
scylladb/utils/to_string.cc
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

55 lines
1.8 KiB
C++

/*
* 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;
}