671 out.unsetf(std::ios::adjustfield | std::ios::basefield |
672 std::ios::floatfield | std::ios::showbase | std::ios::boolalpha |
673 std::ios::showpoint | std::ios::showpos | std::ios::uppercase);
674 bool precisionSet =
false;
675 bool widthSet =
false;
677 const char* c = fmtStart + 1;
681 if (*c >=
'0' && *c <=
'9') {
682 const char tmpc = *c;
686 if (value > 0 && value <= numArgs)
687 argIndex = value - 1;
691 positionalMode =
true;
693 else if (positionalMode) {
694 TINYFORMAT_ERROR(
"tinyformat: Non-positional argument used after a positional one");
701 out.setf(std::ios::internal, std::ios::adjustfield);
710 else if (positionalMode) {
711 TINYFORMAT_ERROR(
"tinyformat: Non-positional argument used after a positional one");
719 out.setf(std::ios::showpoint | std::ios::showbase);
723 if (!(out.flags() & std::ios::left)) {
727 out.setf(std::ios::internal, std::ios::adjustfield);
732 out.setf(std::ios::left, std::ios::adjustfield);
736 if (!(out.flags() & std::ios::showpos))
737 spacePadPositive =
true;
740 out.setf(std::ios::showpos);
741 spacePadPositive =
false;
752 args, argIndex, numArgs);
757 out.setf(std::ios::left, std::ios::adjustfield);
768 args, argIndex, numArgs);
771 precisionSet = precision >= 0;
773 out.precision(precision);
776 while (*c ==
'l' || *c ==
'h' || *c ==
'L' ||
777 *c ==
'j' || *c ==
'z' || *c ==
't') {
783 bool intConversion =
false;
785 case 'u':
case 'd':
case 'i':
786 out.setf(std::ios::dec, std::ios::basefield);
787 intConversion =
true;
790 out.setf(std::ios::oct, std::ios::basefield);
791 intConversion =
true;
794 out.setf(std::ios::uppercase);
797 out.setf(std::ios::hex, std::ios::basefield);
798 intConversion =
true;
801 out.setf(std::ios::uppercase);
804 out.setf(std::ios::scientific, std::ios::floatfield);
805 out.setf(std::ios::dec, std::ios::basefield);
808 out.setf(std::ios::uppercase);
811 out.setf(std::ios::fixed, std::ios::floatfield);
814 out.setf(std::ios::uppercase);
823 out.setf(std::ios::fixed | std::ios::scientific, std::ios::floatfield);
826 out.setf(std::ios::uppercase);
829 out.setf(std::ios::dec, std::ios::basefield);
831 out.flags(out.flags() & ~std::ios::floatfield);
838 ntrunc =
static_cast<int>(out.precision());
840 out.setf(std::ios::boolalpha);
848 "terminated by end of string");
853 if (intConversion && precisionSet && !widthSet) {
858 out.width(out.precision() + widthExtra);
859 out.setf(std::ios::internal, std::ios::adjustfield);