FastLED 3.10.6
Loading...
Searching...
No Matches

◆ format_impl() [2/2]

template<typename T, typename... Args>
void fl::printf_detail::format_impl ( sstream & stream,
const char * format,
const T & first,
const Args &... rest )

Definition at line 884 of file stdio.h.

884 {
885 while (*format) {
886 if (*format == '%') {
888 if (spec.type == '%') {
889 stream << "%";
890 continue;
891 } else {
892 // Format the first argument and continue with the rest
893 format_arg(stream, spec, first);
894 format_impl(stream, format, rest...);
895 return;
896 }
897 } else if (*format == '{' || *format == '}') {
898 if (parse_brace(stream, format)) {
899 // Generic placeholder: format the first argument by
900 // picking the natural specifier for its type (NOT through
901 // sstream::operator<<, which is what this design avoids) and
902 // continue with the rest.
903 format_arg_generic(stream, first);
904 format_impl(stream, format, rest...);
905 return;
906 }
907 continue;
908 } else {
909 // Create a single-character string since sstream treats char as number
910 char temp_str[2] = {*format, '\0'};
911 stream << temp_str;
912 ++format;
913 }
914 }
915
916 // If we get here, there are unused arguments
917 // This is not an error in printf, so we just ignore them
918}
fl::enable_if< fl::is_integral< T >::value >::type format_arg_generic(sstream &stream, const T &arg) FL_NO_EXCEPT
Definition stdio.h:746
void format_arg(sstream &stream, const FormatSpec &spec, const fl::string &arg) FL_NO_EXCEPT
void format_impl(sstream &stream, const char *format) FL_NO_EXCEPT
Definition stdio.h:855
FormatSpec parse_format_spec(const char *&format) FL_NO_EXCEPT
Definition stdio.h:130
bool parse_brace(sstream &stream, const char *&format) FL_NO_EXCEPT
Definition stdio.h:821
fl::string format(const char *fmt)
Format with no arguments.
Definition format.h:439

References fl::FL_NO_EXCEPT, fl::format(), format_arg(), format_arg_generic(), format_impl(), parse_brace(), parse_format_spec(), and fl::printf_detail::FormatSpec::type.

+ Here is the call graph for this function: