Skip to content

Commit

Permalink
Remove deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed May 22, 2022
1 parent 496aff7 commit edeb3d8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 67 deletions.
46 changes: 2 additions & 44 deletions include/fmt/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<emphasis>(static_cast<uint8_t>(ems) &
static_cast<uint8_t>(rhs.ems));
return *this;
}

friend FMT_CONSTEXPR_DECL text_style
fg(detail::color_type foreground) noexcept;

Expand Down Expand Up @@ -679,8 +637,8 @@ struct formatter<detail::styled_arg<T>, Char> : formatter<T, Char> {
**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 <typename T>
FMT_CONSTEXPR auto styled(const T& value, text_style ts)
Expand Down
9 changes: 1 addition & 8 deletions include/fmt/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,8 @@ template <typename T, typename Char>
struct fallback_formatter<T, Char, enable_if_t<is_streamable<T, Char>::value>>
: basic_ostream_formatter<Char> {
using basic_ostream_formatter<Char>::format;
// DEPRECATED!
template <typename OutputIt>
auto format(const T& value, basic_printf_context<OutputIt, Char>& ctx) const
-> OutputIt {
auto buffer = basic_memory_buffer<Char>();
format_value(buffer, value, ctx.locale());
return std::copy(buffer.begin(), buffer.end(), ctx.out());
}
};

} // namespace detail

FMT_MODULE_EXPORT
Expand Down
5 changes: 0 additions & 5 deletions include/fmt/ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,8 @@ struct formatter<
template <typename FormatContext>
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<R>::value ? '{' : '[';
Char postfix = detail::is_set<R>::value ? '}' : ']';
#endif
detail::range_mapper<buffer_context<Char>> mapper;
auto out = ctx.out();
*out++ = prefix;
Expand Down
10 changes: 0 additions & 10 deletions include/fmt/xchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ inline auto format_to(OutputIt out, const S& fmt, Args&&... args) -> OutputIt {
fmt::make_format_args<buffer_context<Char>>(args...));
}

template <typename S, typename... Args, typename Char, size_t SIZE,
typename Allocator, FMT_ENABLE_IF(detail::is_string<S>::value)>
FMT_DEPRECATED auto format_to(basic_memory_buffer<Char, SIZE, Allocator>& buf,
const S& format_str, Args&&... args) ->
typename buffer_context<Char>::iterator {
detail::vformat_to(buf, to_string_view(format_str),
fmt::make_format_args<buffer_context<Char>>(args...), {});
return detail::buffer_appender<Char>(buf);
}

template <typename Locale, typename S, typename OutputIt, typename... Args,
typename Char = char_t<S>,
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value&&
Expand Down

0 comments on commit edeb3d8

Please sign in to comment.