QtCraft API C++ classes QML types Handbook

QcMaterialParser Namespace

Parses materials and the part families that turn them into building parts. More...

Header: #include <common/content/blocks/QcMaterialParser.h>

Functions

QList<QJsonObject> morePartRecipesJson(const QcPartFamily &family, const QString &baseBlock, const QString &partName)
QcResult<QcMaterialDefinition> parseMaterial(const QJsonObject &json, const QString &packNamespace)
QcResult<QcPartFamily> parsePartFamily(const QJsonObject &json, const QString &packNamespace)
QJsonObject partRecipeJson(const QcPartFamily &family, const QString &baseBlock, const QString &partName)
QStringList siblingSuffixes(const QcPartFamily &family)

Detailed Description

Function Documentation

QList<QJsonObject> QcMaterialParser::morePartRecipesJson(const QcPartFamily &family, const QString &baseBlock, const QString &partName)

Returns the recipe files of the further recipes (moreRecipes) of family for the part partName made from baseBlock, resolved the same way; each is named "<partName>_<name>".

QcResult<QcMaterialDefinition> QcMaterialParser::parseMaterial(const QJsonObject &json, const QString &packNamespace)

Returns the material or exclusion entry read from json, names qualified in packNamespace, or the error.

QcResult<QcPartFamily> QcMaterialParser::parsePartFamily(const QJsonObject &json, const QString &packNamespace)

Returns the part family read from json, names qualified in packNamespace, or the error; its block and recipe templates are checked on a sample material.

QJsonObject QcMaterialParser::partRecipeJson(const QcPartFamily &family, const QString &baseBlock, const QString &partName)

Returns the recipe file of the part partName: the recipe of family with "@" replaced by baseBlock and "@<suffix>" by the material's part of that suffix; the recipe is named partName and makes it unless the template names a "result".

QStringList QcMaterialParser::siblingSuffixes(const QcPartFamily &family)

Returns the suffixes of other parts of the same material that the recipes of family name ("@slab"); a part is only made for materials that have them.