Go to the documentation of this file.
15 # include <ext/stdio_filebuf.h>
16 # include <ext/stdio_sync_filebuf.h>
26 template <
typename Streambuf>
class formatbuf :
public Streambuf {
29 using streamsize = decltype(std::declval<Streambuf>().sputn(
nullptr, 0));
46 if (!traits_type::eq_int_type(ch, traits_type::eof()))
60 struct file_access_tag {};
62 template <
typename Tag,
typename BufType, FILE* BufType::*FileMemberPtr>
64 friend auto get_file(BufType& obj) -> FILE* {
return obj.*FileMemberPtr; }
68 template class file_access<file_access_tag, std::filebuf,
69 &std::filebuf::_Myfile>;
70 auto get_file(std::filebuf&) -> FILE*;
77 if (
auto* buf =
dynamic_cast<std::filebuf*
>(os.rdbuf()))
81 #elif defined(_WIN32) && defined(__GLIBCXX__)
82 auto* rdbuf = os.rdbuf();
83 if (
auto* sfbuf =
dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char>*
>(rdbuf))
85 else if (
auto* fbuf =
dynamic_cast<__gnu_cxx::stdio_filebuf<char>*
>(rdbuf))
104 fmt::basic_string_view<wchar_t>) ->
bool {
110 template <
typename Char>
112 const Char* buf_data = buf.
data();
114 unsigned_streamsize
size = buf.
size();
115 unsigned_streamsize max_size =
to_unsigned(max_value<std::streamsize>());
117 unsigned_streamsize n =
size <= max_size ?
size : max_size;
118 os.write(buf_data,
static_cast<std::streamsize
>(n));
124 template <
typename Char,
typename T>
127 auto&&
output = std::basic_ostream<Char>(&format_buf);
128 #if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
129 output.imbue(std::locale::classic());
132 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
142 template <
typename Char>
146 template <
typename T,
typename OutputIt>
152 {buffer.data(), buffer.size()}, ctx);
158 template <
typename T,
typename Char>
161 template <
typename OutputIt>
178 template <
typename T>
195 void vprint(std::basic_ostream<Char>& os,
223 template <
typename... Args>
236 template <
typename... Args>
245 #endif // FMT_OSTREAM_H_
FMT_CONSTEXPR void ignore_unused(const T &...)
friend auto get_file(BufType &obj) -> FILE *
FMT_CONSTEXPR20 void push_back(const T &value)
void vprint_directly(std::ostream &os, string_view format_str, format_args args)
constexpr auto size() const noexcept -> size_t
constexpr auto streamed(const T &value) -> detail::streamed_view< T >
void format_value(buffer< Char > &buf, const T &value)
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
void append(const U *begin, const U *end)
FMT_CONSTEXPR auto data() noexcept -> T *
span_constexpr std::size_t size(span< T, Extent > const &spn)
constexpr auto count() -> size_t
static const char * output
#define FMT_END_NAMESPACE
auto write_ostream_unicode(std::ostream &os, fmt::string_view data) -> bool
constexpr auto make_format_args(T &... args) -> format_arg_store< Context, remove_cvref_t< T >... >
typename type_identity< T >::type type_identity_t
FMT_EXPORT void vprint(std::basic_ostream< Char > &os, basic_string_view< type_identity_t< Char >> format_str, basic_format_args< buffer_context< type_identity_t< Char >>> args)
auto format(const text_style &ts, const S &format_str, const Args &... args) -> std::basic_string< Char >
basic_string_view< char > string_view
FMT_EXPORT void println(std::ostream &os, format_string< T... > fmt, T &&... args)
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)
#define FMT_BEGIN_NAMESPACE
FMT_EXPORT void print(std::ostream &os, format_string< T... > fmt, T &&... args)
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
FMT_CONSTEXPR auto is_utf8() -> bool
FMT_FUNC auto write_console(int, string_view) -> bool
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45