QtCraft API C++ classes QML types Handbook

QcCommandSyntax Namespace

The parameters of a command as its usage text names them (decision E-848), for a command picker with parameter help and completion. More...

Header: #include <common/core/QcCommandSyntax.h>

Classes

struct Form
struct Parameter

Functions

QList<QcCommandSyntax::Form> forms(const QString &usage)
QList<QcCommandSyntax::Parameter> next(const QList<QcCommandSyntax::Form> &forms, const QStringList &words)
QLatin1StringView typeName(QcCommandSyntax::Parameter::Type type)

Detailed Description

The usage texts of the commands follow one notation: forms separated by ", /", " or /" or " | ", plain words as literals, <name> required, [name] optional, <a|b|c> a choice, nested groups as in "[<x> <z> [<x2> <z2>]]". The type of a parameter follows from its name (player, x/y/z, count, block, item, creature, structure, biome, reason ...). Texts that do not follow the notation give one form of plain words; nothing fails.

Classes

class Form

One form of a command's usage. More...

class Parameter

One word of a form: a literal or a placeholder. More...

Function Documentation

QList<QcCommandSyntax::Form> QcCommandSyntax::forms(const QString &usage)

Returns the forms of usage ("Usage: /tp <x> <y> <z>, /tp <player>"); the leading "Usage:" and the command's own name are left out.

QList<QcCommandSyntax::Parameter> QcCommandSyntax::next(const QList<QcCommandSyntax::Form> &forms, const QStringList &words)

Returns the parameters of forms that may follow the words already typed after the command (words), one per form whose literals and choices match them; empty when no form takes another word.

QLatin1StringView QcCommandSyntax::typeName(QcCommandSyntax::Parameter::Type type)

Returns a short English name of type ("player", "integer"), for logs and the control interface.