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

◆ format_arg() [4/4]

template<typename T>
fl::enable_if< fl::is_pointer< T >::value >::type fl::printf_detail::format_arg ( sstream & stream,
const FormatSpec & spec,
const T & arg )

Definition at line 489 of file stdio.h.

489 {
491 bool is_numeric = false;
492
493 if (spec.type == 'p') {
494 // Pointer format - always prefix with "0x"
495 is_numeric = true;
496
497 // Convert pointer to integer address using SFINAE helper
498 fl::uptr addr = pointer_to_uptr(arg);
499
500 // Format as hex with 0x prefix (always use lowercase for standard compatibility)
501 result = fl::string("0x") + fl::to_hex(addr, false);
502 } else {
503 result = "<type_error>";
504 }
505
506 // Apply width and padding
507 result = apply_width(result, spec, is_numeric);
508
509 // Output final result
510 stream << result;
511}
fl::string apply_width(const fl::string &str, const FormatSpec &spec, bool is_numeric=false) FL_NOEXCEPT
Definition stdio.h:220
fl::enable_if< fl::is_pointer< T >::value, fl::uptr >::type pointer_to_uptr(const T &ptr) FL_NOEXCEPT
Definition stdio.h:349
fl::string to_hex(T value, bool uppercase=false, bool pad_to_width=false) FL_NOEXCEPT
Convert an integer value to hexadecimal string representation.
Definition string.h:517
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References apply_width(), FL_NOEXCEPT, pointer_to_uptr(), and fl::to_hex().

+ Here is the call graph for this function: