QtCraft API C++ classes QML types Handbook

QcControlArguments Class

Typed access to the parameters of a control request. More...

Header: #include <clientcore/control/QcControlArguments.h>

Static Public Members

QcBlockPos block(const QJsonObject &request)
std::optional<QcBlockFace> face(const QJsonObject &request)
QString faceName(QcBlockFace face)
int intField(const QJsonObject &request, const QString &key, int fallback)
const int maxCommandTicks
int ticks(const QJsonObject &request, int fallback)
std::optional<QString> typeError(const QJsonObject &request)

Detailed Description

Member Function Documentation

[static] QcBlockPos QcControlArguments::block(const QJsonObject &request)

Returns the cell the parameters x, y, z of request name.

[static] std::optional<QcBlockFace> QcControlArguments::face(const QJsonObject &request)

Returns the parameter face of request, up when omitted; nullopt for an unknown name.

[static] QString QcControlArguments::faceName(QcBlockFace face)

Returns the name of face in requests ("up", "north", ...).

[static] int QcControlArguments::intField(const QJsonObject &request, const QString &key, int fallback)

Returns the integer key of request; fallback when it is missing or not a whole number.

[static] int QcControlArguments::ticks(const QJsonObject &request, int fallback)

Returns the parameter ticks of request clamped to 0..maxCommandTicks; fallback when it is missing.

[static] std::optional<QString> QcControlArguments::typeError(const QJsonObject &request)

Returns the error message for the first parameter of the wrong JSON type of request, if any.

Member Variable Documentation

const int QcControlArguments::maxCommandTicks

Longest wait a tick-based command accepts.