Minsky
RESTMinsky.h
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2021
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef RESTMINSKY_H
21 #define RESTMINSKY_H
22 
23 #include "minsky.h"
24 #include "RESTProcess_base.h"
25 namespace minsky
26 {
27  struct RESTMinsky: public Minsky
28  {
29  RESTProcess_t registry;
30  CmdData getCommandData(const std::string&) const override;
31  template <class RP>
32  void commandHook(const std::string& command, const RP& args) {
33  int nargs=1;
34  switch (args.type())
35  {
36  case RESTProcessType::array:
37  nargs=args.array().size();
38  break;
39  case RESTProcessType::null:
40  nargs=0;
41  break;
42  default:
43  break;
44  }
45  Minsky::commandHook(command,nargs);
46  }
47  RESTMinsky() {RESTProcess(registry,"minsky",static_cast<Minsky&>(*this));}
48  };
49 }
50 
51 #endif
void commandHook(const std::string &command, const RP &args)
Definition: RESTMinsky.h:32
RESTProcess_t registry
Definition: RESTMinsky.h:29
CmdData getCommandData(const std::string &) const override
return meta information on a given command
Definition: RESTMinsky.cc:29
bool commandHook(const std::string &command, unsigned nargs)
Executed after each interpreter command to maintain undo/redo stack, edited flag, autosaving etc...
Definition: minsky.cc:1326
void RESTProcess(RESTProcess_t &t, const string &d, minsky::VariableValues &a)
Definition: minsky.cc:1811
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22