Struct StartupResult

Struct Documentation

struct StartupResult

Owns the constructed context and selected runtime policy.

Help or validation errors leave context empty and provide the process exit_code instead.

Calling make_runtime(game) with an empty context throws CE::Exceptions::failed_operation; invalid selected runtime policies and allocation failures can also propagate. Construction from a temporary result is deleted to prevent borrowing its soon-destroyed context.

See also

Detailed guide

Runtime construction

make_runtime(game) is available on a const lvalue result. It returns an unstarted runtime configured with this result’s mode, polling and timing settings. The result/context and borrowed game must outlive runtime execution and cleanup. Construction does not begin the context’s single runtime session.

Public Functions

inline bool should_start() const noexcept

Declaration: [[nodiscard]]

Check whether initialization produced a context.

See also

Detailed guide

Returns:

context != nullptr; false means use exit_code without constructing/running a game runtime.

CE::Runtime::GameRuntime make_runtime(CE::Game::AbstractGame &game) const &

Declaration: [[nodiscard]]

Construct an unstarted runtime borrowing context and game; see StartupResult lifetime and construction contract.

CE::Runtime::GameRuntime make_runtime(CE::Game::AbstractGame &game) const && = delete

Disabled for temporary results, whose context would not outlive the runtime.

Public Members

std::unique_ptr<CE::Runtime::Context> context = {}

Owned constructed context, or empty for help/validation results. Must outlive every borrowing runtime.

RuntimeOptions runtime = {}

Selected runtime policy after parsing, copied into make_runtime().

int exit_code = 0

Process result for a context-free help/error result; zero for ordinary success/help.