Lumiera
0.pre.03
»edit your freedom«
|
#include "steam/mobject/session/query-focus.hpp"
Current focus location to use as point-of reference for contents and location discovery queries.
This is the frontend to be used by client code: a smart-handle, internally linked through the ScopeLocaor singleton to a stack of current focus path locations. The intention is for this current location to follow the ongoing query/discovery operations mostly automatically.
A QueryFocus (frontend handle) can be default constructed, in which case it will automatically connect to what is currently the focus location for any further queries. Here, the current focus location is defined as the most recently used location which is still referred by some QueryFocus handle.
Alternatively, through the static factory function push(), a new focus location may be opened, thereby pushing the currently used focus location aside. This new focus location will remain the current focus, until all handles referring to it go out of scope.
Using an existing QueryFocus (handle), the current focus may be shifted to another scope within the current session. This »navigating« operation will use the current focus position as point of departure, thus retaining a similar access path to any nested sequences. (These might be attached multiple times within the same session, each attachment constituting a different context scope. Navigating tries to retain the current context)
The templated query functions allow to issue specifically typed queries to retrieve all children (immediately contained in a given scope), or do discover depth-first any content within this scope. The result set of these queries will be filtered to yield only placements compatible to the specified kind of MObject. E.g, you may query all Clip objects within a given Fork.
The implementation of these query operations is backed by the PlacementIndex in the current session. The link to the session is established the moment these query functions are invoked. The returned iterator (Lumiera Forward Iterator) contains a smart-ptr to keep the hidden result set alive. The results are delivered without any defined order (implementation is hashtable based)
Definition at line 111 of file query-focus.hpp.
Public Member Functions | |
QueryFocus () | |
create a new QueryFocus (handle) linked to the current focus for discovery queries. More... | |
ScopePath const & | currentPath () const |
RefPlacement | currentPoint () const |
template<class MO > | |
ScopeQuery< MO >::iterator | explore () const |
discover any matching object contained as immediate Child within current focus. More... | |
lib::IterSource< const Scope >::iterator | locate (Scope const &toTarget) |
shift or navigate the current focus to point at the given target scope. More... | |
operator Scope () const | |
allowing direct conversion to Scope. More... | |
operator string () const | |
diagnostic self-display based on the ScopePath | |
QueryFocus & | pop () |
cease to use this specific reference to the current frame. More... | |
template<class MO > | |
ScopeQuery< MO >::iterator | query () const |
discover depth-first any matching object within current focus. More... | |
QueryFocus & | reset () |
discard any state and navigate current focus path to model root | |
QueryFocus & | shift (Scope const &) |
shift this QueryFocus to a container-like scope, causing it to navigate, changing the current ScopePath as a side-effect More... | |
Static Public Member Functions | |
static QueryFocus | push (Scope const &) |
push the "current QueryFocus" aside and open a new focus frame. More... | |
static QueryFocus | push () |
push the "current QueryFocus" aside and open a new focus frame, which starts out at the same location as the original | |
Private Member Functions | |
QueryFocus (ScopePath &) | |
Static Private Member Functions | |
static ScopePath & | currPath () |
Private Attributes | |
boost::intrusive_ptr< ScopePath > | focus_ |
QueryFocus | ( | ) |
create a new QueryFocus (handle) linked to the current focus for discovery queries.
The existence of this QueryFocus instance keeps this current focus alive, but multiple instances share a common focus location and may change this location.
Definition at line 50 of file query-focus.cpp.
|
private |
build a new QueryFocus as located to an existing path.
Definition at line 59 of file query-focus.cpp.
|
inline |
Definition at line 168 of file query-focus.hpp.
Referenced by QueryFocus_test::checkNavigation(), and steam::mobject::session::test::anonymous_namespace{query-focus-test.cpp}::refs().
|
inline |
Definition at line 177 of file query-focus.hpp.
Referenced by SessionImpl::attach().
|
inline |
allowing direct conversion to Scope.
Implemented by copying the scope at leaf position of the current focus path
Definition at line 156 of file query-focus.hpp.
QueryFocus & shift | ( | Scope const & | container | ) |
shift this QueryFocus to a container-like scope, causing it to navigate, changing the current ScopePath as a side-effect
error::Invalid | if the given container is invalid or can't be located within the model |
Definition at line 110 of file query-focus.cpp.
Referenced by QueryFocus_test::checkNavigation(), and QueryFocus_test::manipulate_subFocus().
|
static |
push the "current QueryFocus" aside and open a new focus frame.
This new QueryFocus will act as "current" until going out of scope
error::Invalid | in case of invalid or unlocatable target scope |
Definition at line 125 of file query-focus.cpp.
QueryFocus & pop | ( | ) |
cease to use this specific reference to the current frame.
This operation immediately tries to re-attach to what is "current" and readjusts the internal handle. But when the previously released reference was the last one, releasing it will cause the QueryFocusStack to pop, in which case we'll re-attach to the now uncovered previous stack top.
Definition at line 157 of file query-focus.cpp.
References QueryFocus::currPath().
Referenced by QueryFocus_test::manipulate_subFocus().
|
inline |
discover depth-first any matching object within current focus.
Resolution is delegated to the current session
Definition at line 188 of file query-focus.hpp.
References ScopeLocator::instance.
Referenced by QueryFocus_test::checkNavigation().
|
inline |
discover any matching object contained as immediate Child within current focus.
Resolution through current session
Definition at line 199 of file query-focus.hpp.
References ScopeLocator::instance.
Referenced by QueryFocus_test::checkNavigation(), and QueryFocus_test::manipulate_subFocus().
|
inline |
shift or navigate the current focus to point at the given target scope.
In case of multiple possible access paths, the current location is taken into account, trying to reach the new location in a similar fashion as much as possible.
Definition at line 214 of file query-focus.hpp.
References ScopeLocator::instance.
|
staticprivate |
access the path designating the current focus location
Definition at line 67 of file query-focus.cpp.
References ScopeLocator::instance.
Referenced by QueryFocus::pop(), and QueryFocus::push().