StyleDiagnostic.h header
#include <ew/app/StyleDiagnostic.h>
Namespace ew::app
StyleDiagnostic struct
struct ew::app::StyleDiagnostic
One writing issue found by the style engine: 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.
Members
qsizetype ew::app::style::StyleDiagnostic::offset = 0
Code-unit offset of the flagged span within the analyzed text.
qsizetype ew::app::style::StyleDiagnostic::length = 0
Length of the flagged span in code units.
StyleCategory ew::app::style::StyleDiagnostic::category =
The kind of issue, used to group and colour the diagnostic.
QString ew::app::style::StyleDiagnostic::message
Human-readable explanation of the issue.
std::vector<StyleFix> ew::app::style::StyleDiagnostic::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 StyleDiagnostic &, const StyleDiagnostic &)=default
Diagnostics compare equal when every field matches.
Functions
std::vector< StyleDiagnostic > ew::app::style::diagnosticsCovering(const std::vector< StyleDiagnostic > &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.