13#if defined(_WIN32) && defined(__GLIBCXX__)
14# include <ext/stdio_filebuf.h>
15# include <ext/stdio_sync_filebuf.h>
16#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
17# include <__std_stream>
29struct file_access_tag {};
31template <
typename Tag,
typename BufType, FILE* BufType::*FileMemberPtr>
33 friend auto get_file(BufType& obj) -> FILE* {
return obj.*FileMemberPtr; }
37template class file_access<file_access_tag, std::filebuf,
38 &std::filebuf::_Myfile>;
39auto get_file(std::filebuf&) -> FILE*;
40#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
41template class file_access<file_access_tag, std::__stdoutbuf<char>,
42 &std::__stdoutbuf<char>::__file_>;
43auto get_file(std::__stdoutbuf<char>&) -> FILE*;
48 if (
auto* buf =
dynamic_cast<std::filebuf*
>(os.rdbuf()))
50#elif defined(_WIN32) && defined(__GLIBCXX__)
51 auto* rdbuf = os.rdbuf();
53 if (
auto* sfbuf =
dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char>*
>(rdbuf))
54 c_file = sfbuf->file();
55 else if (
auto* fbuf =
dynamic_cast<__gnu_cxx::stdio_filebuf<char>*
>(rdbuf))
56 c_file = fbuf->file();
60#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
61 if (
auto* buf =
dynamic_cast<std::__stdoutbuf<char>*
>(os.rdbuf()))
69 fmt::basic_string_view<wchar_t>) {
75template <
typename Char>
77 const Char* buf_data = buf.
data();
79 unsigned_streamsize size = buf.
size();
80 unsigned_streamsize max_size =
to_unsigned(max_value<std::streamsize>());
82 unsigned_streamsize n = size <= max_size ? size : max_size;
83 os.write(buf_data,
static_cast<std::streamsize
>(n));
89template <
typename Char,
typename T>
93 auto&& output = std::basic_ostream<Char>(&format_buf);
94#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
95 if (loc) output.imbue(loc.get<std::locale>());
98 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
106template <
typename Char>
110 template <
typename T,
typename OutputIt>
116 {buffer.data(), buffer.size()}, ctx);
122template <
typename T,
typename Char>
125 template <
typename OutputIt>
187template <
typename... Args>
200template <
typename... Args>
\rst A dynamically growing memory buffer for trivially copyable/constructible types with the first SI...
Definition: format.h:918
\rst A contiguous memory buffer with an optional growing ability.
Definition: core.h:798
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition: core.h:838
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition: core.h:844
friend auto get_file(BufType &obj) -> FILE *
Definition: ostream.h:33
basic_string_view< char > string_view
Definition: core.h:501
#define FMT_BEGIN_NAMESPACE
Definition: core.h:174
constexpr auto make_format_args(T &... args) -> format_arg_store< Context, remove_cvref_t< T >... >
\rst Constructs a ~fmtformat_arg_store object that contains references to arguments and can be implic...
Definition: core.h:1824
typename type_identity< T >::type type_identity_t
Definition: core.h:267
#define FMT_END_NAMESPACE
Definition: core.h:177
#define FMT_EXPORT
Definition: core.h:183
detail namespace with internal helper functions
Definition: xchar.h:20
FMT_FUNC bool write_console(std::FILE *, string_view)
Definition: format-inl.h:1428
bool write_ostream_unicode(std::ostream &os, fmt::string_view data)
Definition: ostream.h:46
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition: core.h:302
void vprint_directly(std::ostream &os, string_view format_str, format_args args)
Definition: ostream.h:149
void format_value(buffer< Char > &buf, const T &value, locale_ref loc=locale_ref())
Definition: ostream.h:90
FMT_CONSTEXPR auto is_utf8() -> bool
Definition: core.h:380
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
Definition: ostream.h:76
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)
Definition: color.h:436
type
Definition: core.h:556
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:374
cubed< length::millimeter > L
Definition: volume.h:49
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)
Definition: ostream.h:159
FMT_EXPORT void println(std::ostream &os, format_string< T... > fmt, T &&... args)
Definition: ostream.h:195
auto streamed(const T &value) -> detail::streamed_view< T >
\rst Returns a view that formats value via an ostream operator<<.
Definition: ostream.h:143
FMT_EXPORT void print(std::ostream &os, format_string< T... > fmt, T &&... args)
\rst Prints formatted data to the stream os.
Definition: ostream.h:178
Definition: format.h:1762
Definition: ostream.h:101
const T & value
Definition: ostream.h:101
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition: xchar.h:108