Skip to content

ConfigResult

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

Represents either a validated Config or the complete list of validation errors.

Use the result in a boolean context before calling value(). When validation fails, errors() and errorString() expose every issue found in the input instead of stopping at the first property.

ReturnNameDescription
operator bool constReturns true only when validation produced a normalized configuration value and no errors.
Configvalue constReturns the normalized configuration value.
QList<ConfigError>errors constReturns all validation errors in deterministic schema/key order.
QStringerrorString constJoins all formatted validation errors with newline separators.
ConfigResult
ConfigResult explicit
ConfigResult explicitCreates a failed ConfigResult from a pre-built list of validation errors.

const
operator bool() const

Returns true only when validation produced a normalized configuration value and no errors.


const
Config value() const

Returns the normalized configuration value.


const
QList<ConfigError> errors() const

Returns all validation errors in deterministic schema/key order.


const
QString errorString() const

Joins all formatted validation errors with newline separators.


ConfigResult()

explicit
explicit ConfigResult(const Config& value)

explicit
explicit ConfigResult(const QList<ConfigError>& errors)

Creates a failed ConfigResult from a pre-built list of validation errors.

A failed ConfigResult preserving every supplied error in order.

NameTypeDescription
errorsconst QList<ConfigError>&Validation errors to embed in the result.