FastLED 3.9.15
Loading...
Searching...
No Matches

◆ parse_format_spec()

FormatSpec fl::printf_detail::parse_format_spec ( const char *& format)
inline

Definition at line 95 of file printf.h.

95 {
96 FormatSpec spec;
97
98 if (*format != '%') {
99 return spec;
100 }
101
102 ++format; // Skip the '%'
103
104 // Handle literal '%'
105 if (*format == '%') {
106 spec.type = '%';
107 ++format;
108 return spec;
109 }
110
111 // Parse precision for floating point
112 if (*format == '.') {
113 ++format; // Skip the '.'
114 spec.precision = 0;
115 while (*format >= '0' && *format <= '9') {
116 spec.precision = spec.precision * 10 + (*format - '0');
117 ++format;
118 }
119 }
120
121 // Get the format type
122 spec.type = *format;
123 if (spec.type == 'X') {
124 spec.uppercase = true;
125 spec.type = 'x'; // Normalize to lowercase for processing
126 }
127
128 ++format;
129 return spec;
130}

References fl::printf_detail::FormatSpec::precision, fl::printf_detail::FormatSpec::type, and fl::printf_detail::FormatSpec::uppercase.

Referenced by format_impl(), and format_impl().

+ Here is the caller graph for this function: