106 #ifndef STAGE_INTERACT_UI_COORD_RESOLVER_H 107 #define STAGE_INTERACT_UI_COORD_RESOLVER_H 127 using std::unique_ptr;
226 virtual size_t determineCoverage (
UICoord const& path) =0;
239 virtual ChildIter getChildren (
UICoord const& path,
size_t pos) =0;
282 const char* anchor =
nullptr;
284 unique_ptr<UICoord> covfefe{};
285 bool isResolved =
false;
297 attempt_trivialResolution();
301 : Builder{std::move(uic)}
305 attempt_trivialResolution();
318 and res_.anchor != Symbol::BOTTOM;
332 or (res_.isResolved and res_.covfefe)
333 or unConst(
this)->pathResolution()
346 return res_.isResolved
357 return res_.isResolved
358 and res_.depth == this->uic_.size();
382 or (res_.isResolved and res_.covfefe)
383 or unConst(
this)->pathResolution()
402 if (isCoveredPartially() and not res_.covfefe)
404 ASSERT (res_.anchor);
405 window (res_.anchor);
406 truncateTo (res_.depth);
410 ASSERT (res_.isResolved);
411 REQUIRE (res_.covfefe);
412 res_.depth = res_.covfefe->size();
413 this->uic_ = std::move (*res_.covfefe);
414 res_.covfefe.reset();
418 ASSERT (res_.isResolved);
419 REQUIRE (res_.depth == 0);
420 REQUIRE (not res_.covfefe);
423 ENSURE (isCovered());
424 return std::move (*
this);
437 if (isCoveredPartially() and not res_.covfefe)
439 ASSERT (res_.anchor);
440 window (res_.anchor);
444 ASSERT (res_.isResolved);
445 REQUIRE (res_.covfefe);
446 REQUIRE (uic_.size() >= res_.covfefe->size());
447 res_.depth = res_.covfefe->size();
449 for (
size_t pos = 0; pos < res_.depth; ++pos )
450 overwrite (pos, (*res_.covfefe)[pos]);
451 res_.covfefe.reset();
455 ASSERT (res_.isResolved);
456 REQUIRE (res_.depth == 0);
457 REQUIRE (not res_.covfefe);
460 ENSURE (empty() or (isCoveredPartially() and uic_.isExplicit()));
461 return std::move (*
this);
479 window (res_.anchor);
482 return std::move (*
this);
497 ENSURE (isCovered());
498 append (pathExtension);
500 return std::move (*
this);
513 uic_ = partialExtensionSpec;
516 REQUIRE (res_.isResolved);
517 size_t coverable = res_.covfefe? res_.covfefe->size() : res_.depth;
518 auto newContent = partialExtensionSpec.
begin();
519 size_t extensionPos = newContent? partialExtensionSpec.
indexOf(*newContent) : coverable;
520 if (coverable > extensionPos)
522 "would overwrite positions %d to %d (incl)"}
524 % partialExtensionSpec
528 for ( ; newContent; ++newContent, ++extensionPos )
529 overwrite (extensionPos, *newContent);
533 attempt_trivialResolution();
535 return std::move (*
this);
551 if (pos < uic_.size() and not uic_.isPresent(pos))
553 return std::move (*
this);
559 operator string()
const {
return string(this->uic_); }
560 size_t coverDepth()
const {
return res_.depth; }
576 if (not uic_.isExplicit())
return;
578 if (util::contains (this->uic_,
UIC_ELIDED))
return;
579 res_.isResolved =
true;
586 bool pathResolution();
Builder && truncateTo(size_t depth)
possibly shorten this path specification to a limited depth
Describe a location within the UI through structural/topological coordinates.
UICoordResolver && cover()
mutate the path to get it totally covered
virtual TreeStructureNavigator * expandChildren() const =0
expand into exploration of child elements at "current position".
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
bool canAnchor() const
determine if a mutation is possible to anchor the path explicitly
UICoordResolver && existentiallyQuantify(size_t pos)
mutate to turn a wildcard into existentially quantified. This means to assume (or require) that an el...
bool isAnchored() const
is this path explicitly anchored at an existing window?
virtual Literal determineAnchor(UICoord const &path)=0
make the real anchor point explicit.
inline string literal This is a marker type to indicate that
A front-end for using printf-style formatting.
Access point to singletons and other kinds of dependencies designated by type.
const Symbol UIC_ELIDED
indicate that a component is elided or irrelevant here
UICoordResolver && extend(UICoord const &partialExtensionSpec)
mutate the path and extend it with components at fixed positions
Derived specific exceptions within Lumiera's exception hierarchy.
Token or Atom with distinct identity.
Iteration source interface to abstract a data source, which then can be accessed through IterAdapter ...
bool isCovered() const
this path is completely covered by the currently existing UI structure;
Marker types to indicate a literal string and a Symbol.
Lumiera GTK UI implementation root.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
UICoordResolver && anchor()
mutate the window part of the path such as to make the anchorage explicit, if possible ...
A topological addressing scheme to designate structural locations within the UI.
Interface to locate and move within a tree shaped structure.
Query and mutate UICoord specifications in relation to actual UI topology.
bool isCoveredPartially() const
is this path at least partially covered? A covered path describes an access path through widgets actu...
bool canCover() const
determine if a mutation is possible to get the path (partially) covered.
Singleton services and Dependency Injection.
Interface to discover a backing structure for the purpose of path navigation and resolution.
Lumiera error handling (C++ interface).
static auto buildIterator(TreeStructureNavigator *source)
build a Lumiera Forward Iterator as front-end and managing Handle for a TreeStructureNavigator or sub...
static lib::Depend< LocationQuery > service
access point to global LocationQuery service implementation
void attempt_trivialResolution()
establish a trivial anchorage and coverage, if possible.
UICoordResolver && extend(Literal pathExtension)
mutate the path to extend it while keeping it partially covered
virtual ~TreeStructureNavigator()
this is an interface
bool isCoveredTotally() const
synonymous to isCovered()
Building tree expanding and backtracking evaluations within hierarchical scopes.
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
size_t indexOf(Literal const &content) const
reverse lookup of actual path content
UICoordResolver && coverPartially()
mutate the path by resolving all wildcards to achieve partial coverage
virtual size_t determineCoverage(UICoord const &path)=0
evaluate to what extent a UIcoord spec matches the actual UI