Lumiera  0.pre.03
»edityourfreedom«
UICoord Class Reference

#include "gui/interact/ui-coord.hpp"

Description

Describe a location within the UI through structural/topological coordinates.

A UICoord specification is a sequence of Literal tokens, elaborating a path descending through the hierarchy of UI elements down to the specific UI element to refer.

See also
UICoord_test

Definition at line 138 of file ui-coord.hpp.

Public Member Functions

template<typename... ARGS>
 UICoord (ARGS &&...args)
 UI-Coordinates can be created explicitly by specifying a sequence of Literal tokens, which will be used to initialise and then normalise the underlying PathArray. More...
 
 UICoord (UICoord &&)=default
 
 UICoord (UICoord const &)=default
 
 UICoord (UICoord &o)
 
 UICoord (Builder &&builder)
 shortcut to allow init from builder expression More...
 
Builder append (Literal elmID) const
 
string getComp () const
 
Literal getPanel () const
 
string getPath () const
 
Literal getPersp () const
 
Literal getTab () const
 
Literal getView () const
 
Literal getWindow () const
 
bool isComplete () const
 
bool isExplicit () const
 
bool isExtendedBelow (UICoord const &parent) const
 Check if this coordinate spec can be seen as an extension of the given parent coordinates and thus reaches further down towards specific UI elements in comparison to the parent path This constitutes a partial order, since some paths might just be totally unrelated to each other and thus not comparable. More...
 
bool isIncomplete () const
 
bool isPresent (size_t idx) const
 
bool isWildcard (size_t idx) const
 
Builder noTab () const
 
 operator string () const
 
UICoordoperator= (UICoord const &)=default
 
UICoordoperator= (UICoord &&)=default
 
Builder panel (Literal panelID) const
 
Builder path (Literal pathDefinition) const
 convenience builder function so set a full path definition More...
 
iterator pathSeq () const
 iterative access to the path sequence section More...
 
Builder persp (Literal perspectiveID) const
 
Builder prepend (Literal elmID) const
 
Builder rebuild () const
 
Builder tab (Literal tabID) const
 
Builder tab (uint tabIdx) const
 
Builder view (Literal viewID) const
 
- Public Member Functions inherited from PathArray< UIC_INLINE_SIZE >
 PathArray (ARGS &&...args)
 
 PathArray (PathArray &&)=default
 
 PathArray (PathArray const &)=default
 
 PathArray (PathArray &o)
 
iterator begin () const
 
bool empty () const
 
iterator end () const
 
size_t indexOf (Literal const &content) const
 reverse lookup of actual path content More...
 
size_t leafLevel () const
 
 operator string () const
 joins nonempty content, separated by slash More...
 
PathArrayoperator= (PathArray const &)=default
 
PathArrayoperator= (PathArray &&)=default
 
Literal const & operator[] (size_t idx) const
 Array style indexed access. More...
 
size_t size () const
 

Static Public Member Functions

static Builder currentWindow ()
 Builder: start definition of UI-Coordinates rooted in the currentWindow More...
 
static Builder firstWindow ()
 Builder: start definition of UI-Coordinates rooted in the firstWindow More...
 
static Builder window (Literal windowID)
 Builder: start definition of UI-Coordinates rooted in given window. More...
 

Classes

class  Builder
 

Friends

class Builder
 
bool operator!= (UICoord const &l, UICoord const &r)
 
bool operator< (UICoord const &l, UICoord const &r)
 
bool operator<= (UICoord const &l, UICoord const &r)
 
bool operator== (UICoord const &l, UICoord const &r)
 
bool operator> (UICoord const &l, UICoord const &r)
 
bool operator>= (UICoord const &l, UICoord const &r)
 

Private Member Functions

Literal accesComponent (UIPathElm idx) const
 
size_t findStartIdx () const
 
void setComponent (size_t idx, Literal newContent)
 
void setTailSequence (size_t idx, Literal newContent)
 replace / overwrite existing content starting at given index. More...
 
void setTailSequence (size_t idx, std::vector< Literal > &pathElms)
 replace the existing path information with the given elements More...
 

Additional Inherited Members

- Public Types inherited from PathArray< UIC_INLINE_SIZE >
using const_iterator = lib::IterAdapter< Literal const *, PathArray const *>
 
using const_reference = Literal const &
 
using iterator = const_iterator
 
using reference = Literal &
 
using value_type = Literal
 
- Protected Member Functions inherited from PathArray< UIC_INLINE_SIZE >
LiteralexpandPosition (size_t idx)
 
LiteralgetPosition (size_t idx)
 
void normalise ()
 establish the contract of PathArray More...
 
void setContent (Literal *pos, const char *val)
 
void truncateTo (size_t newSize)
 

Constructor & Destructor Documentation

◆ UICoord() [1/5]

UICoord ( ARGS &&...  args)
inlineexplicit

UI-Coordinates can be created explicitly by specifying a sequence of Literal tokens, which will be used to initialise and then normalise the underlying PathArray.

Warning
Literal means _"literal"_ with guaranteed storage during the whole execution.
Remarks
- in case you need to construct some part, then use Symbol to intern the resulting string into the global static SymbolTable.
  • usually the Builder API leads to more readable definitions, explicitly indicating the meaning of the coordinate's parts.

Definition at line 154 of file ui-coord.hpp.

Referenced by UICoord::UICoord().

+ Here is the caller graph for this function:

◆ UICoord() [2/5]

UICoord ( UICoord &&  )
default

◆ UICoord() [3/5]

UICoord ( UICoord const &  )
default

◆ UICoord() [4/5]

UICoord ( UICoord o)
inline

Definition at line 158 of file ui-coord.hpp.

References UICoord::append(), UICoord::currentWindow(), UICoord::firstWindow(), UICoord::noTab(), UICoord::operator=(), UICoord::panel(), UICoord::path(), UICoord::persp(), UICoord::prepend(), UICoord::rebuild(), UICoord::tab(), UICoord::UICoord(), UICoord::view(), and UICoord::window().

+ Here is the call graph for this function:

◆ UICoord() [5/5]

UICoord ( Builder &&  builder)
inline

shortcut to allow init from builder expression

Note
this ctor is used to "fix" and normalise the contents established in the Builder thus far.

Definition at line 667 of file ui-coord.hpp.

Member Function Documentation

◆ operator=() [1/2]

UICoord& operator= ( UICoord const &  )
default

Referenced by UICoord::UICoord().

+ Here is the caller graph for this function:

◆ operator=() [2/2]

UICoord& operator= ( UICoord &&  )
default

◆ firstWindow()

UICoord::Builder firstWindow ( )
inlinestatic

Builder: start definition of UI-Coordinates rooted in the firstWindow

Definition at line 684 of file ui-coord.hpp.

References UICoord::window().

Referenced by UICoord::UICoord(), UICoordResolver_test::verify_backingQuery(), UILocationSolver_test::verify_cornerCases(), UICoordResolver_test::verify_mutateAnchor(), UICoordResolver_test::verify_mutateCoverage(), and UICoordResolver_test::verify_queryAnchor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ currentWindow()

UICoord::Builder currentWindow ( )
inlinestatic

Builder: start definition of UI-Coordinates rooted in the currentWindow

Returns
a minimally defined Builder, allowing to define further parts; to finish the definition, cast / store it into UICoord, which itself is immutable.

Definition at line 678 of file ui-coord.hpp.

References UICoord::window().

Referenced by UICoord::UICoord(), UICoordResolver_test::verify_backingQuery(), UILocationSolver_test::verify_cornerCases(), UICoordResolver_test::verify_mutateAnchor(), UICoordResolver_test::verify_mutateCoverage(), UICoordResolver_test::verify_mutateCoverPartially(), UICoordResolver_test::verify_mutateExtend(), UICoordResolver_test::verify_queryAnchor(), UILocationSolver_test::verify_standardSituations(), and ViewSpecDSL_test::verify_standardUsage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ window()

UICoord::Builder window ( Literal  windowID)
inlinestatic

Builder: start definition of UI-Coordinates rooted in given window.

Returns
a Builder with just the windowID defined

Definition at line 691 of file ui-coord.hpp.

Referenced by UICoord::currentWindow(), UICoord::firstWindow(), UICoord::UICoord(), UICoordResolver_test::verify_backingQuery(), UICoord_test::verify_builder(), UILocationSolver_test::verify_cornerCases(), UICoordResolver_test::verify_mutateAnchor(), UICoordResolver_test::verify_mutateCoverage(), UICoordResolver_test::verify_queryAnchor(), and UILocationSolver_test::verify_standardSituations().

+ Here is the caller graph for this function:

◆ persp()

UICoord::Builder persp ( Literal  perspectiveID) const
inline
Returns
a Builder holding a clone copy of the original UICoord, with the perspective information set to a new value.
Remarks
This Builder can then be used do set further parts independently of the original. When done, store it as new UICoord object. To achieve real mutation, assign it to the original variable.

Definition at line 704 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::UICoord(), UICoord_test::verify_builder(), UILocationSolver_test::verify_cornerCases(), UICoordResolver_test::verify_mutateCoverage(), UICoordResolver_test::verify_mutateExtend(), and UILocationSolver_test::verify_standardSituations().

+ Here is the caller graph for this function:

◆ panel()

UICoord::Builder panel ( Literal  panelID) const
inline

Definition at line 710 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UILocationSolver_test::simple_usage_example(), UICoord::UICoord(), and UICoordResolver_test::verify_mutateCoverage().

+ Here is the caller graph for this function:

◆ view()

UICoord::Builder view ( Literal  viewID) const
inline

Definition at line 716 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::UICoord(), UICoord_test::verify_builder(), UICoordResolver_test::verify_mutateAnchor(), UICoordResolver_test::verify_mutateCoverage(), UICoordResolver_test::verify_mutateExtend(), and UICoordResolver_test::verify_queryAnchor().

+ Here is the caller graph for this function:

◆ tab() [1/2]

UICoord::Builder tab ( Literal  tabID) const
inline

Definition at line 722 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::UICoord(), UICoordResolver_test::verify_mutateCoverage(), and ViewSpecDSL_test::verify_standardUsage().

+ Here is the caller graph for this function:

◆ tab() [2/2]

UICoord::Builder tab ( uint  tabIdx) const
inline

Definition at line 728 of file ui-coord.hpp.

References UICoord::Builder.

◆ noTab()

UICoord::Builder noTab ( ) const
inline

Definition at line 734 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::UICoord().

+ Here is the caller graph for this function:

◆ path()

UICoord::Builder path ( Literal  pathDefinition) const
inline

convenience builder function so set a full path definition

Note
the given path string will be split at `'/'` and the resulting components will be stored/retrieved as Symbol

Definition at line 745 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::operator string(), UICoord::UICoord(), UILocationSolver_test::verify_cornerCases(), and UICoord_test::verify_stringRepr().

+ Here is the caller graph for this function:

◆ append()

UICoord::Builder append ( Literal  elmID) const
inline

Definition at line 751 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::UICoord(), and UICoord_test::verify_builder().

+ Here is the caller graph for this function:

◆ prepend()

UICoord::Builder prepend ( Literal  elmID) const
inline

Definition at line 757 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by UICoord::UICoord(), and UICoord_test::verify_builder().

+ Here is the caller graph for this function:

◆ rebuild()

UICoord::Builder rebuild ( ) const
inline

Definition at line 763 of file ui-coord.hpp.

References UICoord::Builder.

Referenced by ElementAccess::access(), UICoordResolver::extend(), ElementAccess::locate_or_create(), UICoord::UICoord(), and UILocationSolver_test::verify_cornerCases().

+ Here is the caller graph for this function:

◆ getWindow()

Literal getWindow ( ) const
inline

Definition at line 199 of file ui-coord.hpp.

References UICoord::accesComponent(), and gui::interact::UIC_WINDOW.

Referenced by GenNodeLocationQuery::determineAnchor(), UICoord::getComp(), UICoord::isComplete(), UICoord::isIncomplete(), and UICoord_test::verify_builder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPersp()

Literal getPersp ( ) const
inline

Definition at line 200 of file ui-coord.hpp.

References UICoord::accesComponent(), and gui::interact::UIC_PERSP.

Referenced by UICoord::getComp(), and UICoord_test::verify_builder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPanel()

Literal getPanel ( ) const
inline

Definition at line 201 of file ui-coord.hpp.

References UICoord::accesComponent(), and gui::interact::UIC_PANEL.

Referenced by UICoord::getComp(), and UICoord_test::verify_builder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getView()

Literal getView ( ) const
inline

Definition at line 202 of file ui-coord.hpp.

References UICoord::accesComponent(), and gui::interact::UIC_VIEW.

Referenced by UICoord::getComp(), and UICoord_test::verify_builder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTab()

Literal getTab ( ) const
inline

Definition at line 203 of file ui-coord.hpp.

References UICoord::accesComponent(), and gui::interact::UIC_TAB.

Referenced by UICoord::getComp(), and UICoord_test::verify_builder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isIncomplete()

bool isIncomplete ( ) const
inline
Remarks
incomplete UI-Coordinates have some fragment of the path defined, but lacks the definition of an anchor point, i.e. it has no window ID

Definition at line 215 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::empty(), UICoord::getWindow(), and util::isnil().

Referenced by UICoord::Builder::prepend(), and UICoord_test::verify_localPredicates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isComplete()

bool isComplete ( ) const
inline

Definition at line 222 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::empty(), UICoord::getWindow(), and util::isnil().

Referenced by UICoord::isExplicit(), UILocationSolver::preprocess(), and UICoord_test::verify_localPredicates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isExplicit()

bool isExplicit ( ) const
inline
Remarks
an explicit coordinate spec does not use wildcards and is anchored in a window spec

Definition at line 234 of file ui-coord.hpp.

References Symbol::ANY, util::contains(), and UICoord::isComplete().

Referenced by UICoord_test::verify_localPredicates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPresent()

bool isPresent ( size_t  idx) const
inline

Definition at line 242 of file ui-coord.hpp.

References Symbol::ANY, util::isnil(), and util::unConst().

Referenced by GenNodeLocationQuery::determineAnchor(), GenNodeLocationQuery::drillDown(), and GenNodeLocationQuery::resolveElm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isWildcard()

bool isWildcard ( size_t  idx) const
inline

Definition at line 251 of file ui-coord.hpp.

References Symbol::ANY, and util::unConst().

+ Here is the call graph for this function:

◆ isExtendedBelow()

bool isExtendedBelow ( UICoord const &  parent) const
inline

Check if this coordinate spec can be seen as an extension of the given parent coordinates and thus reaches further down towards specific UI elements in comparison to the parent path This constitutes a partial order, since some paths might just be totally unrelated to each other and thus not comparable.

Note
we tolerate (but not demand) expansion/interpolation of the given parent, i.e. parent may be incomplete or contain `'*'` placeholders.
Todo:
10/2017 have to verify suitability of this definition

Definition at line 271 of file ui-coord.hpp.

References Symbol::ANY, ENSURE(), util::isnil(), PathArray< UIC_INLINE_SIZE >::size(), and PathArray< chunk_size >::size().

+ Here is the call graph for this function:

◆ operator string()

operator string ( ) const
inlineexplicit

Definition at line 295 of file ui-coord.hpp.

References UICoord::getComp(), UICoord::getPath(), util::isnil(), and UICoord::path().

+ Here is the call graph for this function:

◆ getComp()

string getComp ( ) const
inline

Definition at line 313 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::begin(), PathArray< UIC_INLINE_SIZE >::empty(), PathArray< UIC_INLINE_SIZE >::end(), UICoord::getPanel(), UICoord::getPersp(), UICoord::getTab(), UICoord::getView(), UICoord::getWindow(), PathArray< UIC_INLINE_SIZE >::indexOf(), lib::meta::min(), PathArray< UIC_INLINE_SIZE >::size(), gui::interact::UIC_PANEL, gui::interact::UIC_PATH, gui::interact::UIC_PERSP, gui::interact::UIC_TAB, gui::interact::UIC_VIEW, and gui::interact::UIC_WINDOW.

Referenced by UICoord::operator string(), UICoord_test::verify_builder(), and UICoord_test::verify_stringRepr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPath()

string getPath ( ) const
inline

Definition at line 354 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::begin(), util::isnil(), UICoord::pathSeq(), PathArray< UIC_INLINE_SIZE >::size(), and gui::interact::UIC_PATH.

Referenced by UICoord::operator string(), UICoord_test::verify_builder(), and UICoord_test::verify_stringRepr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pathSeq()

iterator pathSeq ( ) const
inline

iterative access to the path sequence section

Definition at line 382 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::end(), PathArray< UIC_INLINE_SIZE >::size(), gui::interact::UIC_PATH, and util::unConst().

Referenced by UICoord::getPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findStartIdx()

size_t findStartIdx ( ) const
inlineprivate

Definition at line 394 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::begin(), PathArray< UIC_INLINE_SIZE >::empty(), and PathArray< UIC_INLINE_SIZE >::indexOf().

Referenced by UICoord::Builder::prepend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ accesComponent()

Literal accesComponent ( UIPathElm  idx) const
inlineprivate

Definition at line 401 of file ui-coord.hpp.

References Symbol::EMPTY, and util::unConst().

Referenced by UICoord::getPanel(), UICoord::getPersp(), UICoord::getTab(), UICoord::getView(), and UICoord::getWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setComponent()

void setComponent ( size_t  idx,
Literal  newContent 
)
inlineprivate

Definition at line 408 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::expandPosition(), and PathArray< UIC_INLINE_SIZE >::setContent().

Referenced by UICoord::Builder::noTab(), UICoord::Builder::panel(), UICoord::Builder::persp(), UICoord::Builder::prepend(), UICoord::Builder::tab(), UICoord::Builder::view(), and UICoord::Builder::window().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTailSequence() [1/2]

void setTailSequence ( size_t  idx,
Literal  newContent 
)
inlineprivate

replace / overwrite existing content starting at given index.

Parameters
idxwhere to start adding content; storage will be expanded to accommodate
newContenteither a single element, or several elements delimited by `'/' @note - a path sequence will be split at'/'` and the components interned
  • any excess elements will be cleared
Warning
need to invoke PathArray::normalise() afterwards

Definition at line 423 of file ui-coord.hpp.

References util::isnil(), and util::last().

Referenced by UICoord::Builder::append(), and UICoord::Builder::path().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTailSequence() [2/2]

void setTailSequence ( size_t  idx,
std::vector< Literal > &  pathElms 
)
inlineprivate

replace the existing path information with the given elements

Note
- storage will possibly be expanded to accommodate
  • the individual path elements are required to persist
  • any excess elements will be cleared
  • the pathElms can be empty in which case just any content starting from idx will be cleared
Warning
need to invoke PathArray::normalise() afterwards

Definition at line 463 of file ui-coord.hpp.

References PathArray< UIC_INLINE_SIZE >::end(), PathArray< UIC_INLINE_SIZE >::expandPosition(), PathArray< UIC_INLINE_SIZE >::setContent(), and PathArray< UIC_INLINE_SIZE >::size().

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ Builder

friend class Builder
friend

◆ operator==

bool operator== ( UICoord const &  l,
UICoord const &  r 
)
friend

Definition at line 478 of file ui-coord.hpp.

◆ operator<

bool operator< ( UICoord const &  l,
UICoord const &  r 
)
friend

Definition at line 484 of file ui-coord.hpp.

◆ operator>

bool operator> ( UICoord const &  l,
UICoord const &  r 
)
friend

Definition at line 489 of file ui-coord.hpp.

◆ operator<=

bool operator<= ( UICoord const &  l,
UICoord const &  r 
)
friend

Definition at line 490 of file ui-coord.hpp.

◆ operator>=

bool operator>= ( UICoord const &  l,
UICoord const &  r 
)
friend

Definition at line 491 of file ui-coord.hpp.

◆ operator!=

bool operator!= ( UICoord const &  l,
UICoord const &  r 
)
friend

Definition at line 492 of file ui-coord.hpp.

+ Inheritance diagram for UICoord:
+ Collaboration diagram for UICoord:

The documentation for this class was generated from the following file: