Porytiles
Loading...
Searching...
No Matches
std::formatter< porytiles::Rgba32 > Struct Reference

std::formatter specialization for Rgba32. More...

#include <rgba32.hpp>

Public Member Functions

constexpr auto parse (std::format_parse_context &ctx)
 
auto format (const porytiles::Rgba32 &rgba, auto &ctx) const
 

Detailed Description

std::formatter specialization for Rgba32.

Enables Rgba32 to be used with std::format() and related formatting functions. This makes Rgba32 participate in the FormatParam string conversion chain via the std::formattable concept.

Example usage:

++
Rgba32 color{255, 128, 0, 255};
std::string s = std::format("Color: {}", color); // "Color: [255, 128, 0, 255]"
// Works automatically with FormatParam:
FormattableError{"Invalid color: {}", FormatParam{color, Style::bold}};

This is the recommended way to add formatting support for custom types in Porytiles. The formatter delegates to the porytiles::to_string() overload for consistent string representation across the codebase.

Definition at line 218 of file rgba32.hpp.

Member Function Documentation

◆ format()

auto std::formatter< porytiles::Rgba32 >::format ( const porytiles::Rgba32 rgba,
auto &  ctx 
) const
inline

Definition at line 224 of file rgba32.hpp.

◆ parse()

constexpr auto std::formatter< porytiles::Rgba32 >::parse ( std::format_parse_context &  ctx)
inlineconstexpr

Definition at line 219 of file rgba32.hpp.


The documentation for this struct was generated from the following file: