QcHoldParser Namespace
Parses how items are held (decision E-831): the hold object of an item or block and the category defaults in held.json. More...
| Header: | #include <common/content/items/QcHoldParser.h> |
Classes
| struct | Range |
Variables
| const double | maxRotate |
| const double | maxScale |
| const double | maxTranslate |
| const double | minScale |
Functions
| QcHoldDisplay | holdOf(QcJsonFieldReader &reader) |
| QcHoldDisplay | parseHold(const QJsonObject &json, QcJsonFieldReader &reader) |
| QcResult<QcHoldDefaults> | parseHoldDefaults(const QJsonObject &json, const QString &packNamespace) |
Detailed Description
A hold object has "category" (only on a definition), "grip" ("base", "handle", "middle") and "firstPerson"/"thirdPerson" objects with "translate" [x, y, z] in metres (each within ±maxTranslate), "rotate" [x, y, z] in degrees (±maxRotate) and "scale", a number or [x, y, z] (minScale..maxScale metres per unit); "swing", "drawn" and "thirdPersonDrawn" objects have "translate" and "rotate" like "firstPerson" (no "scale"). Values out of range or of the wrong type refuse the definition; unknown keys are only warned about (lcRegistry).
Variable Documentation
const double QcHoldParser::maxRotate
Largest absolute value of a rotate component, in degrees.
const double QcHoldParser::maxScale
Largest scale component, in metres per unit.
const double QcHoldParser::maxTranslate
Largest absolute value of a translate component, in metres.
const double QcHoldParser::minScale
Smallest scale component, in metres per unit.
Function Documentation
QcHoldDisplay QcHoldParser::holdOf(QcJsonFieldReader &reader)
Returns the optional hold object of the item or block reader reads; an empty display without one.
QcHoldDisplay QcHoldParser::parseHold(const QJsonObject &json, QcJsonFieldReader &reader)
Returns the display read from json, the hold object of an item or block; failures go to reader.
QcResult<QcHoldDefaults> QcHoldParser::parseHoldDefaults(const QJsonObject &json, const QString &packNamespace)
Returns the category defaults read from json, the content of held.json: {"categories": {"tool": {hold object without "category"}, ...}}, or the first failure. An unknown category is warned about and skipped. packNamespace is unused (category names are fixed); it keeps the signature of the other settings file parsers.