MCPcopy Create free account
hub / github.com/c42f/tinyformat / printFormatStringLiteral

Function printFormatStringLiteral

tinyformat.h:603–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601// The position of the first % character of the next nontrivial format spec is
602// returned, or the end of string.
603inline const char* printFormatStringLiteral(std::ostream& out, const char* fmt)
604{
605 const char* c = fmt;
606 for (;; ++c) {
607 if (*c == '\0') {
608 out.write(fmt, c - fmt);
609 return c;
610 }
611 else if (*c == '%') {
612 out.write(fmt, c - fmt);
613 if (*(c+1) != '%')
614 return c;
615 // for "%%", tack trailing % onto next literal section.
616 fmt = ++c;
617 }
618 }
619}
620
621
622// Parse a format string and set the stream state accordingly.

Callers 1

formatImplFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected