QtCraft API C++ classes QML types Handbook

QcHandbook Class

The handbook of one content registry in one language (built by QcHandbookBuilder): categories with their entries, grouped by pack, and a search over titles in this language and in English. More...

Header: #include <common/handbook/QcHandbook.h>

Public Types

struct Category
struct Contents

Public Functions

QcHandbook()
const QList<QcHandbook::Category> &categories() const
const QcHandbook::Category *category(const QString &id) const
const QList<QcHandbookEntry> &entries() const
const QcHandbookEntry *entry(const QString &id) const
QString label(const QString &key) const
const QString &language() const
QString packName(const QString &id) const
const QList<QcPackReference> &packs() const
const QStringList &problems() const
QList<qsizetype> search(const QString &text, int limit = defaultSearchLimit) const

Static Public Members

const int defaultSearchLimit
QString searchKey(const QString &text)

Detailed Description

Member Function Documentation

[constexpr noexcept default] QcHandbook::QcHandbook()

Default-constructs an instance of QcHandbook.

const QList<QcHandbook::Category> &QcHandbook::categories() const

Returns the categories.

const QcHandbook::Category *QcHandbook::category(const QString &id) const

Returns the category with the id id; null when there is none.

const QList<QcHandbookEntry> &QcHandbook::entries() const

Returns every entry.

const QcHandbookEntry *QcHandbook::entry(const QString &id) const

Returns the entry with the id id; null when there is none.

QString QcHandbook::label(const QString &key) const

Returns the translated text key of the handbook itself for exports ("title", "intro", "contents", "index", "packs", "fact.id"); the key itself when missing.

const QString &QcHandbook::language() const

Returns the language of the texts.

QString QcHandbook::packName(const QString &id) const

Returns the display name of the pack id (its namespace when no such pack was loaded).

const QList<QcPackReference> &QcHandbook::packs() const

Returns the packs in load order; entries of names without a loaded pack come last under their namespace.

const QStringList &QcHandbook::problems() const

Returns the inconsistencies found while building (links to unknown entries, unknown rule placeholders).

Returns the indices of the entries (at most limit) whose title (in this language or English), name or text contains every word of text, best matches first: title equals it, title starts with it, a title word starts with it, title or name contains it, then the text. Case and accents are ignored.

[static] QString QcHandbook::searchKey(const QString &text)

Returns text in lower case without accents, as compared by search().

Member Variable Documentation

const int QcHandbook::defaultSearchLimit

The most results search() returns by default.