mirror of
https://github.com/fmtlib/fmt.git
synced 2025-08-01 03:34:45 +02:00
Privatize write_debug_string
This commit is contained in:
@@ -406,6 +406,23 @@ struct range_formatter<
|
|||||||
detail::string_literal<Char, ']'>{};
|
detail::string_literal<Char, ']'>{};
|
||||||
bool is_debug = false;
|
bool is_debug = false;
|
||||||
|
|
||||||
|
template <typename Output, typename It, typename Sentinel, typename U = T,
|
||||||
|
FMT_ENABLE_IF(std::is_same<U, Char>::value)>
|
||||||
|
auto write_debug_string(Output& out, It it, Sentinel end) const -> Output {
|
||||||
|
auto buf = basic_memory_buffer<Char>();
|
||||||
|
for (; it != end; ++it) buf.push_back(*it);
|
||||||
|
auto specs = format_specs();
|
||||||
|
specs.type = presentation_type::debug;
|
||||||
|
return detail::write<Char>(
|
||||||
|
out, basic_string_view<Char>(buf.data(), buf.size()), specs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Output, typename It, typename Sentinel, typename U = T,
|
||||||
|
FMT_ENABLE_IF(!std::is_same<U, Char>::value)>
|
||||||
|
auto write_debug_string(Output& out, It, Sentinel) const -> Output {
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FMT_CONSTEXPR range_formatter() {}
|
FMT_CONSTEXPR range_formatter() {}
|
||||||
|
|
||||||
@@ -464,22 +481,6 @@ struct range_formatter<
|
|||||||
return underlying_.parse(ctx);
|
return underlying_.parse(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Output, typename It, typename Sentinel, typename U = T,
|
|
||||||
FMT_ENABLE_IF(std::is_same<U, Char>::value)>
|
|
||||||
auto write_debug_string(Output& out, It it, Sentinel end) const -> Output {
|
|
||||||
auto buf = basic_memory_buffer<Char>();
|
|
||||||
for (; it != end; ++it) buf.push_back(*it);
|
|
||||||
auto specs = format_specs();
|
|
||||||
specs.type = presentation_type::debug;
|
|
||||||
return detail::write<Char>(
|
|
||||||
out, basic_string_view<Char>(buf.data(), buf.size()), specs);
|
|
||||||
}
|
|
||||||
template <typename Output, typename It, typename Sentinel, typename U = T,
|
|
||||||
FMT_ENABLE_IF(!std::is_same<U, Char>::value)>
|
|
||||||
auto write_debug_string(Output& out, It, Sentinel) const -> Output {
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename R, typename FormatContext>
|
template <typename R, typename FormatContext>
|
||||||
auto format(R&& range, FormatContext& ctx) const -> decltype(ctx.out()) {
|
auto format(R&& range, FormatContext& ctx) const -> decltype(ctx.out()) {
|
||||||
detail::range_mapper<buffered_context<Char>> mapper;
|
detail::range_mapper<buffered_context<Char>> mapper;
|
||||||
|
Reference in New Issue
Block a user