115 #ifndef STAGE_INTERACT_UI_COORD_RESOLVER_H 116 #define STAGE_INTERACT_UI_COORD_RESOLVER_H 136 using std::unique_ptr;
235 virtual size_t determineCoverage (
UICoord const& path) =0;
248 virtual ChildIter getChildren (
UICoord const& path,
size_t pos) =0;
291 const char* anchor =
nullptr;
293 unique_ptr<UICoord> covfefe{};
294 bool isResolved =
false;
306 attempt_trivialResolution();
310 : Builder{std::move(uic)}
314 attempt_trivialResolution();
327 and res_.anchor != Symbol::BOTTOM;
341 or (res_.isResolved and res_.covfefe)
342 or unConst(
this)->pathResolution()
355 return res_.isResolved
366 return res_.isResolved
367 and res_.depth == this->uic_.size();
391 or (res_.isResolved and res_.covfefe)
392 or unConst(
this)->pathResolution()
411 if (isCoveredPartially() and not res_.covfefe)
413 ASSERT (res_.anchor);
414 window (res_.anchor);
415 truncateTo (res_.depth);
419 ASSERT (res_.isResolved);
420 REQUIRE (res_.covfefe);
421 res_.depth = res_.covfefe->size();
422 this->uic_ = std::move (*res_.covfefe);
423 res_.covfefe.reset();
427 ASSERT (res_.isResolved);
428 REQUIRE (res_.depth == 0);
429 REQUIRE (not res_.covfefe);
432 ENSURE (isCovered());
433 return std::move (*
this);
446 if (isCoveredPartially() and not res_.covfefe)
448 ASSERT (res_.anchor);
449 window (res_.anchor);
453 ASSERT (res_.isResolved);
454 REQUIRE (res_.covfefe);
455 REQUIRE (uic_.size() >= res_.covfefe->size());
456 res_.depth = res_.covfefe->size();
458 for (
size_t pos = 0; pos < res_.depth; ++pos )
459 overwrite (pos, (*res_.covfefe)[pos]);
460 res_.covfefe.reset();
464 ASSERT (res_.isResolved);
465 REQUIRE (res_.depth == 0);
466 REQUIRE (not res_.covfefe);
469 ENSURE (empty() or (isCoveredPartially() and uic_.isExplicit()));
470 return std::move (*
this);
488 window (res_.anchor);
491 return std::move (*
this);
506 ENSURE (isCovered());
507 append (pathExtension);
509 return std::move (*
this);
522 uic_ = partialExtensionSpec;
525 REQUIRE (res_.isResolved);
526 size_t coverable = res_.covfefe? res_.covfefe->size() : res_.depth;
527 auto newContent = partialExtensionSpec.
begin();
528 size_t extensionPos = newContent? partialExtensionSpec.
indexOf(*newContent) : coverable;
529 if (coverable > extensionPos)
531 "would overwrite positions %d to %d (incl)"}
533 % partialExtensionSpec
537 for ( ; newContent; ++newContent, ++extensionPos )
538 overwrite (extensionPos, *newContent);
542 attempt_trivialResolution();
544 return std::move (*
this);
560 if (pos < uic_.size() and not uic_.isPresent(pos))
562 return std::move (*
this);
568 operator string()
const {
return string(this->uic_); }
569 size_t coverDepth()
const {
return res_.depth; }
585 if (not uic_.isExplicit())
return;
587 if (util::contains (this->uic_,
UIC_ELIDED))
return;
588 res_.isResolved =
true;
595 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