Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
MatchTypes.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <QLatin1StringView>
7#include <QSet>
8#include <QString>
9#include <QStringView>
10
11#include <cmath>
12#include <optional>
13
14namespace PhosphorRules {
15
23enum class Field : int {
24 // ── Window properties [0, 29] ────────────────────────────────────────
25 AppId = 0,
29 Pid = 4,
30 Title = 5,
35 ScreenId = 10,
37 Activity = 12,
42 Width = 17,
43 Height = 18,
49 IsModal = 24,
55 // ── PlasmaZones extension fields [30, 33] ────────────────────────────
57 IsSnapped = 31,
58 Zone = 32,
59 IsTiled = 33,
60 // ── Context placement-mode field [34] ────────────────────────────────
61 Mode = 34,
62 // ── Context tiling-environment field [35] ────────────────────────────
64 // ── Window capability fields [36, 37] ────────────────────────────────
65 IsMovable = 36,
67 // ── Context screen-orientation field [38] ────────────────────────────
69 // ── Context active-layout field [39] ─────────────────────────────────
72 // ── Context colour-scheme field [40] ─────────────────────────────────
74 // ── Context screen-size fields [41, 43] ──────────────────────────────
78};
79
83inline constexpr int FieldCount = static_cast<int>(Field::ScreenAspectRatio) + 1;
84
108namespace ModeToken {
109inline constexpr QLatin1StringView Snapping{"snapping"};
110inline constexpr QLatin1StringView Tiling{"tiling"};
111inline constexpr QLatin1StringView Scrolling{"scrolling"};
112} // namespace ModeToken
113
118inline constexpr QLatin1StringView kModeTokens[] = {
122};
123
127{
128 QLatin1StringView token;
129 double ratio;
130};
131
137 {QLatin1StringView("1:1"), 1.0}, {QLatin1StringView("5:4"), 5.0 / 4.0},
138 {QLatin1StringView("4:3"), 4.0 / 3.0}, {QLatin1StringView("3:2"), 3.0 / 2.0},
139 {QLatin1StringView("16:10"), 16.0 / 10.0}, {QLatin1StringView("16:9"), 16.0 / 9.0},
140 {QLatin1StringView("21:9"), 21.0 / 9.0}, {QLatin1StringView("32:10"), 32.0 / 10.0},
141 {QLatin1StringView("32:9"), 32.0 / 9.0}, {QLatin1StringView("4:5"), 4.0 / 5.0},
142 {QLatin1StringView("3:4"), 3.0 / 4.0}, {QLatin1StringView("2:3"), 2.0 / 3.0},
143 {QLatin1StringView("10:16"), 10.0 / 16.0}, {QLatin1StringView("9:16"), 9.0 / 16.0},
144 {QLatin1StringView("9:21"), 9.0 / 21.0}, {QLatin1StringView("10:32"), 10.0 / 32.0},
145 {QLatin1StringView("9:32"), 9.0 / 32.0},
146};
147
153inline QString aspectRatioTokenFor(int width, int height)
154{
155 if (width <= 0 || height <= 0) {
156 return QString();
157 }
158 const double logRatio = std::log(double(width) / double(height));
159 const AspectRatioToken* best = nullptr;
160 double bestDistance = 0.0;
161 for (const AspectRatioToken& candidate : kAspectRatioTokens) {
162 const double distance = std::abs(logRatio - std::log(candidate.ratio));
163 if (!best || distance < bestDistance) {
164 best = &candidate;
165 bestDistance = distance;
166 }
167 }
168 return QString(best->token);
169}
170
176inline QString orientationTokenFor(int width, int height)
177{
178 if (width <= 0 || height <= 0) {
179 return QString();
180 }
181 return height > width ? QStringLiteral("portrait") : QStringLiteral("landscape");
182}
183
184// ── Field descriptor table ──────────────────────────────────────────────────
185// Single source of truth for every field's wire string, value-kind, and
186// source classification. Adding a new field: append an enum value above,
187// bump FieldCount, and add one row here — the classifier functions below
188// derive everything from this table.
189
191enum class FieldType : int {
196};
197
199enum class FieldSource : int {
205};
206
215
217inline constexpr FieldDescriptor kFieldTable[] = {
218 // [0, 29] — Generic window properties
219 {Field::AppId, QLatin1StringView("appId"), FieldType::String, FieldSource::Window},
220 {Field::WindowClass, QLatin1StringView("windowClass"), FieldType::String, FieldSource::Window},
221 {Field::DesktopFile, QLatin1StringView("desktopFile"), FieldType::String, FieldSource::Window},
222 {Field::WindowRole, QLatin1StringView("windowRole"), FieldType::String, FieldSource::Window},
223 {Field::Pid, QLatin1StringView("pid"), FieldType::Int, FieldSource::Window},
224 {Field::Title, QLatin1StringView("title"), FieldType::String, FieldSource::Window},
225 {Field::WindowType, QLatin1StringView("windowType"), FieldType::Enum, FieldSource::Window},
226 {Field::IsSticky, QLatin1StringView("isSticky"), FieldType::Bool, FieldSource::Window},
227 {Field::IsFullscreen, QLatin1StringView("isFullscreen"), FieldType::Bool, FieldSource::Window},
228 {Field::IsMinimized, QLatin1StringView("isMinimized"), FieldType::Bool, FieldSource::Window},
229 {Field::ScreenId, QLatin1StringView("screenId"), FieldType::String, FieldSource::Context},
230 {Field::VirtualDesktop, QLatin1StringView("virtualDesktop"), FieldType::Int, FieldSource::Context},
231 {Field::Activity, QLatin1StringView("activity"), FieldType::String, FieldSource::Context},
232 {Field::IsMaximized, QLatin1StringView("isMaximized"), FieldType::Bool, FieldSource::Window},
233 {Field::IsFocused, QLatin1StringView("isFocused"), FieldType::Bool, FieldSource::Window},
234 {Field::IsTransient, QLatin1StringView("isTransient"), FieldType::Bool, FieldSource::Window},
235 {Field::IsNotification, QLatin1StringView("isNotification"), FieldType::Bool, FieldSource::Window},
236 {Field::Width, QLatin1StringView("width"), FieldType::Int, FieldSource::Window},
237 {Field::Height, QLatin1StringView("height"), FieldType::Int, FieldSource::Window},
238 {Field::KeepAbove, QLatin1StringView("keepAbove"), FieldType::Bool, FieldSource::Window},
239 {Field::KeepBelow, QLatin1StringView("keepBelow"), FieldType::Bool, FieldSource::Window},
240 {Field::SkipTaskbar, QLatin1StringView("skipTaskbar"), FieldType::Bool, FieldSource::Window},
241 {Field::SkipPager, QLatin1StringView("skipPager"), FieldType::Bool, FieldSource::Window},
242 {Field::SkipSwitcher, QLatin1StringView("skipSwitcher"), FieldType::Bool, FieldSource::Window},
243 {Field::IsModal, QLatin1StringView("isModal"), FieldType::Bool, FieldSource::Window},
244 {Field::HasDecoration, QLatin1StringView("hasDecoration"), FieldType::Bool, FieldSource::Window},
245 {Field::IsResizable, QLatin1StringView("isResizable"), FieldType::Bool, FieldSource::Window},
246 {Field::PositionX, QLatin1StringView("positionX"), FieldType::Int, FieldSource::Window},
247 {Field::PositionY, QLatin1StringView("positionY"), FieldType::Int, FieldSource::Window},
248 {Field::CaptionNormal, QLatin1StringView("captionNormal"), FieldType::String, FieldSource::Window},
249 // [30, 33] — PlasmaZones extension fields
250 {Field::IsFloating, QLatin1StringView("isFloating"), FieldType::Bool, FieldSource::Window},
251 {Field::IsSnapped, QLatin1StringView("isSnapped"), FieldType::Bool, FieldSource::Window},
252 {Field::Zone, QLatin1StringView("zone"), FieldType::String, FieldSource::Window},
253 {Field::IsTiled, QLatin1StringView("isTiled"), FieldType::Bool, FieldSource::Window},
254 // [34] — Context placement-mode field. String-valued (the `ModeToken`
255 // vocabulary above) so an `Equals` leaf compares the
256 // token directly, and Context-sourced so it is present during windowless
257 // context resolution — which is what lets a per-mode rule participate in
258 // the gap cascade and pass the context-action compatibility check.
259 // The effect-side WINDOW query re-stamps ModeToken::Scrolling for tiled
260 // windows on scrolling-engine screens (PlasmaZonesEffect::ruleQuery), so
261 // the token matches on both the context and window resolution paths.
262 {Field::Mode, QLatin1StringView("mode"), FieldType::String, FieldSource::Context},
263 // [35] — Tiled-window count for the screen + desktop being resolved. Int-
264 // valued (Equals / GreaterThan / LessThan) and Context-sourced so it is
265 // present during windowless context resolution — which is what lets a
266 // "switch algorithm when a second window opens" rule participate in the
267 // tiling-algorithm slot of the assignment cascade. Absent (predicate
268 // false) when the resolving screen is not actively tiling.
269 {Field::TiledWindowCount, QLatin1StringView("tiledWindowCount"), FieldType::Int, FieldSource::Context},
270 // [36, 37] — Window capability flags (can the window be moved / maximized).
271 // Window-sourced like IsResizable, so inert during windowless context queries.
272 {Field::IsMovable, QLatin1StringView("isMovable"), FieldType::Bool, FieldSource::Window},
273 {Field::IsMaximizable, QLatin1StringView("isMaximizable"), FieldType::Bool, FieldSource::Window},
274 // [38] — Screen orientation ("portrait" / "landscape") of the screen being
275 // resolved. String-valued (Equals against the token) and Context-sourced so
276 // it is present during windowless context resolution — which lets an
277 // orientation rule drive the per-context overrides (gaps, lock, overlay,
278 // tiling and scrolling params, OSD) for a rotated monitor, and the
279 // layout/algorithm assignment itself: LayoutRegistry::resolveAssignmentEntry
280 // stamps it and lets any rule carrying an assignment slot action compete.
281 //
282 // What a non-dimension context field does NOT do is take part in the
283 // Monitors page's per-context projections: `ContextRuleBridge::contextAxisFor`
284 // classifies a match pinning it as CatchAll and `isContextAssignmentRule`
285 // refuses it, so such a rule is never listed or rebuilt as a plain
286 // (screen, desktop, activity) assignment. It wins the cascade through
287 // ordinary rule priority instead.
288 //
289 // Empty when neither a size nor a geometry provider answered. Empty is a
290 // PRESENT value, not an absent one: a positive `Equals` leaf is false
291 // against it, and a NEGATED leaf would match. LayoutRegistry's context
292 // resolvers refuse a rule that negates it while it is empty, so that
293 // inversion does not reach them; any other evaluator of an unstamped query
294 // (the settings and editor processes wire no provider) still sees it.
295 {Field::ScreenOrientation, QLatin1StringView("screenOrientation"), FieldType::String, FieldSource::Context},
296 // [39] — The layout id currently resolved for the screen (snap UUID,
297 // "autotile:<algo>", or the bare "scrolling:" sentinel). String-valued (Equals against the id) and Context-
298 // sourced. Populated by the five daemon-facing resolvers (gap, lock,
299 // overlay, tiling-params, scrolling-params), NOT the assignment cascade —
300 // reading the active layout while resolving it would recurse. Empty
301 // (predicate false) where unpopulated.
302 {Field::ActiveLayout, QLatin1StringView("activeLayout"), FieldType::String, FieldSource::Context},
303 // [40] — The system colour scheme, "light" / "dark". String-valued (Equals
304 // against the token) and Context-sourced so a scheme rule can drive the
305 // per-context override slots — a darker overlay at night, thicker gaps in
306 // a light setup — and the layout/algorithm assignment, which stamps it.
307 // Like ScreenOrientation above it is a NON-DIMENSION context field: it
308 // competes in the cascade through ordinary rule priority, but never takes
309 // part in the Monitors page's per-context projections (contextAxisFor
310 // classifies a match pinning it as CatchAll and isContextAssignmentRule
311 // refuses it).
312 //
313 // Session-wide, not per-screen: the daemon derives it from the application
314 // palette and provides it to the registry, which folds it into every
315 // context query AND every cached resolver's key (a scheme flip is a
316 // non-rule-set input, exactly like orientation). Empty when no provider is
317 // wired, with the same present-but-empty caveat orientation carries: a
318 // positive leaf is false there, a negated leaf matches.
319 {Field::ColorScheme, QLatin1StringView("colorScheme"), FieldType::String, FieldSource::Context},
320 // [41, 43] — The size of the screen being resolved, so one monitor can
321 // resolve differently at different resolutions (a super-ultrawide whose
322 // split mode halves its width, for one). Width and height are in
323 // DEVICE pixels, the output's mode as the display settings report it, not
324 // the scaled logical size: a user types the resolution they see there.
325 // Int-valued (Equals / GreaterThan / LessThan) and Context-sourced.
326 //
327 // The aspect ratio is a closed token vocabulary (`kAspectRatioTokens`
328 // below), the common ratio NEAREST the screen's own, so "32:9" matches a
329 // 5120x1440 panel and "21:9" matches 3440x1440 as well as 2560x1080.
330 // Derived from the same device size through `aspectRatioTokenFor`, the one
331 // helper every producer calls, so the daemon and the effect cannot round
332 // a ratio differently.
333 //
334 // Like ScreenOrientation these are non-dimension context fields: they drive
335 // every context slot including the assignment cascade, through rule
336 // priority, but never the Monitors page's per-context projections. While
337 // the size is unknown (no size provider wired, or it has no answer for the
338 // screen yet) the width and height are ABSENT and the aspect ratio is
339 // present-but-empty. Either way a positive leaf is false, and a negated
340 // one would match. LayoutRegistry's context resolvers refuse a rule that
341 // negates any of the three while the size is unknown, so a "not 32:9" rule
342 // waits for a real size instead of firing on every screen; any other
343 // evaluator of an unstamped query still sees the inversion.
344 {Field::ScreenWidth, QLatin1StringView("screenWidth"), FieldType::Int, FieldSource::Context},
345 {Field::ScreenHeight, QLatin1StringView("screenHeight"), FieldType::Int, FieldSource::Context},
346 {Field::ScreenAspectRatio, QLatin1StringView("screenAspectRatio"), FieldType::String, FieldSource::Context},
347};
348static_assert(sizeof(kFieldTable) / sizeof(kFieldTable[0]) == static_cast<unsigned>(FieldCount),
349 "kFieldTable must have one entry per Field");
350
357inline const QSet<Field>& windowSourcedFields()
358{
359 static const QSet<Field> fields = [] {
360 QSet<Field> out;
361 for (const FieldDescriptor& d : kFieldTable) {
362 if (d.source == FieldSource::Window) {
363 out.insert(d.field);
364 }
365 }
366 return out;
367 }();
368 return fields;
369}
370
371consteval bool verifyFieldTableOrder()
372{
373 for (int i = 0; i < FieldCount; ++i) {
374 if (static_cast<int>(kFieldTable[i].field) != i)
375 return false;
376 }
377 return true;
378}
379static_assert(verifyFieldTableOrder(), "kFieldTable entries must be in Field enum order");
380
381// ── Classifier functions (table-derived) ────────────────────────────────────
382
384inline QString fieldToString(Field field)
385{
386 const int idx = static_cast<int>(field);
387 if (idx >= 0 && idx < FieldCount) {
388 return QString(kFieldTable[idx].wire);
389 }
390 return QStringLiteral("appId");
391}
392
395inline std::optional<Field> fieldFromString(QStringView s)
396{
397 for (const auto& d : kFieldTable) {
398 if (s.compare(d.wire, Qt::CaseInsensitive) == 0) {
399 return d.field;
400 }
401 }
402 return std::nullopt;
403}
404
407inline bool fieldIsString(Field field)
408{
409 const int idx = static_cast<int>(field);
410 return idx >= 0 && idx < FieldCount && kFieldTable[idx].type == FieldType::String;
411}
412
414inline bool fieldIsNumeric(Field field)
415{
416 const int idx = static_cast<int>(field);
417 return idx >= 0 && idx < FieldCount && kFieldTable[idx].type == FieldType::Int;
418}
419
421inline bool fieldIsBool(Field field)
422{
423 const int idx = static_cast<int>(field);
424 return idx >= 0 && idx < FieldCount && kFieldTable[idx].type == FieldType::Bool;
425}
426
431inline bool fieldIsContext(Field field)
432{
433 const int idx = static_cast<int>(field);
434 return idx >= 0 && idx < FieldCount && kFieldTable[idx].source == FieldSource::Context;
435}
436
437// ─────────────────────────────────────────────────────────────────────────────
438
451
454inline constexpr int OperatorCount = static_cast<int>(Operator::LessThan) + 1;
455
457inline QString operatorToString(Operator op)
458{
459 switch (op) {
460 case Operator::Equals:
461 return QStringLiteral("equals");
463 return QStringLiteral("contains");
465 return QStringLiteral("startsWith");
467 return QStringLiteral("endsWith");
468 case Operator::Regex:
469 return QStringLiteral("regex");
471 return QStringLiteral("appIdMatches");
473 return QStringLiteral("greaterThan");
475 return QStringLiteral("lessThan");
476 }
477 return QStringLiteral("equals");
478}
479
481inline std::optional<Operator> operatorFromString(QStringView s)
482{
483 static constexpr std::pair<QLatin1StringView, Operator> kTable[] = {
484 {QLatin1StringView("equals"), Operator::Equals},
485 {QLatin1StringView("contains"), Operator::Contains},
486 {QLatin1StringView("startsWith"), Operator::StartsWith},
487 {QLatin1StringView("endsWith"), Operator::EndsWith},
488 {QLatin1StringView("regex"), Operator::Regex},
489 {QLatin1StringView("appIdMatches"), Operator::AppIdMatches},
490 {QLatin1StringView("greaterThan"), Operator::GreaterThan},
491 {QLatin1StringView("lessThan"), Operator::LessThan},
492 };
493 for (const auto& [token, op] : kTable) {
494 if (s.compare(token, Qt::CaseInsensitive) == 0) {
495 return op;
496 }
497 }
498 return std::nullopt;
499}
500
501} // namespace PhosphorRules
The closed wire vocabulary of Field::Mode — the placement mode a window is in, or that a context reso...
Definition MatchTypes.h:108
constexpr QLatin1StringView Snapping
Definition MatchTypes.h:109
constexpr QLatin1StringView Tiling
autotile OR scrolling-engine tiling
Definition MatchTypes.h:110
constexpr QLatin1StringView Scrolling
Definition MatchTypes.h:111
Definition ActionParams.h:25
constexpr AspectRatioToken kAspectRatioTokens[]
The complete Field::ScreenAspectRatio vocabulary, landscape first and then the portrait forms a rotat...
Definition MatchTypes.h:136
constexpr int FieldCount
The number of distinct Field enumerators.
Definition MatchTypes.h:83
consteval bool verifyFieldTableOrder()
Definition MatchTypes.h:371
bool fieldIsBool(Field field)
True if field carries a boolean value (window-state flags).
Definition MatchTypes.h:421
bool fieldIsContext(Field field)
True if field describes the context a window appears in (screen / virtual desktop / activity / placem...
Definition MatchTypes.h:431
QString operatorToString(Operator op)
Canonical lowercase wire string for an Operator.
Definition MatchTypes.h:457
constexpr QLatin1StringView kModeTokens[]
The complete Field::Mode vocabulary, for callers that validate or enumerate it (a settings picker,...
Definition MatchTypes.h:118
QString aspectRatioTokenFor(int width, int height)
The Field::ScreenAspectRatio token for a width x height screen: the vocabulary entry whose ratio is n...
Definition MatchTypes.h:153
const QSet< Field > & windowSourcedFields()
Every Window-sourced field, derived from the table so a new field can never silently miss it.
Definition MatchTypes.h:357
bool fieldIsString(Field field)
True if field carries a string value (the four string operators and Regex apply to these; numeric/boo...
Definition MatchTypes.h:407
Field
Match fields.
Definition MatchTypes.h:23
@ IsFocused
Definition MatchTypes.h:39
@ WindowType
Definition MatchTypes.h:31
@ IsSticky
Definition MatchTypes.h:32
@ PositionX
Definition MatchTypes.h:52
@ TiledWindowCount
context — tiled windows on this screen + desktop
Definition MatchTypes.h:63
@ PositionY
Definition MatchTypes.h:53
@ AppId
Definition MatchTypes.h:25
@ Width
Definition MatchTypes.h:42
@ VirtualDesktop
context — always present
Definition MatchTypes.h:36
@ IsMovable
window can be moved
Definition MatchTypes.h:65
@ SkipTaskbar
Definition MatchTypes.h:46
@ IsNotification
Definition MatchTypes.h:41
@ KeepAbove
Definition MatchTypes.h:44
@ IsFullscreen
Definition MatchTypes.h:33
@ ScreenWidth
context — the resolving screen's width in device pixels
Definition MatchTypes.h:75
@ HasDecoration
Definition MatchTypes.h:50
@ IsTiled
managed by a tiling-family engine — autotile or scrolling (distinct from IsSnapped)
Definition MatchTypes.h:59
@ WindowClass
Definition MatchTypes.h:26
@ IsMinimized
Definition MatchTypes.h:34
@ IsFloating
floated out of tiling (any placement engine)
Definition MatchTypes.h:56
@ Mode
context — current placement mode (snapping / tiling / scrolling)
Definition MatchTypes.h:61
@ CaptionNormal
Definition MatchTypes.h:54
@ ScreenHeight
context — the resolving screen's height in device pixels
Definition MatchTypes.h:76
@ IsMaximized
Definition MatchTypes.h:38
@ ScreenId
context — always present
Definition MatchTypes.h:35
@ ActiveLayout
context — the layout id currently resolved for the screen (snap UUID, "autotile:<algo>",...
Definition MatchTypes.h:70
@ KeepBelow
Definition MatchTypes.h:45
@ WindowRole
Definition MatchTypes.h:28
@ ScreenOrientation
context — "portrait" / "landscape" of the resolving screen
Definition MatchTypes.h:68
@ ScreenAspectRatio
context — the resolving screen's nearest common aspect ratio ("16:9", "32:9", …)
Definition MatchTypes.h:77
@ Pid
Definition MatchTypes.h:29
@ Zone
the snap zone's UUID the window occupies
Definition MatchTypes.h:58
@ Title
Definition MatchTypes.h:30
@ IsResizable
Definition MatchTypes.h:51
@ IsSnapped
occupies a snap zone
Definition MatchTypes.h:57
@ IsModal
Definition MatchTypes.h:49
@ SkipPager
Definition MatchTypes.h:47
@ DesktopFile
Definition MatchTypes.h:27
@ IsMaximizable
window can be maximized
Definition MatchTypes.h:66
@ SkipSwitcher
Definition MatchTypes.h:48
@ ColorScheme
context — "light" / "dark" system colour scheme, session-wide
Definition MatchTypes.h:73
@ Activity
context — always present
Definition MatchTypes.h:37
@ Height
Definition MatchTypes.h:43
@ IsTransient
Definition MatchTypes.h:40
FieldSource
Whether a field is a window property or a context attribute.
Definition MatchTypes.h:199
@ Context
resolvable during a windowless context query (screen / desktop / activity / mode / screen orientation...
Definition MatchTypes.h:201
@ Window
absent during windowless context queries
Definition MatchTypes.h:200
Operator
Match operators.
Definition MatchTypes.h:441
@ Equals
case-insensitive for strings, numeric for ints, bool for flags
Definition MatchTypes.h:442
@ EndsWith
suffix, case-insensitive (strings)
Definition MatchTypes.h:445
@ Regex
QRegularExpression, precompiled & cached per predicate.
Definition MatchTypes.h:446
@ StartsWith
prefix, case-insensitive (strings)
Definition MatchTypes.h:444
@ AppIdMatches
segment-aware reverse-DNS match (AppId only)
Definition MatchTypes.h:447
@ Contains
substring, case-insensitive (strings)
Definition MatchTypes.h:443
@ LessThan
numeric compare (every FieldType::Int field)
Definition MatchTypes.h:449
@ GreaterThan
numeric compare (every FieldType::Int field)
Definition MatchTypes.h:448
std::optional< Operator > operatorFromString(QStringView s)
Strict parse: an unknown token returns nullopt.
Definition MatchTypes.h:481
bool fieldIsNumeric(Field field)
True if field carries a numeric value.
Definition MatchTypes.h:414
constexpr FieldDescriptor kFieldTable[]
The master field table — indexed by static_cast<int>(field).
Definition MatchTypes.h:217
QString fieldToString(Field field)
Canonical lowercase wire string for a Field.
Definition MatchTypes.h:384
FieldType
Value-kind of a field's payload in a WindowQuery.
Definition MatchTypes.h:191
@ Int
int-valued (operators: Equals/GreaterThan/LessThan)
Definition MatchTypes.h:194
@ String
QString-valued (operators: Equals/Contains/StartsWith/EndsWith/Regex).
Definition MatchTypes.h:192
@ Bool
bool-valued (operator: Equals)
Definition MatchTypes.h:193
@ Enum
enum-as-int (WindowType) — Equals only
Definition MatchTypes.h:195
constexpr int OperatorCount
The number of distinct Operator enumerators.
Definition MatchTypes.h:454
std::optional< Field > fieldFromString(QStringView s)
Strict parse: an unknown token returns nullopt so the loader can drop the malformed predicate rather ...
Definition MatchTypes.h:395
QString orientationTokenFor(int width, int height)
The Field::ScreenOrientation token for a width x height screen: "portrait" when it is taller than wid...
Definition MatchTypes.h:176
One entry of the Field::ScreenAspectRatio vocabulary: the token a rule compares against and the width...
Definition MatchTypes.h:127
QLatin1StringView token
Definition MatchTypes.h:128
double ratio
Definition MatchTypes.h:129
Compile-time descriptor for one Field.
Definition MatchTypes.h:209
QLatin1StringView wire
Definition MatchTypes.h:211
FieldSource source
Definition MatchTypes.h:213
FieldType type
Definition MatchTypes.h:212
Field field
Definition MatchTypes.h:210