TnxViewModels namespace

The registry of view model types, and how bindings read their values.

Classes

struct Field
A field of a view model, where it is in its struct.
struct TypeInfo
A registered view model type.

Enums

enum class FieldKind: uint8_t { Float, Double, Signed, Unsigned, Bool, Fixed }
How a field's bytes are read as a number.

Functions

void RegisterType(TypeInfo info)
Make a view model type known. TNX_REGISTER_VIEW_MODEL calls it.
auto FindType(std::string_view name) -> const TypeInfo*
The type registered by that name; null if there is none.
auto Types() -> const std::vector<TypeInfo>&
Every registered type, in the order registered.
auto Reader(const GGUI::BindingReader& next) -> GGUI::BindingReader
Reads view model targets; anything else goes to next.
auto IsViewModel(GGUI::BindTarget target) -> bool
True if target is a view model's.
auto CopyValues(GGUI::BindTarget target, std::string_view type, void* out, size_t size) -> bool
Copy the values of the view model target names into out, if it is of type type and size bytes. False if it is gone or another type.
template<typename T, typename TMember>
auto FieldIndex(TMember T::* member) -> int
The field's index among its view model's read fields (TypeInfo::Fields), or -1 if it isn't one of them.

Enum documentation

enum class TnxViewModels::FieldKind: uint8_t

How a field's bytes are read as a number.

Function documentation

void TnxViewModels::RegisterType(TypeInfo info)

Make a view model type known. TNX_REGISTER_VIEW_MODEL calls it.

const TypeInfo* TnxViewModels::FindType(std::string_view name)

The type registered by that name; null if there is none.

const std::vector<TypeInfo>& TnxViewModels::Types()

Every registered type, in the order registered.

GGUI::BindingReader TnxViewModels::Reader(const GGUI::BindingReader& next)

Reads view model targets; anything else goes to next.

bool TnxViewModels::IsViewModel(GGUI::BindTarget target)

True if target is a view model's.

bool TnxViewModels::CopyValues(GGUI::BindTarget target, std::string_view type, void* out, size_t size)

Copy the values of the view model target names into out, if it is of type type and size bytes. False if it is gone or another type.

template<typename T, typename TMember>
int TnxViewModels::FieldIndex(TMember T::* member)

The field's index among its view model's read fields (TypeInfo::Fields), or -1 if it isn't one of them.