mirror of
https://github.com/fmtlib/fmt.git
synced 2024-09-03 13:39:15 +00:00
Merge printf.cc into printf.h
This commit is contained in:
parent
ccaae0c019
commit
955062da2e
@ -83,7 +83,7 @@ endfunction()
|
||||
# Define the fmt library, its includes and the needed defines.
|
||||
# format.cc is added to FMT_HEADERS for the header-only configuration.
|
||||
add_headers(FMT_HEADERS core.h format.h format.cc locale.h ostream.h ostream.cc
|
||||
printf.h printf.cc string.h time.h)
|
||||
printf.h string.h time.h)
|
||||
if (HAVE_OPEN)
|
||||
add_headers(FMT_HEADERS posix.h)
|
||||
add_headers(FMT_SOURCES posix.cc)
|
||||
|
@ -1,21 +0,0 @@
|
||||
#include "fmt/printf.h"
|
||||
|
||||
namespace fmt {
|
||||
|
||||
template <typename Char>
|
||||
void printf(basic_writer<Char> &w, basic_string_view<Char> format,
|
||||
format_args args);
|
||||
|
||||
FMT_FUNC int vfprintf(std::FILE *f, string_view format, printf_args args) {
|
||||
memory_buffer buffer;
|
||||
printf(buffer, format, args);
|
||||
std::size_t size = buffer.size();
|
||||
return std::fwrite(
|
||||
buffer.data(), 1, size, f) < size ? -1 : static_cast<int>(size);
|
||||
}
|
||||
|
||||
#ifndef FMT_HEADER_ONLY
|
||||
template void printf_context<char>::format(buffer &);
|
||||
template void printf_context<wchar_t>::format(wbuffer &);
|
||||
#endif
|
||||
}
|
@ -555,7 +555,13 @@ inline std::wstring sprintf(wstring_view format_str, const Args & ... args) {
|
||||
return vsprintf(format_str, vargs);
|
||||
}
|
||||
|
||||
FMT_API int vfprintf(std::FILE *f, string_view format, printf_args args);
|
||||
inline int vfprintf(std::FILE *f, string_view format, printf_args args) {
|
||||
memory_buffer buffer;
|
||||
printf(buffer, format, args);
|
||||
std::size_t size = buffer.size();
|
||||
return std::fwrite(
|
||||
buffer.data(), 1, size, f) < size ? -1 : static_cast<int>(size);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
// Include format.cc instead of format.h to test implementation-specific stuff.
|
||||
#include "fmt/format.cc"
|
||||
#include "fmt/printf.cc"
|
||||
#include "fmt/printf.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
Loading…
Reference in New Issue
Block a user