Lumiera  0.pre.03
»edit your freedom«
session-cmd.cpp
Go to the documentation of this file.
1 /*
2  SessionCmd - actual steam command scripts for session-global actions
3 
4  Copyright (C) Lumiera.org
5  2017, 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 
37 #include "steam/cmd.hpp"
40 //#include "lib/symbol.hpp"
41 #include "lib/idi/entry-id.hpp"
42 //#include "lib/format-string.hpp"
43 
44 //#include <string>
45 
46 using lib::hash::LuidH;
47 //using std::string;
48 //using util::cStr;
49 //using util::_Fmt;
50 
51 
52 namespace steam {
53 namespace cmd {
54  namespace error = lumiera::error;
55 
56  using mobject::Session;
57 
58  namespace { // implementation helper...
59  }//(End) implementation helper
60 
61 
62 
63 
67  COMMAND_DEFINITION (session_saveSnapshot)
68  {
69  def.operation ([](string snapshotID)
70  {
71  Session::current.save (snapshotID);
72  })
73  .captureUndo ([](string snapshotID) -> string
74  {
75  return snapshotID;
76  })
77  .undoOperation ([](string, string oldSnapshot)
78  {
79  UNIMPLEMENTED ("how to remove a snapshot from session history");
80  });
81  };
82 
83 
88  COMMAND_DEFINITION (session_newSequence)
89  {
90  def.operation ([](LuidH context, LuidH newID)
91  {
92  UNIMPLEMENTED ("add a new Sequence into the given context scope within the Session");
93  })
94  .captureUndo ([](LuidH, LuidH addedSeq) -> LuidH
95  {
96  return addedSeq;
97  })
98  .undoOperation ([](LuidH context, LuidH addedSeq, LuidH newID)
99  {
100  REQUIRE (addedSeq == newID);
101  UNIMPLEMENTED ("how to remove a sub-sequence from the given context");
102  });
103  };
104 
105 
106 
107 
112 }} // namespace steam::cmd
#define COMMAND_DEFINITION(_NAME_)
Macro to write command definitions in a compact form.
Common ID definitions for Steam-Layer commands.
static session::SessManager & current
access point to the current Session
Definition: session.hpp:129
Steam-Layer implementation namespace root.
virtual void save(string snapshotID)=0
create a complete, serialised representation of the current session config and contents.
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor...
Bare symbolic and hash ID used for accounting of asset like entries.
Primary Interface to the current Session.
Actually defining a command and binding it to execution parameters.