27 virtual bool Filter(std::string& )
const {
return false; }
44 template<NumericFieldType T>
47 std::string
Format(
const T& value,
bool editing)
const
50 if constexpr (std::is_floating_point_v<T>)
51 if (editing && !std::isfinite(value))
58 bool Parse(std::string_view text, T& value)
const
What an editable field takes as text, asked while it is edited.
Definition gui_text_converter.h:19
virtual bool AcceptsCharacter(uint32_t) const
Whether typing codepoint can be part of the text.
Definition gui_text_converter.h:24
virtual bool Filter(std::string &) const
Strips what the text can't hold (pasted or dropped text, a typed character); true if text changed.
Definition gui_text_converter.h:27
virtual bool AcceptsComposition() const
Whether an IME may compose text into the field.
Definition gui_text_converter.h:29
virtual ~ITextValidator()=default
Definition gui_text_converter.h:42
const TextConverter< T > & DefaultTextConverter()
The converter a field uses for T when it is given none.
Definition gui_text_converter.h:74
std::string FormatNumber(NumericType type, const NumericValue &value)
value as text; floats use up to 9 significant digits, NaN and infinities spelled out.
NumericType CopyNumericTypeTo(const T &, NumericValue &dst)
Definition gui_numeric_type.h:64
NumericType
Definition gui_numeric_type.h:15
bool FilterNumberText(NumericType type, std::string &text)
Strips what a number of type can't hold (letters, a second dot, ...).
bool ParseNumber(std::string_view text, NumericType type, NumericValue &outValue)
The whole text as a number of type: in range and, for floats, finite.
bool IsNumberCharacter(NumericType type, uint32_t codepoint)
Whether codepoint can be typed into a number of type.
constexpr NumericType GetNumericType(const T &)
Definition gui_numeric_type.h:52
@ None
not a numeric type
Definition gui_numeric_type.h:16
Definition gui_logging.h:24
std::string Format(const T &value, bool editing) const
Definition gui_text_converter.h:47
bool AcceptsCharacter(uint32_t codepoint) const override
Whether typing codepoint can be part of the text.
Definition gui_text_converter.h:67
bool Parse(std::string_view text, T &value) const
Definition gui_text_converter.h:58
bool Filter(std::string &text) const override
Strips what the text can't hold (pasted or dropped text, a typed character); true if text changed.
Definition gui_text_converter.h:68
bool AcceptsComposition() const override
Whether an IME may compose text into the field.
Definition gui_text_converter.h:69
Turns a field's value into the text it shows and edits, and edited text back into a value.
Definition gui_text_converter.h:39
Definition gui_numeric_type.h:37