10 #ifndef FMT_OSTREAM_H_ 11 #define FMT_OSTREAM_H_ 21 class FormatBuf :
public std::basic_streambuf<Char> {
23 typedef typename std::basic_streambuf<Char>::int_type
int_type;
24 typedef typename std::basic_streambuf<Char>::traits_type
traits_type;
39 if (!traits_type::eq_int_type(ch, traits_type::eof())) {
40 size_t buf_size =
size();
45 start_[buf_size] = traits_type::to_char_type(ch);
61 void operator<<(Null<>);
77 #if FMT_HAS_DECLTYPE_INCOMPLETE_RETURN_TYPES 81 static auto test(
int) -> decltype(std::declval<std::ostream &>() << std::declval<U>(), std::true_type());
84 static auto test(...) -> std::false_type;
87 static constexpr
bool value = decltype(test<T>(0))::value;
93 template <
typename Char,
typename ArgFormatter_,
typename T>
95 const Char *&format_str,
const T &value) {
99 std::basic_ostream<Char> output(&format_buf);
104 format_str = f.
format(format_str, MakeArg(str));
119 #if __cplusplus >= 201103L 120 template<
typename T,
typename Char>
121 typename std::enable_if<
128 operator<<(BasicWriter<Char> &writer,
const T &value) {
131 auto &buffer = writer.buffer();
132 Char *start = &buffer[0] + buffer.size();
134 internal::FormatBuf<Char> format_buf(buffer, start);
135 std::basic_ostream<Char> output(&format_buf);
138 buffer.resize(buffer.size() + format_buf.size());
144 #ifdef FMT_HEADER_ONLY 148 #endif // FMT_OSTREAM_H_
const uint32_t T[512]
Definition: groestl_tables.h:34
void resize(std::size_t new_size)
Definition: format.h:700
void format_arg(fmt::BasicFormatter< Char, ArgFormatter > &f, const Char *&format_str, const ArgJoin< Char, It > &e)
Definition: format.h:3917
char Yes[1]
Definition: format.h:1154
FMT_FUNC void write(std::ostream &os, Writer &w)
Definition: ostream.cc:15
Definition: format.h:1166
Yes & convert(fmt::ULongLong)
BasicCStringRef< char > CStringRef
Definition: format.h:610
Definition: format.h:1165
MakeUnsigned< Int >::Type to_unsigned(Int value)
Definition: format.h:641
std::size_t capacity() const
Definition: format.h:695
type
Definition: json.h:74
No & operator<<(std::ostream &, int)
char No[2]
Definition: format.h:1155
FMT_FUNC void print(std::FILE *f, CStringRef format_str, ArgList args)
Definition: format.cc:486
void reserve(std::size_t capacity)
Definition: format.h:711
Definition: format.h:1429
#define true
Definition: stdbool.h:37