TerminologyEntry.h header

#include <ew/core/TerminologyEntry.h>

Namespace ew::core

TerminologyEntry struct

struct ew::core::TerminologyEntry

One house-style decision about a word or phrase.

This is project DATA, not code, and that is what separates terminology from every other style rule in the app. "Avoid the passive" is advice that holds for any manuscript, so it ships as a rule. "It is *Caer Dathyl*, never *Caer Dathil*" holds for exactly one project, and no shipped list could ever contain it. A house style that cannot be edited by the house is not a house style.

Members

QString ew::core::style::TerminologyEntry::term

The term as it must NOT be written – the misspelling, or the banned word itself.

QString ew::core::style::TerminologyEntry::preferred

For Canonical and Discouraged, what to write instead. Empty for a flat ban.

TermRuling ew::core::style::TerminologyEntry::ruling =

What the entry asks.

QString ew::core::style::TerminologyEntry::note

Why, in the editor's own words ("the client's legal name is one word").

Shown with the finding, because a rule whose reason is unrecorded gets argued about again every time somebody new hits it.

bool ew::core::style::TerminologyEntry::caseSensitive = false

Whether the term must match in case as written.

Off by default, because most house style is about spelling rather than capitals – but a project distinguishing "the Empire" from "the empire" needs it, and cannot express the difference without it.

bool operator==(const TerminologyEntry &, const TerminologyEntry &)=default

Whether two entries say the same thing. Every field participates, because any one of them changes what the rule reports.

Exists so a holder of a compiled house style can tell whether a change actually changed it: rebuilding the style analyzer means rebuilding seven regex-backed rules, and doing that on every command because a keystroke went by would be work with no answer behind it.

Enumerations

enum class TermRuling { Canonical, Banned, Discouraged }

What a terminology entry asks of the writer.

Functions

std::vector< QString > ew::core::style::duplicateTerms(const std::vector< TerminologyEntry > &terminology)

The terms in terminology that more than one entry claims, each named once, spelled as the later entry spells it – that is the row the writer has to go and fix.

A house style with two rulings for one term is a contradiction: the rule matches on both, so every occurrence in the manuscript is flagged twice with opposing advice, and which one the writer sees first is an accident of row order.

Asks termFor rather than comparing terms itself, so the check and the rule can never disagree about what counts as the same term – case sensitivity is the entry's own decision, and a project that distinguishes "the Empire" from "the empire" has written two rules, not one twice.

const TerminologyEntry * ew::core::style::termFor(const std::vector< TerminologyEntry > &terminology, QStringView word)

The entry in terminology matching word, or null when none does.

std::optional< TermRuling > ew::core::style::termRulingFromToken(QStringView token)

Parses a ruling from its serialization token; std::nullopt if unrecognized or absent.

QString ew::core::style::toToken(TermRuling ruling)

Returns the stable serialization token for ruling.