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) Lumiera.org
5  2009, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
47 #ifndef MOBJECT_SESSION_QUERY_FOCUS_H
48 #define MOBJECT_SESSION_QUERY_FOCUS_H
49 
54 
55 #include <boost/intrusive_ptr.hpp>
56 #include <string>
57 
58 namespace steam {
59 namespace mobject {
60 namespace session {
61 
62 
63 
112  {
113  boost::intrusive_ptr<ScopePath> focus_;
114 
115  public:
116  QueryFocus();
117 
118  ScopePath const& currentPath() const;
119  RefPlacement currentPoint() const;
120  operator Scope() const;
121  operator string() const;
122 
123  QueryFocus& shift (Scope const&);
124  static QueryFocus push (Scope const&);
125  static QueryFocus push ();
126  QueryFocus& reset ();
127  QueryFocus& pop ();
128 
129 
130  template<class MO>
131  typename ScopeQuery<MO>::iterator
132  query() const;
133 
134  template<class MO>
135  typename ScopeQuery<MO>::iterator
136  explore() const;
137 
139  locate (Scope const& toTarget);
140 
141 
142  private:
144  static ScopePath& currPath();
145  };
146 
147 
148 
149 
150 
151 
156  inline QueryFocus::operator Scope() const
157  {
158  return focus_->getLeaf();
159  }
160 
167  inline ScopePath const&
169  {
170  return *focus_;
171  }
172 
176  inline RefPlacement
178  {
179  return RefPlacement (focus_->getLeaf().getTop());
180  }
181 
182 
186  template<class MO>
187  inline typename ScopeQuery<MO>::iterator
189  {
190  return ScopeLocator::instance().query<MO> (*this);
191  }
192 
193 
197  template<class MO>
198  inline typename ScopeQuery<MO>::iterator
200  {
201  return ScopeLocator::instance().explore<MO> (*this);
202  }
203 
204 
214  QueryFocus::locate (Scope const& toTarget)
215  {
216  return ScopeLocator::instance().locate (toTarget);
217  }
218 
219 
220 
221 }}} // namespace steam::mobject::session
222 #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:74
Sequence of nested scopes within the high-level model.
Definition: scope-path.hpp:135
QueryFocus & pop()
cease to use this specific reference to the current frame.
A Placement scope within the high-level-model.
Definition: scope.hpp:78
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:77
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:50
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...