|
Porytiles
|
TextFormatter implementation that strips all styling from text. More...
#include <plain_text_formatter.hpp>
Public Member Functions | |
| std::string | style (const std::string &text, Style style) const override |
| Returns text unchanged, ignoring all styling. | |
Public Member Functions inherited from porytiles2::TextFormatter | |
| virtual | ~TextFormatter ()=default |
| virtual std::string | format (const std::string &format_str, const std::vector< FormatParam > ¶ms) const |
| Formats a string with styled parameters using fmtlib syntax. | |
| template<typename FirstParam , typename... RestParams> requires ( !std::is_same_v<std::decay_t<FirstParam>, std::vector<FormatParam>> && std::is_constructible_v<FormatParam, FirstParam> && (std::is_constructible_v<FormatParam, RestParams> && ...)) | |
| std::string | format (const std::string &format_str, FirstParam &&first, RestParams &&...rest) const |
| Formats a string with styled parameters using variadic template syntax. | |
TextFormatter implementation that strips all styling from text.
PlainTextFormatter is a concrete implementation of TextFormatter that returns text without any styling applied, regardless of the Style flags provided. This formatter is intended for use when output is directed to non-TTY destinations such as files or pipes, where ANSI escape codes would appear as visible garbage characters.
The style() method ignores all Style flags and returns the input text unchanged, effectively stripping any requested styling. This ensures clean, readable output in contexts where terminal styling is not appropriate.
Usage context:
Definition at line 24 of file plain_text_formatter.hpp.
|
overridevirtual |
Returns text unchanged, ignoring all styling.
Implements the style() interface by simply returning the input text without applying any formatting, regardless of the Style flags provided. This ensures output remains clean and readable in non-TTY contexts.
| text | The text to format |
| style | The Style flags (ignored in this implementation) |
Implements porytiles2::TextFormatter.
Definition at line 7 of file plain_text_formatter.cpp.