13 #if defined(__MINGW32__) || defined(__CYGWIN__) 15 #undef __STRICT_ANSI__ 26 #if defined __APPLE__ || defined(__FreeBSD__) 33 #if defined(_WIN32) && !defined(__MINGW32__) 35 #define FMT_POSIX(call) _##call 37 #define FMT_POSIX(call) call 43 #define FMT_POSIX_CALL(call) FMT_SYSTEM(call) 45 #define FMT_SYSTEM(call) call 48 #define FMT_POSIX_CALL(call) ::_##call 50 #define FMT_POSIX_CALL(call) ::call 57 #define FMT_RETRY_VAL(result, expression, error_result) \ 60 result = (expression); \ 61 } while (result == error_result && errno == EINTR) 63 #define FMT_RETRY_VAL(result, expression, error_result) result = (expression) 66 #define FMT_RETRY(result, expression) FMT_RETRY_VAL(result, expression, -1) 77 explicit ErrorCode(
int value = 0) FMT_NOEXCEPT : value_(value) {}
79 int get()
const FMT_NOEXCEPT
105 #if !FMT_USE_RVALUE_REFERENCES 140 other.file_ = FMT_NULL;
146 operator Proxy() FMT_NOEXCEPT
160 other.file_ = FMT_NULL;
167 other.file_ = FMT_NULL;
176 FMT_API
void close();
179 FILE *
get()
const FMT_NOEXCEPT
186 FMT_API int(fileno)()
const;
190 fmt::print(file_, format_str, args);
207 explicit File(
int fd)
216 RDONLY = FMT_POSIX(O_RDONLY),
217 WRONLY = FMT_POSIX(O_WRONLY),
218 RDWR = FMT_POSIX(O_RDWR)
222 File() FMT_NOEXCEPT : fd_(-1) {}
227 #if !FMT_USE_RVALUE_REFERENCES 241 File(Proxy p) FMT_NOEXCEPT : fd_(p.fd) {}
244 File(File &other) FMT_NOEXCEPT : fd_(other.fd_)
250 File &operator=(Proxy p)
258 File &operator=(File &other)
268 operator Proxy() FMT_NOEXCEPT
277 FMT_DISALLOW_COPY_AND_ASSIGN(File);
280 File(File &&other) FMT_NOEXCEPT : fd_(other.fd_)
285 File &operator=(File &&other)
295 FMT_API ~File() FMT_NOEXCEPT;
298 int descriptor()
const FMT_NOEXCEPT
304 FMT_API
void close();
308 FMT_API LongLong size()
const;
311 FMT_API std::size_t read(
void *buffer, std::size_t count);
314 FMT_API std::size_t write(
const void *buffer, std::size_t count);
318 FMT_API
static File dup(
int fd);
322 FMT_API
void dup2(
int fd);
326 FMT_API
void dup2(
int fd,
ErrorCode &ec) FMT_NOEXCEPT;
330 FMT_API
static void pipe(File &read_end, File &write_end);
340 #if (defined(LC_NUMERIC_MASK) || defined(_MSC_VER)) && !defined(__ANDROID__) && !defined(__CYGWIN__) 350 typedef _locale_t locale_t;
354 LC_NUMERIC_MASK = LC_NUMERIC
357 static locale_t newlocale(
int category_mask,
const char *locale, locale_t)
359 return _create_locale(category_mask, locale);
362 static void freelocale(locale_t locale)
364 _free_locale(locale);
367 static double strtod_l(
const char *nptr,
char **endptr, _locale_t locale)
369 return _strtod_l(nptr, endptr, locale);
375 FMT_DISALLOW_COPY_AND_ASSIGN(Locale);
378 typedef locale_t Type;
381 : locale_(newlocale(LC_NUMERIC_MASK,
"C", FMT_NULL))
398 double strtod(
const char *&str)
const 400 char *end = FMT_NULL;
401 double result = strtod_l(str, &end, locale_);
409 #if !FMT_USE_RVALUE_REFERENCES 423 #endif // FMT_POSIX_H_ Definition: format.h:1876
Definition: format.h:3053