Lumiera
0.pre.03
»edit your freedom«
|
#include "stage/interact/ui-coord-resolver.hpp"
Query and mutate UICoord specifications in relation to actual UI topology.
This specialised builder uses a location query facility to retrieve information about the current actual UI topology. The UI coordinate spec given as initialisation acts as a pattern, to be queried and resolved against that actual UI topology in various ways
firstWindow
** currentWindow
"*"
)Definition at line 276 of file ui-coord-resolver.hpp.
Public Member Functions | |
UICoordResolver (UICoord const &uic, LocationQuery &queryAPI) | |
UICoordResolver (UICoord &&uic, LocationQuery &queryAPI) | |
UICoordResolver && | anchor () |
mutate the window part of the path such as to make the anchorage explicit, if possible More... | |
bool | canAnchor () const |
determine if a mutation is possible to anchor the path explicitly More... | |
bool | canCover () const |
determine if a mutation is possible to get the path (partially) covered. More... | |
UICoordResolver && | cover () |
mutate the path to get it totally covered More... | |
size_t | coverDepth () const |
UICoordResolver && | coverPartially () |
mutate the path by resolving all wildcards to achieve partial coverage More... | |
UICoordResolver && | existentiallyQuantify (size_t pos) |
mutate to turn a wildcard into existentially quantified. This means to assume (or require) that an element actually exists at the given position, without knowing or caring about its actual name. More... | |
UICoordResolver && | extend (Literal pathExtension) |
mutate the path to extend it while keeping it partially covered More... | |
UICoordResolver && | extend (UICoord const &partialExtensionSpec) |
mutate the path and extend it with components at fixed positions More... | |
bool | isAnchored () const |
is this path explicitly anchored at an existing window? More... | |
bool | isCovered () const |
this path is completely covered by the currently existing UI structure; More... | |
bool | isCoveredPartially () const |
is this path at least partially covered? A covered path describes an access path through widgets actually existing in the UI. More... | |
bool | isCoveredTotally () const |
synonymous to isCovered() | |
operator string () const | |
diagnostics | |
Public Member Functions inherited from UICoord::Builder | |
Builder (Builder &&)=default | |
Builder && | append (Literal elm) |
augment UI coordinates by appending a further component at the end. More... | |
LocationClause | create () |
interprets the current (inline) builder contents as create clause, which has the meaning "create a new element XYZ when possible" | |
bool | empty () const |
Builder && | noTab () |
augment UI coordinates to indicate that no tab specification is necessary More... | |
operator LocationClause () | |
support for use in the ViewSpec-DSL More... | |
Builder && | panel (Literal panelID) |
augment UI coordinates to indicate a specific view to be used | |
Builder && | path (Literal pathDef) |
augment UI coordinates to define a complete local path More... | |
Builder && | persp (Literal perspectiveID) |
augment UI coordinates to mandate a specific perspective to be active within the window | |
Builder && | prepend (Literal elmID) |
augment partially defined UI coordinates by extending them towards the root | |
size_t | size () const |
Builder && | tab (Literal tabID) |
augment UI coordinates to indicate a specific tab within the view" | |
Builder && | tab (uint tabIdx) |
augment UI coordinates to indicate a tab specified by index number | |
Builder && | truncateTo (size_t depth) |
possibly shorten this path specification to a limited depth | |
UICoord const & | uiCoord () |
Builder && | view (Literal viewID) |
augment UI coordinates to indicate a specific view to be used | |
Builder && | window (Literal windowID) |
change UI coordinate spec to define it to be rooted within the given window More... | |
Classes | |
struct | Resolution |
Private Member Functions | |
void | attempt_trivialResolution () |
establish a trivial anchorage and coverage, if possible. More... | |
bool | pathResolution () |
Since UICoord path specifications may contain gaps and wildcards, we may attempt to fill in these missing parts by matching against the topological structure of an actual UI. More... | |
Private Attributes | |
LocationQuery & | query_ |
Resolution | res_ |
Additional Inherited Members | |
Protected Member Functions inherited from UICoord::Builder | |
template<typename... ARGS> | |
Builder (ARGS &&...args) | |
Builder (UICoord &&anonRef) | |
Builder (UICoord const &base) | |
Builder && | normalise () |
Builder && | overwrite (size_t depth, Literal newSpec) |
Protected Attributes inherited from UICoord::Builder | |
UICoord | uic_ |
struct stage::interact::UICoordResolver::Resolution |
Class Members | ||
---|---|---|
const char * | anchor | |
size_t | depth | |
unique_ptr< UICoord > | covfefe | |
bool | isResolved |
|
inline |
is this path explicitly anchored at an existing window?
Definition at line 315 of file ui-coord-resolver.hpp.
|
inline |
determine if a mutation is possible to anchor the path explicitly
Definition at line 329 of file ui-coord-resolver.hpp.
|
inline |
is this path at least partially covered? A covered path describes an access path through widgets actually existing in the UI.
Definition at line 344 of file ui-coord-resolver.hpp.
|
inline |
this path is completely covered by the currently existing UI structure;
Definition at line 355 of file ui-coord-resolver.hpp.
|
inline |
determine if a mutation is possible to get the path (partially) covered.
Definition at line 379 of file ui-coord-resolver.hpp.
|
inline |
mutate the path to get it totally covered
Definition at line 400 of file ui-coord-resolver.hpp.
|
inline |
mutate the path by resolving all wildcards to achieve partial coverage
Definition at line 435 of file ui-coord-resolver.hpp.
|
inline |
mutate the window part of the path such as to make the anchorage explicit, if possible
firstWindow
or currentWindow
, they will be replaced by their current meaning. If the path is incomplete, but can somehow be resolved, we use the anchorage as indicated by that resolution, without interpolating the rest of the path. Definition at line 475 of file ui-coord-resolver.hpp.
|
inline |
mutate the path to extend it while keeping it partially covered
pathExtension | a literal specification, which is extended immediately behind the actually covered part of the path, irrespective of the depth |
Definition at line 493 of file ui-coord-resolver.hpp.
References LocationQuery::determineCoverage().
|
inline |
mutate the path and extend it with components at fixed positions
partialExtensionSpec | UI coordinates used as extension |
if | the extension would overwrite the covered part. |
Definition at line 510 of file ui-coord-resolver.hpp.
References PathArray< chunk_size >::begin(), and PathArray< chunk_size >::indexOf().
|
inline |
mutate to turn a wildcard into existentially quantified. This means to assume (or require) that an element actually exists at the given position, without knowing or caring about its actual name.
This becomes relevant when matching for partially covered path; normal wildcards are only accepted to build a solution, when the matching can be confirmed by an explicit element after (below) the wildcard part. While this restriction serves to prevent ambiguous and surprising arbitrary matches, it can sometimes defeat any solution, e.g. when creating a new panel on top of an existing but irrelevant perspective.
Definition at line 549 of file ui-coord-resolver.hpp.
References stage::interact::UIC_ELIDED.
Referenced by UILocationSolver::preprocess().
|
inlineprivate |
establish a trivial anchorage and coverage, if possible.
Definition at line 573 of file ui-coord-resolver.hpp.
References LocationQuery::determineAnchor(), LocationQuery::determineCoverage(), and stage::interact::UIC_ELIDED.
|
private |
Since UICoord path specifications may contain gaps and wildcards, we may attempt to fill in these missing parts by matching against the topological structure of an actual UI.
algorithm to resolve this UICoord path against the actual UI topology.
In the general case, finding a solution requires a depth-first exponential brute-force search over the whole structure tree, since we have to try every possible branch until we can disprove the possibility of a match. Implemented as depth-first search with backtracking, this scanning pass produces a list of possible matches, from which we pick the first one with maximum coverage, to yield a single solution.
expandChildren()
was invoked, the next iteration will continue with the first child element; there is a stack of such "child expansions" – meaning that the search will backtrack and explore further possibilities later on. Each position where the pattern matches the actual tree is marked as possible solution. As a sideeffect, a new coordinate spec to reflect the actual coverage is built and re-written, while the algorithm proceeds. Thus, at any point marked as solution, the current (partial) solution can be retrieved and copied from this PathManipulator buffer. An additional filter layer discriminates the first maximal solutions seen thus far. Definition at line 118 of file ui-coord-resolver.cpp.
References stage::interact::UIC_ELIDED.