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>
109 const Char *
c_str()
const {
return data_; }
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;
236 FMT_API long long size()
const;
242 FMT_API std::size_t
write(
const void *buffer, std::size_t count);
246 FMT_API static file dup(
int fd);
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_ void vprint(std::FILE *f, const text_style &ts, const S &format, basic_format_args< typename buffer_context< Char >::type > args)
void write(std::basic_ostream< Char > &os, basic_buffer< Char > &buf)
file & operator=(file &&other)
buffered_file & operator=(buffered_file &&other)
basic_cstring_view< wchar_t > wcstring_view
#define FMT_END_NAMESPACE
void vprint(string_view format_str, format_args args)
buffered_file(buffered_file &&other)
basic_cstring_view(const Char *s)
basic_buffer< char > buffer
const Char * c_str() const
basic_cstring_view< char > cstring_view
format_arg_store< Context, Args... > make_format_args(const Args &...args)
basic_cstring_view(const std::basic_string< Char > &s)
void print(string_view format_str, const Args &...args)
#define FMT_BEGIN_NAMESPACE
auto end(const C &c) -> decltype(c.end())