MCPcopy Create free account
hub / github.com/fmtlib/fmt / parse_align

Method parse_align

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

Source from the content-addressed store, hash-verified

2334
2335template <typename Char>
2336FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end,
2337 format_specs& specs) -> const Char* {
2338 FMT_ASSERT(begin != end, "");
2339 auto alignment = align::none;
2340 auto p = begin + code_point_length(begin);
2341 if (end - p <= 0) p = begin;
2342 for (;;) {
2343 switch (to_ascii(*p)) {
2344 case '<': alignment = align::left; break;
2345 case '>': alignment = align::right; break;
2346 case '^': alignment = align::center; break;
2347 }
2348 if (alignment != align::none) {
2349 if (p != begin) {
2350 auto c = *begin;
2351 if (c == '}') return begin;
2352 if (c == '{') {
2353 report_error("invalid fill character '{'");
2354 return begin;
2355 }
2356 specs.set_fill(basic_string_view<Char>(begin, to_unsigned(p - begin)));
2357 begin = p + 1;
2358 } else {
2359 ++begin;
2360 }
2361 break;
2362 }
2363 if (p == begin) break;
2364 p = begin;
2365 }
2366 specs.set_align(alignment);
2367 return begin;
2368}
2369
2370template <typename Char, typename OutputIt>
2371FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan,

Callers

nothing calls this directly

Calls 6

code_point_lengthFunction · 0.85
to_asciiFunction · 0.85
report_errorFunction · 0.85
to_unsignedFunction · 0.85
set_fillMethod · 0.80
set_alignMethod · 0.80

Tested by

no test coverage detected