Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorConfig::ChoiceDef Struct Reference

One legal value of an enum-style key: the value as stored, plus a stable token naming it. More...

#include <phosphor-config/include/PhosphorConfig/Schema.h>

Public Attributes

QVariant value
 The value as persisted — an int for a C++ enum, a string for a token-valued key.
 
QString token
 Stable identifier for this choice, e.g.
 

Detailed Description

One legal value of an enum-style key: the value as stored, plus a stable token naming it.

The token is deliberately NOT user-facing text. A key's legal values are semantics and belong with the key; the words for them are presentation and belong to the consumer, which knows its own locale and audience. Keeping them apart is what lets this library stay free of any i18n dependency while still telling a caller that a setting takes one of three values.

Without this, enum-ness is only expressible inside KeyDef::validator as a range clamp, which no caller can read back: a consumer building a settings UI or a config diff has no way to learn that 2 is a legal value, let alone what distinguishes it from 1.

Member Data Documentation

◆ token

QString PhosphorConfig::ChoiceDef::token

Stable identifier for this choice, e.g.

"vertical". Never translated, never shown to a user, and never renamed once shipped: consumers key their label tables off it.

◆ value

QVariant PhosphorConfig::ChoiceDef::value

The value as persisted — an int for a C++ enum, a string for a token-valued key.


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