QcHandbookText Class
The texts of a handbook in one language: translations of content and handbook labels, numbers with units, and the rule and key placeholders in descriptions and chapters. More...
| Header: | #include <common/handbook/builder/QcHandbookText.h> |
Public Functions
| void | addProblem(const QString &problem) |
| QString | description(const QString &key, const QString &context) |
| QString | dropNote(const QcItemDrop &drop) const |
| QString | foodPoints(int value) const |
| QString | healthPoints(double value) const |
| QString | heightRange(int minY, int maxY) const |
| QString | label(const QString &key) const |
| const QString & | language() const |
| QString | lookup(const QString &key) const |
| QString | lookup(const QString &key, const QString &language) const |
| QString | machineName(const QString &category) const |
| QString | number(double value) const |
| QString | percent(double share) const |
| QString | recipeKindName(const QString &kind) const |
| std::optional<double> | rule(const QString &name) const |
| QString | seconds(double value) const |
| QString | substituteRules(const QString &text, const QString &context) |
| QStringList | takeProblems() |
| QString | toolName(const QString &tool) const |
| QString | yesNo(bool value) const |
Static Public Members
| QString | english() |
Detailed Description
Collects the problems found while building the handbook.
Member Function Documentation
void QcHandbookText::addProblem(const QString &problem)
Records problem.
QString QcHandbookText::description(const QString &key, const QString &context)
Returns the translation of key with its placeholders filled (substituteRules(), problems reported for context); empty without a translation.
QString QcHandbookText::dropNote(const QcItemDrop &drop) const
Returns the note of a link to the source of drop: its count or range when not 1 and its chance when below 1; empty otherwise.
[static] QString QcHandbookText::english()
Returns the language of the English titles every entry carries for the search.
QString QcHandbookText::foodPoints(int value) const
Returns value with the unit of food points.
QString QcHandbookText::healthPoints(double value) const
Returns value with the unit of health points.
QString QcHandbookText::heightRange(int minY, int maxY) const
Returns the height range from minY to maxY.
QString QcHandbookText::label(const QString &key) const
Returns the handbook label key ("handbook.<key>"); the key itself shows up when the content lacks the translation.
const QString &QcHandbookText::language() const
Returns the handbook's language.
QString QcHandbookText::lookup(const QString &key) const
Returns the translation of key in the handbook's language (English as fallback), empty without one.
QString QcHandbookText::lookup(const QString &key, const QString &language) const
Returns the translation of key in language (English as fallback), empty without one.
QString QcHandbookText::machineName(const QString &category) const
Returns the name of the machines of the recipe category; the category itself without a translation.
QString QcHandbookText::number(double value) const
Returns value in the language's number format, rounded to at most two decimals.
QString QcHandbookText::percent(double share) const
Returns share (0..1) as a percentage.
QString QcHandbookText::recipeKindName(const QString &kind) const
Returns the name of the smelting recipe kind (QcSmeltingRecipe::kind, decision E-770); empty: everything else.
std::optional<double> QcHandbookText::rule(const QString &name) const
Returns the rule value name (server rules and content values, see addContentValues()).
QString QcHandbookText::seconds(double value) const
Returns value with the unit of seconds.
QString QcHandbookText::substituteRules(const QString &text, const QString &context)
Returns text with its placeholders "{name}" filled: key placeholders with key names, rules with their values. Unknown names stay as they are and are reported as problems of context.
QStringList QcHandbookText::takeProblems()
Returns the problems recorded so far and forgets them.
QString QcHandbookText::toolName(const QString &tool) const
Returns the name of the tool category tool; the category itself without a translation.
QString QcHandbookText::yesNo(bool value) const
Returns "yes" or "no" for value.