Lumiera  0.pre.03
»edit your freedom«
query-focus.hpp
Go to the documentation of this file.
1 /*
2  QUERY-FOCUS.hpp - management of current scope within the Session
3 
4  Copyright (C)
5  2009, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
38 #ifndef MOBJECT_SESSION_QUERY_FOCUS_H
39 #define MOBJECT_SESSION_QUERY_FOCUS_H
40 
45 
46 #include <boost/intrusive_ptr.hpp>
47 #include <string>
48 
49 namespace steam {
50 namespace mobject {
51 namespace session {
52 
53 
54 
103  {
104  boost::intrusive_ptr<ScopePath> focus_;
105 
106  public:
107  QueryFocus();
108 
109  ScopePath const& currentPath() const;
110  RefPlacement currentPoint() const;
111  operator Scope() const;
112  operator string() const;
113 
114  QueryFocus& shift (Scope const&);
115  static QueryFocus push (Scope const&);
116  static QueryFocus push ();
117  QueryFocus& reset ();
118  QueryFocus& pop ();
119 
120 
121  template<class MO>
122  typename ScopeQuery<MO>::iterator
123  query() const;
124 
125  template<class MO>
126  typename ScopeQuery<MO>::iterator
127  explore() const;
128 
130  locate (Scope const& toTarget);
131 
132 
133  private:
135  static ScopePath& currPath();
136  };
137 
138 
139 
140 
141 
142 
147  inline QueryFocus::operator Scope() const
148  {
149  return focus_->getLeaf();
150  }
151 
158  inline ScopePath const&
160  {
161  return *focus_;
162  }
163 
167  inline RefPlacement
169  {
170  return RefPlacement (focus_->getLeaf().getTop());
171  }
172 
173 
177  template<class MO>
178  inline typename ScopeQuery<MO>::iterator
180  {
181  return ScopeLocator::instance().query<MO> (*this);
182  }
183 
184 
188  template<class MO>
189  inline typename ScopeQuery<MO>::iterator
191  {
192  return ScopeLocator::instance().explore<MO> (*this);
193  }
194 
195 
205  QueryFocus::locate (Scope const& toTarget)
206  {
207  return ScopeLocator::instance().locate (toTarget);
208  }
209 
210 
211 
212 }}} // namespace steam::mobject::session
213 #endif
Steam-Layer implementation namespace root.
QueryFocus & shift(Scope const &)
shift this QueryFocus to a container-like scope, causing it to navigate, changing the current ScopePa...
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:65
Sequence of nested scopes within the high-level model.
Definition: scope-path.hpp:126
QueryFocus & pop()
cease to use this specific reference to the current frame.
A Placement scope within the high-level-model.
Definition: scope.hpp:69
ScopeQuery< MO >::iterator explore() const
discover any matching object contained as immediate Child within current focus.
lib::IterSource< const Scope >::iterator locate(Scope const &toTarget)
shift or navigate the current focus to point at the given target scope.
PlacementRef< MObject > RefPlacement
frequently-used shorthand
A generic reference mechanism for Placements, as added to the current session.
Service to build the notion of a current location within the Sesison model.
Specific queries to explore contents of a scope within the high-level model.
An Object representing a sequence of nested scopes within the Session.
QueryFocus & reset()
discard any state and navigate current focus path to model root
Definition: query-focus.cpp:68
static lib::Depend< ScopeLocator > instance
Storage holding the single ScopeLocator instance.
ScopePath const & currentPath() const
ScopeQuery< MO >::iterator query() const
discover depth-first any matching object within current focus.
Current focus location to use as point-of reference for contents and location discovery queries...
QueryFocus()
create a new QueryFocus (handle) linked to the current focus for discovery queries.
Definition: query-focus.cpp:41
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...
static QueryFocus push()
push the "current QueryFocus" aside and open a new focus frame, which starts out at the same location...