Agora
1.2.0
Agora project
|
Go to the documentation of this file.
22 template <
typename Char>
46 : out_(out), args_(args) {}
48 OutputIt
out() {
return out_; }
66 unsigned max = max_value<int>();
74 return value >= (std::numeric_limits<int>::min)() &&
82 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
89 template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value)>
99 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
104 template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value)>
126 if (type_ !=
's') operator()<
bool>(
value);
129 template <
typename U, FMT_ENABLE_IF(std::is_
integral<U>::value)>
131 bool is_signed = type_ ==
'd' || type_ ==
'i';
133 if (
const_check(
sizeof(target_type) <=
sizeof(
int))) {
136 arg_ = detail::make_arg<Context>(
137 static_cast<int>(
static_cast<target_type
>(
value)));
140 arg_ = detail::make_arg<Context>(
141 static_cast<unsigned>(
static_cast<unsigned_type
>(
value)));
148 arg_ = detail::make_arg<Context>(
static_cast<long long>(
value));
150 arg_ = detail::make_arg<Context>(
156 template <
typename U, FMT_ENABLE_IF(!std::is_
integral<U>::value)>
164 template <
typename T,
typename Context,
typename Char>
177 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
179 arg_ = detail::make_arg<Context>(
180 static_cast<typename Context::char_type
>(
value));
183 template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value)>
190 template <
typename T>
const Char*
operator()(
T) {
return nullptr; }
205 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
212 unsigned int_max = max_value<int>();
214 return static_cast<unsigned>(width);
217 template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value)>
225 template <
typename OutputIt,
typename Char>
235 auto s = this->specs;
246 template <
typename T, FMT_ENABLE_IF(detail::is_
integral<T>::value)>
253 fmt_specs.
type != presentation_type::chr) {
254 return (*
this)(
static_cast<int>(
value));
257 fmt_specs.
alt =
false;
258 fmt_specs.
fill[0] =
' ';
263 return write<Char>(this->out,
static_cast<Char
>(
value), fmt_specs);
265 return base::operator()(
value);
268 template <
typename T, FMT_ENABLE_IF(std::is_
floating_po
int<T>::value)>
270 return base::operator()(
value);
276 return write_null_pointer(this->specs.type != presentation_type::pointer);
282 return write_null_pointer(this->specs.type != presentation_type::pointer);
286 return base::operator()(
value);
291 return value ? base::operator()(
value) : write_null_pointer();
298 handle.
format(parse_ctx, context_);
303 template <
typename Char>
306 for (; it !=
end; ++it) {
331 template <
typename Char,
typename GetArg>
336 if (c >=
'0' && c <=
'9') {
340 if (it !=
end && *it ==
'$') {
342 arg_index =
value != -1 ?
value : max_value<int>();
344 if (c ==
'0') specs.
fill[0] =
'0';
357 if (*it >=
'0' && *it <=
'9') {
360 }
else if (*it ==
'*') {
369 template <
typename Char,
typename Context>
373 auto out = OutputIt(buf);
379 auto get_arg = [&](
int arg_index) {
381 arg_index = parse_ctx.next_arg_id();
383 parse_ctx.check_arg_id(--arg_index);
387 const Char*
start = parse_ctx.begin();
388 const Char*
end = parse_ctx.end();
391 if (!detail::find<false, Char>(it,
end,
'%', it)) {
396 if (it !=
end && *it == c) {
410 if (arg_index == 0) parse_ctx.on_error(
"argument not found");
413 if (it !=
end && *it ==
'.') {
415 c = it !=
end ? *it : 0;
416 if (
'0' <= c && c <=
'9') {
418 }
else if (c ==
'*') {
433 if (specs.
precision >= 0 &&
arg.type() == detail::type::cstring_type) {
436 auto nul =
std::find(str, str_end, Char());
437 arg = detail::make_arg<basic_printf_context<OutputIt, Char>>(
444 if (specs.
fill[0] ==
'0') {
453 c = it !=
end ? *it++ : 0;
454 Char t = it !=
end ? *it : 0;
460 t = it !=
end ? *it : 0;
461 convert_arg<signed char>(
arg, t);
463 convert_arg<short>(
arg, t);
469 t = it !=
end ? *it : 0;
470 convert_arg<long long>(
arg, t);
472 convert_arg<long>(
arg, t);
476 convert_arg<intmax_t>(
arg, t);
479 convert_arg<size_t>(
arg, t);
482 convert_arg<std::ptrdiff_t>(
arg, t);
490 convert_arg<void>(
arg, c);
495 char type =
static_cast<char>(*it++);
496 if (
arg.is_integral()) {
512 parse_ctx.on_error(
"invalid type specifier");
524 template <
typename Char>
540 template <
typename...
T>
552 template <
typename...
T>
558 template <
typename S,
typename Char =
char_t<S>>
562 -> std::basic_string<Char> {
577 template <
typename S,
typename...
T,
579 inline auto sprintf(
const S&
fmt,
const T&... args) -> std::basic_string<Char> {
584 template <
typename S,
typename Char =
char_t<S>>
586 std::FILE* f,
const S&
fmt,
594 :
static_cast<int>(
size);
606 template <
typename S,
typename...
T,
typename Char =
char_t<S>>
607 inline auto fprintf(std::FILE* f,
const S&
fmt,
const T&... args) ->
int {
610 fmt::make_format_args<context>(args...));
613 template <
typename S,
typename Char =
char_t<S>>
637 template <
typename S,
typename Char =
char_t<S>>
639 std::basic_ostream<Char>& os,
const S&
fmt,
644 os.write(buffer.
data(),
static_cast<std::streamsize
>(buffer.
size()));
645 return static_cast<int>(buffer.
size());
647 template <
typename S,
typename...
T,
typename Char =
char_t<S>>
649 const T&... args) ->
int {
657 #endif // FMT_PRINTF_H_
const SPDLOG_INLINE string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common-inl.h:23
typename detail::char_t_impl< S >::type char_t
Definition: core.h:623
auto fprintf(std::basic_ostream< Char > &os, const S &fmt, const T &... args) -> int
Definition: printf.h:648
void operator()(U value)
Definition: printf.h:130
void parse_flags(basic_format_specs< Char > &specs, const Char *&it, const Char *end)
Definition: printf.h:304
unsigned operator()(T)
Definition: printf.h:218
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
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
static bool fits_in_int(T value)
Definition: printf.h:73
@ plus
Definition: core.h:2025
char_converter(basic_format_arg< Context > &arg)
Definition: printf.h:175
conditional_t< num_bits< T >()<=32 &&! 0, uint32_t, conditional_t< num_bits< T >()<=64, uint64_t, uint128_t > > uint32_or_64_or_128_t
Definition: format.h:909
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3999
auto make_printf_args(const T &... args) -> format_arg_store< printf_context, T... >
Definition: printf.h:541
@ left
Definition: core.h:2021
basic_printf_context_t< wchar_t > wprintf_context
Definition: printf.h:529
constexpr auto size() const -> size_t
Definition: core.h:820
int parse_header(const Char *&it, const Char *end, basic_format_specs< Char > &specs, GetArg get_arg)
Definition: printf.h:332
basic_printf_context_t< char > printf_context
Definition: printf.h:528
@ right
Definition: core.h:2021
Char char_type
Definition: printf.h:33
auto vprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> int
Definition: printf.h:614
typename Context::char_type char_type
Definition: printf.h:116
auto vfprintf(std::basic_ostream< Char > &os, const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> int
Definition: printf.h:638
static bool fits_in_int(int)
Definition: printf.h:77
void operator()(T value)
Definition: printf.h:178
arg_converter(basic_format_arg< Context > &arg, char_type type)
Definition: printf.h:122
void operator()(bool value)
Definition: printf.h:125
bool operator()(T value)
Definition: printf.h:100
int operator()(T value)
Definition: printf.h:83
static bool fits_in_int(T value)
Definition: printf.h:65
auto is_negative(T value) -> bool
Definition: format.h:888
printf_width_handler(format_specs &specs)
Definition: printf.h:203
char_type type_
Definition: printf.h:119
basic_format_arg< Context > & arg_
Definition: printf.h:118
OutputIt out_
Definition: printf.h:29
auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept -> int
Definition: core.h:2276
#define FMT_ENABLE_IF(...)
Definition: core.h:344
format_specs & specs_
Definition: printf.h:200
auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2258
auto get_arg(Context &ctx, ID id) -> typename Context::format_arg
Definition: format.h:2292
void convert_arg(basic_format_arg< Context > &arg, Char type)
Definition: printf.h:165
void on_error(const char *message)
Definition: format-inl.h:2580
#define FMT_END_NAMESPACE
Definition: core.h:240
void on_error(const char *message)
Definition: printf.h:55
constexpr auto const_check(T value) -> T
Definition: core.h:365
auto parse_presentation_type(Char type) -> presentation_type
Definition: core.h:2455
auto write_bytes(OutputIt out, string_view bytes, const basic_format_specs< Char > &specs) -> OutputIt
Definition: format.h:1356
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition: core.h:1887
end start
Definition: inspect_agora_results.m:95
unsigned operator()(T value)
Definition: printf.h:206
constexpr auto make_format_args(Args &&... args) -> format_arg_store< Context, remove_cvref_t< Args >... >
Definition: core.h:1870
@ numeric
Definition: core.h:2021
void operator()(T)
Definition: printf.h:184
OutputIt out()
Definition: printf.h:48
auto data() -> T *
Definition: core.h:826
Add CP Insert the cyclic prefix if(CP_LEN > 0) tx_cp
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: core.h:249
const Char * operator()(const Char *s)
Definition: printf.h:191
#define FMT_MODULE_EXPORT_END
Definition: core.h:248
#define FMT_MODULE_EXPORT_BEGIN
Definition: core.h:247
basic_format_arg< Context > & arg_
Definition: printf.h:172
bool operator()(T)
Definition: printf.h:105
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:323
fwrite(fileID, pilot_f, 'float')
Definition: bin_to_hex.h:102
bool type
Definition: printf.h:112
void operator()(U)
Definition: printf.h:157
const Char * operator()(T)
Definition: printf.h:190
@ none
Definition: core.h:2021
#define FMT_BEGIN_NAMESPACE
Definition: core.h:237
std::string to_string() const
Definition: eth_common.h:64
void advance_to(OutputIt it)
Definition: printf.h:49
basic_printf_context(OutputIt out, basic_format_args< basic_printf_context > args)
Definition: printf.h:44
typename type_identity< T >::type type_identity_t
Definition: core.h:332
auto vsprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> std::basic_string< Char >
Definition: printf.h:559
auto sprintf(const S &fmt, const T &... args) -> std::basic_string< Char >
Definition: printf.h:579
#define FMT_DEPRECATED
Definition: core.h:231
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:321
auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
Definition: core.h:1587
static bool fits_in_int(bool)
Definition: printf.h:69
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_t >::value > is_signed
Definition: format.h:883
auto make_wprintf_args(const T &... args) -> format_arg_store< wprintf_context, T... >
Definition: printf.h:553
detail::locale_ref locale()
Definition: printf.h:51
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T > >> buffer_appender
Definition: core.h:1023
#define FMT_END_DETAIL_NAMESPACE
Definition: core.h:250
auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:424
int operator()(T)
Definition: printf.h:90
@ space
Definition: core.h:2025
format_arg arg(int id) const
Definition: printf.h:53
#define FMT_CONSTEXPR
Definition: core.h:110
std::string format(const T &value)
Definition: utils.h:15
type
Definition: core.h:1131
basic_format_args< basic_printf_context > args_
Definition: printf.h:30