Replace comments regarding deprecation with attributes
This commit is contained in:
parent
3f52336e6c
commit
34951f1999
@ -15,21 +15,33 @@ FMT_BEGIN_NAMESPACE
|
|||||||
#ifdef FMT_DEPRECATED_COLORS
|
#ifdef FMT_DEPRECATED_COLORS
|
||||||
|
|
||||||
// color and (v)print_colored are deprecated.
|
// color and (v)print_colored are deprecated.
|
||||||
enum color { black, red, green, yellow, blue, magenta, cyan, white };
|
enum FMT_DEPRECATED color {
|
||||||
FMT_API void vprint_colored(color c, string_view format, format_args args);
|
black,
|
||||||
FMT_API void vprint_colored(color c, wstring_view format, wformat_args args);
|
red,
|
||||||
|
green,
|
||||||
|
yellow,
|
||||||
|
blue,
|
||||||
|
magenta,
|
||||||
|
cyan,
|
||||||
|
white
|
||||||
|
};
|
||||||
|
FMT_DEPRECATED FMT_API void vprint_colored(color c, string_view format,
|
||||||
|
format_args args);
|
||||||
|
FMT_DEPRECATED FMT_API void vprint_colored(color c, wstring_view format,
|
||||||
|
wformat_args args);
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline void print_colored(color c, string_view format_str,
|
FMT_DEPRECATED inline void print_colored(color c, string_view format_str,
|
||||||
const Args&... args) {
|
const Args&... args) {
|
||||||
vprint_colored(c, format_str, make_format_args(args...));
|
vprint_colored(c, format_str, make_format_args(args...));
|
||||||
}
|
}
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline void print_colored(color c, wstring_view format_str,
|
FMT_DEPRECATED inline void print_colored(color c, wstring_view format_str,
|
||||||
const Args&... args) {
|
const Args&... args) {
|
||||||
vprint_colored(c, format_str, make_format_args<wformat_context>(args...));
|
vprint_colored(c, format_str, make_format_args<wformat_context>(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void vprint_colored(color c, string_view format, format_args args) {
|
FMT_DEPRECATED inline void vprint_colored(color c, string_view format,
|
||||||
|
format_args args) {
|
||||||
char escape[] = "\x1b[30m";
|
char escape[] = "\x1b[30m";
|
||||||
escape[3] = static_cast<char>('0' + c);
|
escape[3] = static_cast<char>('0' + c);
|
||||||
std::fputs(escape, stdout);
|
std::fputs(escape, stdout);
|
||||||
@ -37,7 +49,8 @@ inline void vprint_colored(color c, string_view format, format_args args) {
|
|||||||
std::fputs(internal::data::RESET_COLOR, stdout);
|
std::fputs(internal::data::RESET_COLOR, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void vprint_colored(color c, wstring_view format, wformat_args args) {
|
FMT_DEPRECATED inline void vprint_colored(color c, wstring_view format,
|
||||||
|
wformat_args args) {
|
||||||
wchar_t escape[] = L"\x1b[30m";
|
wchar_t escape[] = L"\x1b[30m";
|
||||||
escape[3] = static_cast<wchar_t>('0' + c);
|
escape[3] = static_cast<wchar_t>('0' + c);
|
||||||
std::fputws(escape, stdout);
|
std::fputws(escape, stdout);
|
||||||
|
@ -143,6 +143,21 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_DEPRECATED
|
||||||
|
# if (FMT_HAS_CPP_ATTRIBUTE(deprecated) && __cplusplus >= 201402L) || \
|
||||||
|
FMT_MSC_VER >= 1900
|
||||||
|
# define FMT_DEPRECATED [[deprecated]]
|
||||||
|
# else
|
||||||
|
# if defined(__GNUC__) || defined(__clang__)
|
||||||
|
# define FMT_DEPRECATED __attribute__((deprecated))
|
||||||
|
# elif FMT_MSC_VER
|
||||||
|
# define FMT_DEPRECATED __declspec(deprecated)
|
||||||
|
# else
|
||||||
|
# define FMT_DEPRECATED /*deprecated*/
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FMT_BEGIN_NAMESPACE
|
#ifndef FMT_BEGIN_NAMESPACE
|
||||||
# if FMT_HAS_FEATURE(cxx_inline_namespaces) || FMT_GCC_VERSION >= 404 || \
|
# if FMT_HAS_FEATURE(cxx_inline_namespaces) || FMT_GCC_VERSION >= 404 || \
|
||||||
FMT_MSC_VER >= 1900
|
FMT_MSC_VER >= 1900
|
||||||
@ -911,10 +926,9 @@ FMT_CONSTEXPR typename internal::result_of<Visitor(int)>::type visit_format_arg(
|
|||||||
return vis(monostate());
|
return vis(monostate());
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED!
|
|
||||||
template <typename Visitor, typename Context>
|
template <typename Visitor, typename Context>
|
||||||
FMT_CONSTEXPR typename internal::result_of<Visitor(int)>::type visit(
|
FMT_DEPRECATED FMT_CONSTEXPR typename internal::result_of<Visitor(int)>::type
|
||||||
Visitor&& vis, const basic_format_arg<Context>& arg) {
|
visit(Visitor&& vis, const basic_format_arg<Context>& arg) {
|
||||||
return visit_format_arg(std::forward<Visitor>(vis), arg);
|
return visit_format_arg(std::forward<Visitor>(vis), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -972,9 +986,8 @@ class basic_parse_context : private ErrorHandler {
|
|||||||
typedef basic_parse_context<char> format_parse_context;
|
typedef basic_parse_context<char> format_parse_context;
|
||||||
typedef basic_parse_context<wchar_t> wformat_parse_context;
|
typedef basic_parse_context<wchar_t> wformat_parse_context;
|
||||||
|
|
||||||
// DEPRECATED!
|
FMT_DEPRECATED typedef basic_parse_context<char> parse_context;
|
||||||
typedef basic_parse_context<char> parse_context;
|
FMT_DEPRECATED typedef basic_parse_context<wchar_t> wparse_context;
|
||||||
typedef basic_parse_context<wchar_t> wparse_context;
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
// A map from argument names to their values for named arguments.
|
// A map from argument names to their values for named arguments.
|
||||||
@ -1063,7 +1076,7 @@ class context_base {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
basic_parse_context<char_type>& parse_context() { return parse_context_; }
|
basic_parse_context<char_type>& parse_context() { return parse_context_; }
|
||||||
basic_format_args<Context> args() const { return args_; } // DEPRECATED!
|
FMT_DEPRECATED basic_format_args<Context> args() const { return args_; }
|
||||||
basic_format_arg<Context> arg(unsigned id) const { return args_.get(id); }
|
basic_format_arg<Context> arg(unsigned id) const { return args_.get(id); }
|
||||||
|
|
||||||
internal::error_handler error_handler() {
|
internal::error_handler error_handler() {
|
||||||
@ -1074,7 +1087,7 @@ class context_base {
|
|||||||
|
|
||||||
// Returns an iterator to the beginning of the output range.
|
// Returns an iterator to the beginning of the output range.
|
||||||
iterator out() { return out_; }
|
iterator out() { return out_; }
|
||||||
iterator begin() { return out_; } // deprecated
|
FMT_DEPRECATED iterator begin() { return out_; }
|
||||||
|
|
||||||
// Advances the begin iterator to ``it``.
|
// Advances the begin iterator to ``it``.
|
||||||
void advance_to(iterator it) { out_ = it; }
|
void advance_to(iterator it) { out_ = it; }
|
||||||
@ -1163,9 +1176,10 @@ class basic_format_context
|
|||||||
// specified name.
|
// specified name.
|
||||||
format_arg arg(basic_string_view<char_type> name);
|
format_arg arg(basic_string_view<char_type> name);
|
||||||
|
|
||||||
// DEPRECATED!
|
FMT_DEPRECATED format_arg get_arg(unsigned arg_id) { return arg(arg_id); }
|
||||||
format_arg get_arg(unsigned arg_id) { return arg(arg_id); }
|
FMT_DEPRECATED format_arg get_arg(basic_string_view<char_type> name) {
|
||||||
format_arg get_arg(basic_string_view<char_type> name) { return arg(name); }
|
return arg(name);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Char> struct buffer_context {
|
template <typename Char> struct buffer_context {
|
||||||
|
@ -2222,8 +2222,7 @@ class arg_formatter
|
|||||||
explicit arg_formatter(context_type& ctx, format_specs* spec = FMT_NULL)
|
explicit arg_formatter(context_type& ctx, format_specs* spec = FMT_NULL)
|
||||||
: base(Range(ctx.out()), spec, ctx.locale()), ctx_(ctx) {}
|
: base(Range(ctx.out()), spec, ctx.locale()), ctx_(ctx) {}
|
||||||
|
|
||||||
// Deprecated.
|
FMT_DEPRECATED arg_formatter(context_type& ctx, format_specs& spec)
|
||||||
arg_formatter(context_type& ctx, format_specs& spec)
|
|
||||||
: base(Range(ctx.out()), &spec), ctx_(ctx) {}
|
: base(Range(ctx.out()), &spec), ctx_(ctx) {}
|
||||||
|
|
||||||
using base::operator();
|
using base::operator();
|
||||||
@ -2892,11 +2891,11 @@ class format_int {
|
|||||||
std::string str() const { return std::string(str_, size()); }
|
std::string str() const { return std::string(str_, size()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// DEPRECATED!
|
|
||||||
// Formats a decimal integer value writing into buffer and returns
|
// Formats a decimal integer value writing into buffer and returns
|
||||||
// a pointer to the end of the formatted string. This function doesn't
|
// a pointer to the end of the formatted string. This function doesn't
|
||||||
// write a terminating null character.
|
// write a terminating null character.
|
||||||
template <typename T> inline void format_decimal(char*& buffer, T value) {
|
template <typename T>
|
||||||
|
FMT_DEPRECATED inline void format_decimal(char*& buffer, T value) {
|
||||||
typedef typename internal::int_traits<T>::main_type main_type;
|
typedef typename internal::int_traits<T>::main_type main_type;
|
||||||
main_type abs_value = static_cast<main_type>(value);
|
main_type abs_value = static_cast<main_type>(value);
|
||||||
if (internal::is_negative(value)) {
|
if (internal::is_negative(value)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user