22 template <
class Char>
class formatbuf :
public std::basic_streambuf<Char> {
24 using int_type =
typename std::basic_streambuf<Char>::int_type;
25 using traits_type =
typename std::basic_streambuf<Char>::traits_type;
41 if (!traits_type::eq_int_type(ch, traits_type::eof()))
53 template <typename T, FMT_ENABLE_IF(is_integral<T>::value)>
converter(T);
56 template <
typename Char>
struct test_stream : std::basic_ostream<Char> {
62 template <
typename Char,
typename Traits>
63 void_t<> operator<<(std::basic_ostream<Char, Traits>&, Char);
64 template <
typename Char,
typename Traits>
65 void_t<> operator<<(std::basic_ostream<Char, Traits>&, char);
66 template <
typename Traits>
67 void_t<> operator<<(std::basic_ostream<char, Traits>&, char);
68 template <
typename Traits>
69 void_t<> operator<<(std::basic_ostream<char, Traits>&,
signed char);
70 template <
typename Traits>
71 void_t<> operator<<(std::basic_ostream<char, Traits>&,
unsigned char);
79 << std::declval<U>()),
83 template <
typename>
static std::false_type test(...);
88 static const bool value = result::value;
92 template <
typename Char>
94 const Char* buf_data = buf.
data();
96 unsigned_streamsize size = buf.
size();
97 unsigned_streamsize max_size =
to_unsigned(max_value<std::streamsize>());
99 unsigned_streamsize n = size <= max_size ? size : max_size;
100 os.write(buf_data, static_cast<std::streamsize>(n));
106 template <
typename Char,
typename T>
110 std::basic_ostream<Char> output(&format_buf);
111 #if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) 112 if (loc) output.imbue(loc.get<std::locale>());
115 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
120 template <
typename T,
typename Char>
122 :
private formatter<basic_string_view<Char>, Char> {
124 -> decltype(ctx.begin()) {
127 template <
typename ParseCtx,
130 auto parse(ParseCtx& ctx) -> decltype(ctx.begin()) {
134 template <
typename OutputIt>
142 template <
typename OutputIt>
152 template <
typename Char>
169 template <
typename S,
typename... Args,
171 void print(std::basic_ostream<Char>& os,
const S& format_str, Args&&... args) {
173 fmt::make_args_checked<Args...>(format_str, args...));
177 #endif // FMT_OSTREAM_H_
#define FMT_BEGIN_NAMESPACE
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
void_t operator<<(std::basic_ostream< Char, Traits > &, Char)
void vformat_to(buffer< Char > &buf, const text_style &ts, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char >>> args)
void push_back(const T &value)
typename type_identity< T >::type type_identity_t
void print(std::basic_ostream< Char > &os, const S &format_str, Args &&... args)
FMT_CONSTEXPR std::make_unsigned< Int >::type to_unsigned(Int value)
void format_value(buffer< Char > &buf, const T &value, locale_ref loc=locale_ref())
decltype(test< T >(0)) result
#define FMT_END_NAMESPACE
OutputIterator copy(const RangeT &range, OutputIterator out)
typename std::enable_if< B, T >::type enable_if_t
#define FMT_ENABLE_IF(...)
typename detail::char_t_impl< S >::type char_t
size_t size() const FMT_NOEXCEPT
std::integral_constant< bool, B > bool_constant
void try_resize(size_t count)
typename detail::void_t_impl< Ts... >::type void_t
void vprint(std::basic_ostream< Char > &os, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char >>> args)
void append(const U *begin, const U *end)
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)