template struct EE::UI::UIValueResult

Overview

A converted value together with its failure information. More…

#include <uivaluevalidation.hpp>

template <typename T>
struct UIValueResult {
    // fields

    std::optional<T> value;
    UIValueValidationResult validation;

    // construction

    UIValueResult();
    UIValueResult(T value);

    // methods

    operator bool() const;
    static UIValueResult success(T value);
    static UIValueResult error(UIValueValidationResult validation);
    static UIValueResult error(UIValueValidationResult::Code code);
    static UIValueResult error(UIValueValidationResult::Code code, std::string debugMessage);
};

Detailed Documentation

A converted value together with its failure information.

Successful results always contain a value. Failures contain no value and preserve the numeric code and optional diagnostic produced by a converter.