mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-22 10:30:05 +00:00
Add a define to force the use of fallback_file
This commit is contained in:
parent
18a9676d95
commit
2c0d9e9409
@ -1600,14 +1600,21 @@ template <typename F> class fallback_file : public file_base<F> {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename F, FMT_ENABLE_IF(sizeof(F::_p) != 0)>
|
||||
#ifndef FMT_USE_FALLBACK_FILE
|
||||
# define FMT_USE_FALLBACK_FILE 1
|
||||
#endif
|
||||
|
||||
template <typename F,
|
||||
FMT_ENABLE_IF(sizeof(F::_p) != 0 && !FMT_USE_FALLBACK_FILE)>
|
||||
auto get_file(F* f, int) -> apple_file<F> {
|
||||
return f;
|
||||
}
|
||||
template <typename F, FMT_ENABLE_IF(sizeof(F::_IO_read_ptr) != 0)>
|
||||
template <typename F,
|
||||
FMT_ENABLE_IF(sizeof(F::_IO_read_ptr) != 0 && !FMT_USE_FALLBACK_FILE)>
|
||||
inline auto get_file(F* f, int) -> glibc_file<F> {
|
||||
return f;
|
||||
}
|
||||
|
||||
inline auto get_file(FILE* f, ...) -> fallback_file<FILE> { return f; }
|
||||
|
||||
using file_ref = decltype(get_file(static_cast<FILE*>(nullptr), 0));
|
||||
|
@ -153,11 +153,13 @@ class string_scan_buffer final : public scan_buffer {
|
||||
|
||||
class file_scan_buffer final : public scan_buffer {
|
||||
private:
|
||||
template <typename F, FMT_ENABLE_IF(sizeof(F::_IO_read_ptr) != 0)>
|
||||
template <typename F, FMT_ENABLE_IF(sizeof(F::_IO_read_ptr) != 0 &&
|
||||
!FMT_USE_FALLBACK_FILE)>
|
||||
static auto get_file(F* f, int) -> glibc_file<F> {
|
||||
return f;
|
||||
}
|
||||
template <typename F, FMT_ENABLE_IF(sizeof(F::_p) != 0)>
|
||||
template <typename F,
|
||||
FMT_ENABLE_IF(sizeof(F::_p) != 0 && !FMT_USE_FALLBACK_FILE)>
|
||||
static auto get_file(F* f, int) -> apple_file<F> {
|
||||
return f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user