struct EE::UI::UIValueValidationResult

Overview

Machine-readable result of converting or accepting a widget value. More…

#include <uivaluevalidation.hpp>

struct UIValueValidationResult {
    // typedefs

    typedef Uint32 Code;

    // fields

    bool valid { true };
    std::optional<Code> code;
    std::optional<std::string> debugMessage;

    // methods

    operator bool() const;
    bool operator==(const UIValueValidationResult& other) const;
    bool operator!=(const UIValueValidationResult& other) const;
    static UIValueValidationResult success();
    static UIValueValidationResult error(Code code);
    static UIValueValidationResult error(Code code, std::string debugMessage);
    static UIValueValidationResult error(std::string debugMessage);
};

Detailed Documentation

Machine-readable result of converting or accepting a widget value.

A numeric code is the normal way to identify an error. Applications can map that code, together with the binding or form context, to localized UI text. debugMessage is optional diagnostic information for logs, tests, and inspection; it should not be shown to users implicitly.

Codes are owned by the subsystem or application defining the validation rule. Apart from values in UIValueValidationError, eepp does not require codes to be globally unique or stable for serialization. Code 0 is valid: the optional itself represents the absence of a code.