MCPcopy Create free account
hub / github.com/FastLED/FastLED / format

Method format

src/fl/stl/format.h:323–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321 FormatArg(unsigned char v) : mType(Type::UInt) { mData.u = v; }
322
323 fl::string format(const FormatSpec& spec) const {
324 switch (mType) {
325 case Type::Int: return format_integer(mData.i, spec);
326 case Type::UInt: return format_integer(mData.u, spec);
327 case Type::Long: return format_integer(mData.l, spec);
328 case Type::ULong: return format_integer(mData.ul, spec);
329 case Type::LongLong: return format_integer(mData.ll, spec);
330 case Type::ULongLong: return format_integer(mData.ull, spec);
331 case Type::Double: return format_float(mData.d, spec);
332 case Type::Char: {
333 if (spec.type == 'd' || spec.type == 'x' || spec.type == 'X' ||
334 spec.type == 'b' || spec.type == 'o') {
335 return format_integer(static_cast<int>(mData.c), spec);
336 }
337 char buf[2] = {mData.c, '\0'};
338 return fl::string(buf);
339 }
340 case Type::CString: return format_string(mData.s, spec);
341 case Type::String: return format_string(mData.str->c_str(), spec);
342 case Type::Pointer: return format_pointer(mData.p, spec);
343 case Type::None:
344 default: return fl::string("<invalid>");
345 }
346 }
347
348 bool valid() const { return mType != Type::None; }
349

Callers 10

format_implFunction · 0.80
make_diffFunction · 0.80
run_clang_format_diffFunction · 0.80
print_troubleFunction · 0.80
mainFunction · 0.80
resolve_nmFunction · 0.80
build_qemu_commandMethod · 0.80

Calls 6

format_integerFunction · 0.85
format_stringFunction · 0.85
format_pointerFunction · 0.85
format_floatFunction · 0.70
stringClass · 0.70
c_strMethod · 0.45