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>
29 struct file_access_tag {};
31 template <
typename Tag,
typename BufType, FILE* BufType::*FileMemberPtr>
33 friend auto get_file(BufType& obj) -> FILE* {
return obj.*FileMemberPtr; }
37 template class file_access<file_access_tag, std::filebuf,
38 &std::filebuf::_Myfile>;
39 auto get_file(std::filebuf&) -> FILE*;
40 #elif defined(_WIN32) && defined(_LIBCPP_VERSION)
41 template class file_access<file_access_tag, std::__stdoutbuf<char>,
42 &std::__stdoutbuf<char>::__file_>;
43 auto 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>) {
75 template <
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));
89 template <
typename Char,
typename T>
93 auto&& output = std::basic_ostream<Char>(&format_buf);
94 #if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
98 output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
106 template <
typename Char>
110 template <
typename T,
typename OutputIt>
122 template <
typename T,
typename Char>
125 template <
typename OutputIt>
142 template <
typename T>
159 void vprint(std::basic_ostream<Char>& os,
187 template <
typename... Args>
200 template <
typename... Args>
209 #endif // FMT_OSTREAM_H_
GLenum GLuint GLenum GLsizei const GLchar * buf
FMT_CONSTEXPR auto data() noexcept-> T *
FMT_CONSTEXPR void ignore_unused(const T &...)
GLsizei const GLfloat * value
void vformat_to(buffer< Char > &buf, basic_string_view< Char > fmt, typename vformat_args< Char >::type args, locale_ref loc={})
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
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)
bool write_ostream_unicode(std::ostream &os, fmt::string_view data)
#define FMT_END_NAMESPACE
basic_string_view< char > string_view
void vprint_directly(std::ostream &os, string_view format_str, format_args args)
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
GLint GLint GLsizei GLint GLenum format
constexpr auto size() const noexcept-> size_t
void format_value(buffer< Char > &buf, const T &value, locale_ref loc=locale_ref())
constexpr auto make_format_args(T &&...args) -> format_arg_store< Context, remove_cvref_t< T >...>
typename type_identity< T >::type type_identity_t
FMT_MODULE_EXPORT void println(std::ostream &os, format_string< T...> fmt, T &&...args)
friend auto get_file(BufType &obj) -> FILE *
**If you just want to fire and args
FMT_CONSTEXPR auto is_utf8() -> bool
#define FMT_BEGIN_NAMESPACE
auto streamed(const T &value) -> detail::streamed_view< T >
FMT_MODULE_EXPORT void print(std::ostream &os, format_string< T...> fmt, T &&...args)
FMT_FUNC bool write_console(std::FILE *, string_view)
#define FMT_MODULE_EXPORT