StyleFinding.h header
#include <ew/app/StyleFinding.h>
Namespace ew::app
StyleFinding struct
struct ew::app::StyleFinding
What one style rule found: a flagged span of the analyzed text, the category of issue, a human-readable explanation, and the corrections offered for it. Offsets are UTF-16 code-unit indices into the text that was analyzed, matching QString's native indexing.
The rules' own vocabulary, not the product's. A rule is a contributor; the validator is StyleAnalyzer, and what it emits is an ew::app::diagnostics::Diagnostic like every other validator in the product. This exists so a rule can say what it found in the terms it thinks in – a span and a category – without every one of them having to assemble a rule id, a severity and a fingerprint, which is twenty more chances to get wrong what only needs getting right once.
Members
qsizetype ew::app::style::StyleFinding::offset = 0
Code-unit offset of the flagged span within the analyzed text.
qsizetype ew::app::style::StyleFinding::length = 0
Length of the flagged span in code units.
StyleCategory ew::app::style::StyleFinding::category =
The kind of issue, used to group and colour the diagnostic.
QString ew::app::style::StyleFinding::message
Human-readable explanation of the issue.
std::vector<StyleFix> ew::app::style::StyleFinding::fixes
The corrections offered, best first, each applicable by plain substitution (see StyleFix). Empty when the issue has no mechanical fix – a passive construction or an over-long sentence needs the writer (or the assistant) to recast it, and offering a wrong one-click edit would be worse than offering none.
bool operator==(const StyleFinding &, const StyleFinding &)=default
Diagnostics compare equal when every field matches.
Functions
std::vector< StyleFinding > ew::app::style::diagnosticsCovering(const std::vector< StyleFinding > &diagnostics, qsizetype offset)
Those of diagnostics whose flagged span covers offset, narrowest first. The span is half-open, so the offset just past a flagged word belongs to what follows rather than to it. Several issues can share one point – an adverb inside a passive clause inside an over-long sentence – and the narrowest is the one a reader pointing there meant.