28 #ifndef FMT_OSTREAM_H_
29 #define FMT_OSTREAM_H_
39 class FormatBuf :
public std::basic_streambuf<Char> {
41 typedef typename std::basic_streambuf<Char>::int_type int_type;
42 typedef typename std::basic_streambuf<Char>::traits_type traits_type;
49 this->setp(start_, start_ + buffer_.
capacity());
52 int_type overflow(int_type ch = traits_type::eof()) {
53 if (!traits_type::eq_int_type(ch, traits_type::eof())) {
54 size_t buf_size = size();
59 start_[buf_size] = traits_type::to_char_type(ch);
60 this->setp(start_+ buf_size + 1, start_ + buf_size * 2);
66 return to_unsigned(this->pptr() - start_);
70 Yes &convert(std::ostream &);
75 void operator<<(Null<>);
78 No &operator<<(std::ostream &,
int);
84 value =
sizeof(convert(get<DummyStream>() << get<T>())) ==
sizeof(No)
90 template <
typename Char,
typename ArgFormatter,
typename T>
92 const Char *&format_str,
const T &value) {
96 std::basic_ostream<Char> output(&format_buf);
101 format_str = f.
format(format_str, MakeArg(str));
113 FMT_API
void print(std::ostream &os, CStringRef format_str, ArgList args);
114 FMT_VARIADIC(
void, print, std::ostream &, CStringRef)
125 FMT_API
int fprintf(std::ostream &os, CStringRef format_str, ArgList args);
126 FMT_VARIADIC(
int, fprintf, std::ostream &, CStringRef)
129 #ifdef FMT_HEADER_ONLY
130 # include "ostream.cc"
133 #endif // FMT_OSTREAM_H_
Definition: format.h:1059
Definition: format.h:1268
void reserve(std::size_t capacity)
Definition: format.h:628
std::size_t capacity() const
Definition: format.h:612
void resize(std::size_t new_size)
Definition: format.h:617
std::size_t size() const
Definition: format.h:609