MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / parse_arg_id

Function parse_arg_id

extlibs/fmt/include/fmt/format.h:2336–2366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2334
2335template <typename Char, typename IDHandler>
2336FMT_CONSTEXPR const Char* parse_arg_id(const Char* begin, const Char* end,
2337 IDHandler&& handler) {
2338 FMT_ASSERT(begin != end, "");
2339 Char c = *begin;
2340 if (c == '}' || c == ':') {
2341 handler();
2342 return begin;
2343 }
2344 if (c >= '0' && c <= '9') {
2345 int index = 0;
2346 if (c != '0')
2347 index = parse_nonnegative_int(begin, end, handler);
2348 else
2349 ++begin;
2350 if (begin == end || (*begin != '}' && *begin != ':'))
2351 handler.on_error("invalid format string");
2352 else
2353 handler(index);
2354 return begin;
2355 }
2356 if (!is_name_start(c)) {
2357 handler.on_error("invalid format string");
2358 return begin;
2359 }
2360 auto it = begin;
2361 do {
2362 ++it;
2363 } while (it != end && (is_name_start(c = *it) || ('0' <= c && c <= '9')));
2364 handler(basic_string_view<Char>(begin, to_unsigned(it - begin)));
2365 return it;
2366}
2367
2368// Adapts SpecHandler to IDHandler API for dynamic width.
2369template <typename SpecHandler, typename Char> struct width_adapter {

Callers 3

parse_widthFunction · 0.85
parse_precisionFunction · 0.85
parse_format_stringFunction · 0.85

Calls 3

parse_nonnegative_intFunction · 0.85
is_name_startFunction · 0.85
on_errorMethod · 0.45

Tested by

no test coverage detected