11 #if defined(__MINGW32__) || defined(__CYGWIN__) 13 # undef __STRICT_ANSI__ 24 #if defined __APPLE__ || defined(__FreeBSD__) 31 # if defined(_WIN32) && !defined(__MINGW32__) 33 # define FMT_POSIX(call) _##call 35 # define FMT_POSIX(call) call 41 # define FMT_POSIX_CALL(call) FMT_SYSTEM(call) 43 # define FMT_SYSTEM(call) call 46 # define FMT_POSIX_CALL(call) ::_##call 48 # define FMT_POSIX_CALL(call) ::call 55 # define FMT_RETRY_VAL(result, expression, error_result) \ 57 result = (expression); \ 58 } while (result == error_result && errno == EINTR) 60 # define FMT_RETRY_VAL(result, expression, error_result) result = (expression) 63 #define FMT_RETRY(result, expression) FMT_RETRY_VAL(result, expression, -1) 92 template <
typename Char>
166 FILE *
get()
const FMT_NOEXCEPT {
return file_; }
176 template <
typename... Args>
193 explicit file(
int fd) : fd_(fd) {}
210 file(
const file &) =
delete;
211 void operator=(
const file &) =
delete;
242 FMT_API std::size_t
write(
const void *buffer, std::size_t count);
258 FMT_API static void pipe(file &read_end, file &write_end);
268 #if (defined(LC_NUMERIC_MASK) || defined(_MSC_VER)) && \ 269 !defined(__ANDROID__) && !defined(__CYGWIN__) && !defined(__OpenBSD__) && \ 270 !defined(__NEWLIB_H__) 279 typedef _locale_t locale_t;
281 enum { LC_NUMERIC_MASK = LC_NUMERIC };
283 static locale_t newlocale(
int category_mask,
const char *locale, locale_t) {
284 return _create_locale(category_mask, locale);
287 static void freelocale(locale_t locale) {
288 _free_locale(locale);
291 static double strtod_l(
const char *nptr,
char **endptr, _locale_t locale) {
292 return _strtod_l(nptr, endptr, locale);
298 Locale(
const Locale &) =
delete;
299 void operator=(
const Locale &) =
delete;
302 typedef locale_t
Type;
304 Locale() : locale_(newlocale(LC_NUMERIC_MASK,
"C",
FMT_NULL)) {
308 ~Locale() { freelocale(locale_); }
310 Type
get()
const {
return locale_; }
314 double strtod(
const char *&
str)
const {
316 double result = strtod_l(str, &end, locale_);
324 #endif // FMT_POSIX_H_
basic_cstring_view(const Char *s)
array_xxf dup(const array_xxf &arr)
basic_cstring_view< wchar_t > wcstring_view
size_t write(int, const char *, size_t)
Writes count bytes from buf to the filedescriptor fd.
int errno
Contains the last error code.
const Char * c_str() const
#define FMT_END_NAMESPACE
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
int close(int)
Closes the file descriptor fd.
basic_cstring_view< char > cstring_view
std::string str(const std::pair< Type, Type > &tt)
format_arg_store< Context, Args... > make_format_args(const Args &...args)
buffered_file() FMT_NOEXCEPT
int descriptor() const FMT_NOEXCEPT
void vprint(std::FILE *f, const text_style &ts, const S &format, basic_format_args< typename buffer_context< Char >::type > args)
void operator=(const file &)=delete
const GenericPointer< typename T::ValueType > T2 value
buffered_file & operator=(buffered_file &&other)
basic_cstring_view(const std::basic_string< Char > &s)
void vprint(string_view format_str, format_args args)
int read(int, char *, size_t)
Read bytes from a file descriptor.
error_code(int value=0) FMT_NOEXCEPT
void print(string_view format_str, const Args &...args)
file & operator=(file &&other)
buffered_file(buffered_file &&other) FMT_NOEXCEPT
file(file &&other) FMT_NOEXCEPT