Skip to content

Config

#include <mrx/core/config/ConfigSchema.hpp>
class mrx::core::Config

Stores the normalized values returned after successful schema validation.

A Config is read-only from the consumer’s perspective. Values are keyed internally by their dotted section/property path and can be retrieved either as QVariant or through value<T>(). A Config returned by a successful ConfigResult has already passed schema validation, so concise typed reads are guarded as programmer-error preconditions instead of per-read validation decisions.

ReturnNameDescription
boolcontains constChecks whether a validated property is available.
Tvalue const inlineReturns a normalized property from a successfully validated Config snapshot.
Tvalue const inlineProbes a normalized property only when its stored type exactly matches the requested type.

const
bool contains(const QString& section, const QString& property) const

Checks whether a validated property is available.

true when the normalized configuration contains the property.

NameTypeDescription
sectionconst QString&Section name.
propertyconst QString&Property name.

const inline
template<typename T> inline T value(const QString& section, const QString& property) const

Returns a normalized property from a successfully validated Config snapshot.

Typed property value.

This accessor is intentionally concise for the normal consumer path: call it only on Config instances returned by a successful ConfigResult, and request the same type declared in ConfigSchema. The method checks the schema-recorded metatype exactly, so debug builds assert if the path is absent or the requested type differs from the declared type. Use contains() or this overload when intentionally probing optional paths outside that validated-snapshot contract.

NameTypeDescription
sectionconst QString&Section name.
propertyconst QString&Property name.

const inline
template<typename T> inline T value(const QString& section, const QString& property, bool& ok) const

Probes a normalized property only when its stored type exactly matches the requested type.

Typed property value, or T() when the property is absent or stores another type.

QVariant can perform broad implicit conversions, such as converting an integer to bool. ConfigSchema stores normalized values with the declared schema type, so this overload deliberately checks the stored metatype before returning a value. Prefer the two-argument value<T>() accessor for ordinary reads from successful ConfigResult snapshots; keep this overload for diagnostics or compatibility code that deliberately probes a path.

NameTypeDescription
sectionconst QString&Section name.
propertyconst QString&Property name.
okbool&Output flag set to true only when the property exists and stores T.