QcSignText Namespace
The text on a sign (decision E-766): up to four lines that a player writes and everyone reads. More...
| Header: | #include <common/world/QcSignText.h> |
Classes
Types
Variables
| const qsizetype | maxColorUnits |
| const int | maxLineLength |
| const qsizetype | maxLineUnits |
| const int | maxLines |
Functions
| QcSignText::Lines | cleaned(const QcSignText::Lines &lines, int count, int lineLength) |
| std::optional<QString> | colorOfDye(QStringView dye) |
| bool | fitsWire(const QcSignText::Lines &lines) |
| QcSignText::Ink | inkOf(QStringView color) |
| bool | isBlank(const QcSignText::Text &text) |
| bool | isEmpty(const QcSignText::Lines &lines) |
Detailed Description
Lines are cleaned like names (QcNameText): no control or format characters, trimmed, at most a block's QcSignDefinition::lineLength characters (code points, cut between graphemes).
Classes
class Ink
The ink of a sign text colour as red, green and blue (decision E-830): a tone of the dye dark enough to stand off the lightest planks (birch) at a contrast of at least 2:1. More...
class Text
The text of one sign: its lines and the colour a dye gave them (decision E-830), the dye's name (QcItemDefinition::dye); empty for the default, which is also what black dye gives. More...
Type Documentation
[alias] QcSignText::Lines
The lines of a sign, top first.
Variable Documentation
const qsizetype QcSignText::maxColorUnits
UTF-16 units of a colour name on the wire and in a save at most.
const int QcSignText::maxLineLength
Characters of a line at most in any block's data.
const qsizetype QcSignText::maxLineUnits
UTF-16 units of a line on the wire and in a save at most (before cleaning).
const int QcSignText::maxLines
Lines of a sign at most.
Function Documentation
QcSignText::Lines QcSignText::cleaned(const QcSignText::Lines &lines, int count, int lineLength)
Returns lines as a sign with count lines of at most lineLength characters keeps them: each line cleaned, lines from count on empty.
std::optional<QString> QcSignText::colorOfDye(QStringView dye)
Returns the colour a dye named dye gives sign text as kept in a Text (black: empty); std::nullopt for a name that is no dye colour of signs (the 16 dye colours).
bool QcSignText::fitsWire(const QcSignText::Lines &lines)
Returns whether every line of lines fits the wire (maxLineUnits).
QcSignText::Ink QcSignText::inkOf(QStringView color)
Returns the ink of color (a Text's colour); the default ink for empty and unknown names.
bool QcSignText::isBlank(const QcSignText::Text &text)
Returns whether text has no lines and the default colour: nothing to keep for the sign.
bool QcSignText::isEmpty(const QcSignText::Lines &lines)
Returns whether every line of lines is empty.