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>()),
90 static const bool value = result::value;
94 template <
typename Char>
96 const Char* buf_data = buf.
data();
98 unsigned_streamsize
size = buf.
size();
99 unsigned_streamsize max_size =
to_unsigned(max_value<std::streamsize>());
101 unsigned_streamsize n = size <= max_size ?
size : max_size;
102 os.write(buf_data, static_cast<std::streamsize>(n));
108 template <
typename Char,
typename T>
112 std::basic_ostream<Char>
output(&format_buf);
113 #if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) 114 if (loc) output.imbue(loc.get<std::locale>());
117 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
122 template <
typename T,
typename Char>
124 :
private formatter<basic_string_view<Char>, Char> {
126 -> decltype(ctx.begin()) {
129 template <
typename ParseCtx,
132 auto parse(ParseCtx& ctx) -> decltype(ctx.begin()) {
136 template <
typename OutputIt>
144 template <
typename OutputIt>
149 return std::copy(buffer.begin(), buffer.end(), ctx.out());
155 template <
typename Char>
173 template <
typename S,
typename... Args,
175 void print(std::basic_ostream<Char>& os,
const S& format_str, Args&&...
args) {
177 fmt::make_args_checked<Args...>(format_str,
args...));
181 #endif // FMT_OSTREAM_H_ FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
#define FMT_ENABLE_IF(...)
typename detail::char_t_impl< S >::type char_t
void_t operator<<(std::basic_ostream< Char, Traits > &, Char)
void push_back(const T &value)
#define FMT_END_NAMESPACE
FMT_MODULE_EXPORT void vprint(std::basic_ostream< Char > &os, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char >>> args)
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
integral_constant< bool, false > false_type
OutputIterator copy(const RangeT &range, OutputIterator out)
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
constexpr auto count() -> size_t
FMT_FUNC void print(std::FILE *f, string_view text)
void try_resize(size_t count)
void format_value(buffer< Char > &buf, const T &value, locale_ref loc=locale_ref())
typename type_identity< T >::type type_identity_t
auto size() const FMT_NOEXCEPT -> size_t
typename std::enable_if< B, T >::type enable_if_t
span_constexpr std::size_t size(span< T, Extent > const &spn)
static const char * output
#define FMT_BEGIN_NAMESPACE
void append(const U *begin, const U *end)
decltype(test< T >(0)) result
#define FMT_MODULE_EXPORT
std::integral_constant< bool, B > bool_constant
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)
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
auto data() FMT_NOEXCEPT -> T *