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>
29template <
typename T,
typename Char,
typename Enable =
void>
34 ->
bool_constant<
sizeof(std::declval<std::basic_ostream<Char>&>()
35 << std::declval<U>()) != 0>;
37 template <
typename>
static auto test(...) -> std::false_type;
39 using result =
decltype(test<T>(0));
44 static const bool value = result::value;
49template <
typename T,
typename Char>
55 std::is_convertible<T, fmt::basic_string_view<Char>>
::value ||
56 std::is_same<T, std_string_view<Char>>
::value ||
57 (std::is_convertible<T, int>::value && !std::is_enum<T>::value)>>
63struct file_access_tag {};
65template <
class Tag,
class BufType, FILE* BufType::*FileMemberPtr>
67 friend auto get_file(BufType& obj) -> FILE* {
return obj.*FileMemberPtr; }
71template class file_access<file_access_tag, std::filebuf,
72 &std::filebuf::_Myfile>;
73auto get_file(std::filebuf&) -> FILE*;
74#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
75template class file_access<file_access_tag, std::__stdoutbuf<char>,
76 &std::__stdoutbuf<char>::__file_>;
77auto get_file(std::__stdoutbuf<char>&) -> FILE*;
82 if (
auto* buf =
dynamic_cast<std::filebuf*
>(os.rdbuf()))
83 if (FILE* f = get_file(*buf))
return write_console(f,
data);
84#elif defined(_WIN32) && defined(__GLIBCXX__)
85 auto* rdbuf = os.rdbuf();
87 if (
auto* fbuf =
dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char>*
>(rdbuf))
88 c_file = fbuf->file();
89 else if (
auto* fbuf =
dynamic_cast<__gnu_cxx::stdio_filebuf<char>*
>(rdbuf))
90 c_file = fbuf->file();
93 if (c_file)
return write_console(c_file,
data);
94#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
95 if (
auto* buf =
dynamic_cast<std::__stdoutbuf<char>*
>(os.rdbuf()))
96 if (FILE* f = get_file(*buf))
return write_console(f,
data);
103 fmt::basic_string_view<wchar_t>) {
109template <
typename Char>
111 const Char* buf_data = buf.data();
113 unsigned_streamsize
size = buf.size();
114 unsigned_streamsize max_size =
to_unsigned(max_value<std::streamsize>());
116 unsigned_streamsize n =
size <= max_size ?
size : max_size;
117 os.write(buf_data,
static_cast<std::streamsize
>(n));
123template <
typename Char,
typename T>
127 auto&& output = std::basic_ostream<Char>(&format_buf);
128#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
129 if (loc) output.imbue(loc.get<std::locale>());
132 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
140template <
typename Char>
144 template <
typename T,
typename OutputIt>
156template <
typename T,
typename Char>
159 template <
typename OutputIt>
184template <
typename T,
typename Char>
228template <
typename... Args>
\rst A dynamically growing memory buffer for trivially copyable/constructible types with the first SI...
Definition: format.h:819
\rst A contiguous memory buffer with an optional growing ability.
Definition: core.h:862
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data.
Definition: core.h:908
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition: core.h:902
friend auto get_file(BufType &obj) -> FILE *
Definition: ostream.h:67
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:298
std::integral_constant< bool, B > bool_constant
Definition: core.h:301
basic_string_view< char > string_view
Definition: core.h:520
constexpr auto make_format_args(Args &&... args) -> format_arg_store< Context, remove_cvref_t< Args >... >
\rst Constructs a ~fmtformat_arg_store object that contains references to arguments and can be implic...
Definition: core.h:1923
type
Definition: core.h:575
#define FMT_BEGIN_NAMESPACE
Definition: core.h:214
#define FMT_MODULE_EXPORT
Definition: core.h:223
FMT_BEGIN_DETAIL_NAMESPACE FMT_CONSTEXPR void ignore_unused(const T &...)
Definition: core.h:343
constexpr auto is_utf8() -> bool
Definition: core.h:415
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:407
typename type_identity< T >::type type_identity_t
Definition: core.h:309
#define FMT_END_NAMESPACE
Definition: core.h:217
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Definition: format-inl.h:32
bool write_ostream_unicode(std::ostream &os, fmt::string_view data)
Definition: ostream.h:80
void vprint_directly(std::ostream &os, string_view format_str, format_args args)
Definition: ostream.h:190
void format_value(buffer< Char > &buf, const T &value, locale_ref loc=locale_ref())
Definition: ostream.h:124
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
Definition: ostream.h:110
Definition: BFloat16.h:88
auto streamed(const T &value) -> detail::streamed_view< T >
\rst Returns a view that formats value via an ostream operator<<.
Definition: ostream.h:177
FMT_MODULE_EXPORT void print(std::ostream &os, format_string< T... > fmt, T &&... args)
\rst Prints formatted data to the stream os.
Definition: ostream.h:219
FMT_MODULE_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:200
Definition: format.h:1552
Definition: ostream.h:135
const T & value
Definition: ostream.h:135
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition: xchar.h:87
auto vformat_to(OutputIt out, const S &format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args) -> OutputIt
Definition: xchar.h:124