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

◆ format_arg() [7/7]

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 645 of file stdio.h.

645 {
647 bool is_numeric = false;
648
649 if (spec.type == 'p') {
650 // Pointer format - always prefix with "0x"
651 is_numeric = true;
652
653 // Convert pointer to integer address using SFINAE helper
654 fl::uptr addr = pointer_to_uptr(arg);
655
656 // Format as hex with 0x prefix (always use lowercase for standard compatibility)
657 result = fl::string("0x") + fl::to_hex(addr, false);
658 } else {
659 result = "<type_error>";
660 }
661
662 // Apply width and padding
663 result = apply_width(result, spec, is_numeric);
664
665 // Output final result
666 stream << result;
667}
fl::string apply_width(const fl::string &str, const FormatSpec &spec, bool is_numeric=false) FL_NO_EXCEPT
Definition stdio.h:247
fl::enable_if< fl::is_pointer< T >::value, fl::uptr >::type pointer_to_uptr(const T &ptr) FL_NO_EXCEPT
Definition stdio.h:436
fl::string to_hex(T value, bool uppercase=false, bool pad_to_width=false) FL_NO_EXCEPT
Convert an integer value to hexadecimal string representation.
Definition string.h:526
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References apply_width(), fl::FL_NO_EXCEPT, pointer_to_uptr(), fl::to_hex(), and fl::printf_detail::FormatSpec::type.

+ Here is the call graph for this function: