GGUI::GGText class

Text passed to a widget: a key to look up (what strings convert to), a format with values, or verbatim data. Only valid for the duration of the call.

Public static functions

static auto Verbatim(std::string_view text) -> GGText
Data, not interface text (a player name, a path, a log line). Never looked up.

Constructors, destructors, conversion operators

GGText() defaulted
No text.
GGText(std::string_view text)
A key to look up: a string ID, or source-language text.
GGText(const char* text)
The same, from a C string.
GGText(const std::string& text)
The same, from a string.
GGText(std::string_view format, std::initializer_list<GGTextArg> args)
A format. format is looked up, then each {name} in the result is replaced by that argument. {{ is a literal brace. A placeholder with no argument is left as written.
GGText(std::string_view format, std::span<const GGTextArg> args)
The same, with arguments made at run time (a widget asset's).

Public functions

auto Key() const -> std::string_view
The key, the format, or the verbatim text.
auto Args() const -> std::span<const GGTextArg>
The format's arguments; empty for a plain key.
auto IsVerbatim() const -> bool
Whether it is data, never looked up.