Agora
1.2.0
Agora project
|
Go to the documentation of this file.
16 #include <system_error>
18 #if defined __APPLE__ || defined(__FreeBSD__)
26 # if FMT_HAS_INCLUDE("winapifamily.h")
27 # include <winapifamily.h>
29 # if (FMT_HAS_INCLUDE(<fcntl.h>) || defined(__APPLE__) || \
30 defined(__linux__)) && \
31 (!defined(WINAPI_FAMILY) || \
32 (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
34 # define FMT_USE_FCNTL 1
36 # define FMT_USE_FCNTL 0
41 # if defined(_WIN32) && !defined(__MINGW32__)
43 # define FMT_POSIX(call) _##call
45 # define FMT_POSIX(call) call
51 # define FMT_POSIX_CALL(call) FMT_SYSTEM(call)
53 # define FMT_SYSTEM(call) ::call
56 # define FMT_POSIX_CALL(call) ::_##call
58 # define FMT_POSIX_CALL(call) ::call
65 # define FMT_RETRY_VAL(result, expression, error_result) \
67 (result) = (expression); \
68 } while ((result) == (error_result) && errno == EINTR)
70 # define FMT_RETRY_VAL(result, expression, error_result) result = (expression)
73 #define FMT_RETRY(result, expression) FMT_RETRY_VAL(result, expression, -1)
126 template <
typename ParseContext>
131 template <
typename FormatContext>
133 -> decltype(ctx.out()) {
134 auto out = ctx.out();
137 out = detail::write<Char>(out, Char(
':'));
138 out = detail::write<Char>(out, ec.value());
149 class utf16_to_utf8 {
155 FMT_API explicit utf16_to_utf8(basic_string_view<wchar_t>
s);
157 size_t size()
const {
return buffer_.
size() - 1; }
158 const char* c_str()
const {
return &buffer_[0]; }
159 std::string str()
const {
return std::string(&buffer_[0],
size()); }
164 FMT_API int convert(basic_string_view<wchar_t>
s);
167 FMT_API void format_windows_error(buffer<char>& out,
int error_code,
202 template <
typename... Args>
204 const Args&... args) {
210 FMT_API void report_windows_error(
int error_code,
220 template <
typename S,
typename... Args,
typename Char =
char_t<S>>
221 void say(
const S& format_str, Args&&... args) {
222 std::system(
format(
"say \"{}\"",
format(format_str, args...)).c_str());
247 other.file_ =
nullptr;
253 other.file_ =
nullptr;
274 template <
typename... Args>
292 explicit file(
int fd) : fd_(fd) {}
312 file(
const file&) =
delete;
313 void operator=(
const file&) =
delete;
315 file(file&& other)
FMT_NOEXCEPT : fd_(other.fd_) { other.fd_ = -1; }
318 file& operator=(file&& other) {
346 FMT_API static file dup(
int fd);
358 FMT_API static void pipe(file& read_end, file& write_end);
371 buffer_size() =
default;
373 buffer_size operator=(
size_t val)
const {
374 auto bs = buffer_size();
380 struct ostream_params {
381 int oflag = file::WRONLY | file::CREATE | file::TRUNC;
382 size_t buffer_size = BUFSIZ > 32768 ? BUFSIZ : 32768;
386 template <
typename...
T>
387 ostream_params(
T... params,
int new_oflag) : ostream_params(params...) {
391 template <
typename...
T>
392 ostream_params(
T... params, detail::buffer_size bs)
393 : ostream_params(params...) {
394 this->buffer_size = bs.value;
399 # if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 2000
400 ostream_params(
int new_oflag) : oflag(new_oflag) {}
401 ostream_params(detail::buffer_size bs) : buffer_size(bs.
value) {}
409 constexpr detail::buffer_size buffer_size{};
412 class FMT_API ostream final :
private detail::buffer<char> {
416 void grow(
size_t)
override;
418 ostream(
cstring_view path,
const detail::ostream_params& params)
419 : file_(path, params.oflag) {
420 set(
new char[params.buffer_size], params.buffer_size);
424 ostream(ostream&& other)
425 :
detail::buffer<char>(other.
data(), other.
size(), other.capacity()),
426 file_(
std::move(other.file_)) {
428 other.set(
nullptr, 0);
436 if (
size() == 0)
return;
441 template <
typename...
T>
453 template <
typename...
T>
void print(format_string<T...>
fmt,
T&&... args) {
474 template <
typename...
T>
476 return {path, detail::ostream_params(params...)};
478 #endif // FMT_USE_FCNTL
485 using locale_t = _locale_t;
487 static void freelocale(locale_t loc) { _free_locale(loc); }
489 static double strtod_l(
const char* nptr,
char** endptr, _locale_t loc) {
490 return _strtod_l(nptr, endptr, loc);
497 using type = locale_t;
498 locale(
const locale&) =
delete;
499 void operator=(
const locale&) =
delete;
503 locale_ =
FMT_SYSTEM(newlocale(LC_NUMERIC_MASK,
"C",
nullptr));
505 locale_ = _create_locale(LC_NUMERIC,
"C");
509 ~locale() { freelocale(locale_); }
511 type get()
const {
return locale_; }
517 double result = strtod_l(str, &
end, locale_);
void print(std::FILE *f, const text_style &ts, const S &format_str, const Args &... args)
Definition: color.h:549
typename detail::char_t_impl< S >::type char_t
Definition: core.h:623
basic_string_view< char > string_view
Definition: core.h:540
end IFFT Reshape the symbol vector into two different spatial streams size
Definition: generate_data.m:73
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
Definition: chrono.h:425
#define FMT_API
Definition: core.h:269
basic_cstring_view(const std::basic_string< Char > &s)
Definition: os.h:116
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3999
string mode
Definition: mm_gui.py:105
constexpr auto size() const -> size_t
Definition: core.h:820
const Char * c_str() const
Definition: os.h:119
const std::error_category & system_category()
Definition: os.h:213
FILE * get() const
Definition: os.h:264
count
Definition: inspect_agora_results.m:96
void print(string_view format_str, const Args &... args)
Definition: os.h:275
void close()
Definition: matplotlibcpp.h:2567
filename
Definition: parse_all_dl.m:14
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:5193
#define FMT_NOEXCEPT
Definition: core.h:164
basic_cstring_view< char > cstring_view
Definition: os.h:122
const Char * data_
Definition: os.h:105
uint8_t data_[]
Definition: radio_socket.cc:21
basic_cstring_view(const Char *s)
Definition: os.h:109
#define FMT_END_NAMESPACE
Definition: core.h:240
buffered_file()
Definition: os.h:240
FILE * file_
Definition: os.h:229
auto write_bytes(OutputIt out, string_view bytes, const basic_format_specs< Char > &specs) -> OutputIt
Definition: format.h:1356
buffered_file & operator=(buffered_file &&other)
Definition: os.h:250
constexpr auto make_format_args(Args &&... args) -> format_arg_store< Context, remove_cvref_t< Args >... >
Definition: core.h:1870
void vformat_to(buffer< Char > &buf, const text_style &ts, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char >>> args)
Definition: color.h:502
#define FMT_SYSTEM(call)
Definition: os.h:53
basic_format_args< format_context > format_args
Definition: core.h:2016
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: core.h:249
auto system_error(int error_code, format_string< T... > fmt, T &&... args) -> std::system_error
Definition: format.h:2471
buffered_file(FILE *f)
Definition: os.h:233
#define FMT_MODULE_EXPORT_END
Definition: core.h:248
#define FMT_MODULE_EXPORT_BEGIN
Definition: core.h:247
Definition: json.hpp:5213
void vprint(std::FILE *f, const text_style &ts, const S &format, basic_format_args< buffer_context< type_identity_t< Char >>> args)
Definition: color.h:528
Definition: bin_to_hex.h:102
#define FMT_BEGIN_NAMESPACE
Definition: core.h:237
#define FMT_DEPRECATED
Definition: core.h:231
void vprint(string_view format_str, format_args args)
Definition: os.h:270
#define FMT_END_DETAIL_NAMESPACE
Definition: core.h:250
#define FMT_POSIX(call)
Definition: os.h:45
#define FMT_CONSTEXPR
Definition: core.h:110
result
Definition: format-inl.h:640
std::string format(const T &value)
Definition: utils.h:15
type
Definition: core.h:1131