67 if (!p || *p ==
'}')
return p;
71 if (p[0] && p[1] && (p[1] ==
'<' || p[1] ==
'>' || p[1] ==
'^')) {
75 }
else if (*p ==
'<' || *p ==
'>' || *p ==
'^') {
80 if (*p ==
'+' || *p ==
'-' || *p ==
' ') {
91 if (*p ==
'0' && spec.
align ==
'\0') {
97 while (*p >=
'0' && *p <=
'9') {
106 while (*p >=
'0' && *p <=
'9') {
113 if (*p && *p !=
'}') {
122 fl::size value_len =
value.size();
124 if (spec.
width <= 0 ||
static_cast<fl::size
>(spec.
width) <= value_len) {
129 fl::size padding =
static_cast<fl::size
>(spec.
width) - value_len;
132 char align = spec.
align;
140 for (fl::size i = 0; i < padding; ++i) {
143 }
else if (align ==
'>') {
145 for (fl::size i = 0; i < padding; ++i) {
149 }
else if (align ==
'^') {
151 fl::size left_pad = padding / 2;
152 fl::size right_pad = padding - left_pad;
153 for (fl::size i = 0; i < left_pad; ++i) {
157 for (fl::size i = 0; i < right_pad; ++i) {
167 char* p = buf +
sizeof(buf);
170 bool negative =
false;
176 uval =
static_cast<UnsignedT
>(-(
value + 1)) + 1;
178 uval =
static_cast<UnsignedT
>(
value);
183 const char*
digits =
"0123456789abcdef";
186 case 'b':
case 'B': base = 2;
break;
187 case 'o': base = 8;
break;
188 case 'x': base = 16;
digits =
"0123456789abcdef";
break;
189 case 'X': base = 16;
digits =
"0123456789ABCDEF";
break;
192 char ch =
static_cast<char>(
value);
195 default: base = 10;
break;
203 *--p =
digits[uval % base];
212 }
else if (spec.
sign ==
'+') {
214 }
else if (spec.
sign ==
' ') {
222 }
else if (base == 2) {
225 }
else if (base == 8 && *p !=
'0') {
234 int num_width = spec.
width -
static_cast<int>(prefix.
size());
235 if (num_width >
static_cast<int>(num_str.
size())) {
237 for (
int i = 0; i < num_width -
static_cast<int>(num_str.
size()); ++i) {
258 }
else if (spec.
sign ==
'+') {
260 }
else if (spec.
sign ==
' ') {
333 if (spec.
type ==
'd' || spec.
type ==
'x' || spec.
type ==
'X' ||
334 spec.
type ==
'b' || spec.
type ==
'o') {
337 char buf[2] = {
mData.c,
'\0'};
358 unsigned long long ull;
375 if (*(p + 1) ==
'{') {
386 if (*p >=
'0' && *p <=
'9') {
388 while (*p >=
'0' && *p <=
'9') {
389 arg_index = arg_index * 10 + (*p -
'0');
393 arg_index = auto_index++;
404 while (*p && *p !=
'}') ++p;
408 if (arg_index >= 0 && arg_index < num_args) {
412 result.append(
"<out_of_range>");
414 }
else if (*p ==
'}') {
415 if (*(p + 1) ==
'}') {
424 const char* next = p;
425 while (*next && *next !=
'{' && *next !=
'}') {
428 result.append(p,
static_cast<fl::size
>(next - p));
444template <
typename... Args>
fl::size size() const FL_NOEXCEPT
string & append(const bitset_fixed< N > &bs) FL_NOEXCEPT
constexpr int type_rank< T >::value
uptr ptr_to_int(T *ptr) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
constexpr int numeric_limits< char >::digits
void fill(Iterator first, Iterator last, const T &value) FL_NOEXCEPT
void ftoa(float value, char *buffer, int precision)
Convert floating point number to string buffer.
fl::string format(const char *fmt)
Format with no arguments.
Base definition for an LED controller.