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>
24template <
typename OutputIt,
typename Char>
31 template <
typename T,
typename Char,
typename Enable =
void>
37 ->
bool_constant<
sizeof(std::declval<std::basic_ostream<Char>&>()
38 << std::declval<U>()) != 0>;
41 static auto test(...) -> std::false_type;
48 static const bool value = result::value;
53 template <
typename T,
typename Char>
60 std::is_convertible<T, fmt::basic_string_view<Char>>
::value ||
61 std::is_same<T, std_string_view<Char>>
::value ||
62 (std::is_convertible<T, int>::value && !std::is_enum<T>::value)>>
71 struct file_access_tag
75 template <
class Tag,
class BufType, FILE* BufType::*FileMemberPtr>
80 return obj.*FileMemberPtr;
85 template class file_access<file_access_tag, std::filebuf, &std::filebuf::_Myfile>;
86 auto get_file(std::filebuf&) -> FILE*;
87#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
88 template class file_access<file_access_tag, std::__stdoutbuf<char>, &std::__stdoutbuf<char>::__file_>;
89 auto get_file(std::__stdoutbuf<char>&) -> FILE*;
95 if (
auto* buf =
dynamic_cast<std::filebuf*
>(os.rdbuf()))
96 if (FILE* f = get_file(*buf))
97 return write_console(f,
data);
98#elif defined(_WIN32) && defined(__GLIBCXX__)
99 auto* rdbuf = os.rdbuf();
101 if (
auto* fbuf =
dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char>*
>(rdbuf))
102 c_file = fbuf->file();
103 else if (
auto* fbuf =
dynamic_cast<__gnu_cxx::stdio_filebuf<char>*
>(rdbuf))
104 c_file = fbuf->file();
108 return write_console(c_file,
data);
109#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
110 if (
auto* buf =
dynamic_cast<std::__stdoutbuf<char>*
>(os.rdbuf()))
111 if (FILE* f = get_file(*buf))
112 return write_console(f,
data);
119 fmt::basic_string_view<wchar_t>)
126 template <
typename Char>
129 const Char* buf_data = buf.data();
130 using unsigned_streamsize = std::make_unsigned<std::streamsize>::type;
131 unsigned_streamsize size = buf.size();
132 unsigned_streamsize max_size =
to_unsigned(max_value<std::streamsize>());
135 unsigned_streamsize n = size <= max_size ? size : max_size;
136 os.write(buf_data,
static_cast<std::streamsize
>(n));
142 template <
typename Char,
typename T>
146 auto&&
output = std::basic_ostream<Char>(&format_buf);
147#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
149 output.imbue(loc.get<std::locale>());
152 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
155 template <
typename T>
164template <
typename Char>
169 template <
typename T,
typename OutputIt>
182template <
typename T,
typename Char>
186 template <
typename OutputIt>
214 template <
typename T,
typename Char>
224 detail::vformat_to(buffer, format_str, args);
236 detail::vformat_to(
buffer, format_str, args);
254 const auto& vargs = fmt::make_format_args(args...);
255 if (detail::is_utf8())
262template <
typename... Args>
FMT_CONSTEXPR auto data() noexcept -> T *
Definition core.h:1102
constexpr auto size() const noexcept -> size_t
Definition core.h:1090
friend auto get_file(BufType &obj) -> FILE *
Definition ostream.h:78
static auto test(...) -> std::false_type
decltype(test< T >(0)) result
Definition ostream.h:43
static auto test(int) -> bool_constant< sizeof(std::declval< std::basic_ostream< Char > & >()<< std::declval< U >()) !=0 >
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
Definition color.h:646
typename std::enable_if< B, T >::type enable_if_t
Definition core.h:302
std::integral_constant< bool, B > bool_constant
Definition core.h:306
basic_format_string< char, type_identity_t< Args >... > format_string
Definition core.h:4059
#define FMT_BEGIN_NAMESPACE
Definition core.h:214
#define FMT_MODULE_EXPORT
Definition core.h:225
FMT_BEGIN_DETAIL_NAMESPACE FMT_CONSTEXPR void ignore_unused(const T &...)
Definition core.h:373
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition core.h:455
typename type_identity< T >::type type_identity_t
Definition core.h:319
#define FMT_END_NAMESPACE
Definition core.h:219
bool write_ostream_unicode(std::ostream &os, fmt::string_view data)
Definition ostream.h:92
void vprint_directly(std::ostream &os, string_view format_str, format_args args)
Definition ostream.h:221
void format_value(buffer< Char > &buf, const T &value, locale_ref loc=locale_ref())
Definition ostream.h:143
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
Definition ostream.h:127
Definition bin_to_hex.h:111
auto streamed(const T &value) -> detail::streamed_view< T >
Definition ostream.h:205
basic_ostream_formatter< char > ostream_formatter
Definition ostream.h:180
FMT_MODULE_EXPORT void print(std::ostream &os, format_string< T... > fmt, T &&... args)
Definition ostream.h:252
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:231
const T & value
Definition ostream.h:158
annotation output
Definition tag_strings.h:122