From edeb3d80918b1ff361b12f1b1ac30ce5e530d099 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 21 May 2022 19:57:38 -0700 Subject: [PATCH] Remove deprecated APIs --- include/fmt/color.h | 46 ++----------------------------------------- include/fmt/ostream.h | 9 +-------- include/fmt/ranges.h | 5 ----- include/fmt/xchar.h | 10 ---------- 4 files changed, 3 insertions(+), 67 deletions(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index 762809ca..afdf721c 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -10,13 +10,6 @@ #include "format.h" -// __declspec(deprecated) is broken in some MSVC versions. -#if FMT_MSC_VER -# define FMT_DEPRECATED_NONMSVC -#else -# define FMT_DEPRECATED_NONMSVC FMT_DEPRECATED -#endif - FMT_BEGIN_NAMESPACE FMT_MODULE_EXPORT_BEGIN @@ -270,16 +263,6 @@ class text_style { return lhs |= rhs; } - FMT_DEPRECATED_NONMSVC FMT_CONSTEXPR text_style& operator&=( - const text_style& rhs) { - return and_assign(rhs); - } - - FMT_DEPRECATED_NONMSVC friend FMT_CONSTEXPR text_style - operator&(text_style lhs, const text_style& rhs) { - return lhs.and_assign(rhs); - } - FMT_CONSTEXPR bool has_foreground() const noexcept { return set_foreground_color; } @@ -315,31 +298,6 @@ class text_style { } } - // DEPRECATED! - FMT_CONSTEXPR text_style& and_assign(const text_style& rhs) { - if (!set_foreground_color) { - set_foreground_color = rhs.set_foreground_color; - foreground_color = rhs.foreground_color; - } else if (rhs.set_foreground_color) { - if (!foreground_color.is_rgb || !rhs.foreground_color.is_rgb) - FMT_THROW(format_error("can't AND a terminal color")); - foreground_color.value.rgb_color &= rhs.foreground_color.value.rgb_color; - } - - if (!set_background_color) { - set_background_color = rhs.set_background_color; - background_color = rhs.background_color; - } else if (rhs.set_background_color) { - if (!background_color.is_rgb || !rhs.background_color.is_rgb) - FMT_THROW(format_error("can't AND a terminal color")); - background_color.value.rgb_color &= rhs.background_color.value.rgb_color; - } - - ems = static_cast(static_cast(ems) & - static_cast(rhs.ems)); - return *this; - } - friend FMT_CONSTEXPR_DECL text_style fg(detail::color_type foreground) noexcept; @@ -679,8 +637,8 @@ struct formatter, Char> : formatter { **Example**:: fmt::print("Elapsed time: {s:.2f} seconds", - fmt::styled(1.23, fmt::fg(fmt::color::green) | fmt::bg(fmt::color::blue))); - \endrst + fmt::styled(1.23, fmt::fg(fmt::color::green) | + fmt::bg(fmt::color::blue))); \endrst */ template FMT_CONSTEXPR auto styled(const T& value, text_style ts) diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index e228cfc6..a03b0a23 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -144,15 +144,8 @@ template struct fallback_formatter::value>> : basic_ostream_formatter { using basic_ostream_formatter::format; - // DEPRECATED! - template - auto format(const T& value, basic_printf_context& ctx) const - -> OutputIt { - auto buffer = basic_memory_buffer(); - format_value(buffer, value, ctx.locale()); - return std::copy(buffer.begin(), buffer.end(), ctx.out()); - } }; + } // namespace detail FMT_MODULE_EXPORT diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index edff8f96..5d1461b6 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -391,13 +391,8 @@ struct formatter< template auto format(range_type& range, FormatContext& ctx) const -> decltype(ctx.out()) { -#ifdef FMT_DEPRECATED_BRACED_RANGES - Char prefix = '{'; - Char postfix = '}'; -#else Char prefix = detail::is_set::value ? '{' : '['; Char postfix = detail::is_set::value ? '}' : ']'; -#endif detail::range_mapper> mapper; auto out = ctx.out(); *out++ = prefix; diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index 9b57815d..4e9e723a 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -136,16 +136,6 @@ inline auto format_to(OutputIt out, const S& fmt, Args&&... args) -> OutputIt { fmt::make_format_args>(args...)); } -template ::value)> -FMT_DEPRECATED auto format_to(basic_memory_buffer& buf, - const S& format_str, Args&&... args) -> - typename buffer_context::iterator { - detail::vformat_to(buf, to_string_view(format_str), - fmt::make_format_args>(args...), {}); - return detail::buffer_appender(buf); -} - template , FMT_ENABLE_IF(detail::is_output_iterator::value&&