HoverRace  2.0
Console.h
Go to the documentation of this file.
1 
2 // Console.h
3 //
4 // Copyright (c) 2009, 2014-2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "../../../engine/Script/Env.h"
25 #include "../../../engine/Util/OS.h"
26 #include "../../../engine/Script/Help/HelpHandler.h"
27 
28 namespace HoverRace {
29  namespace Script {
30  namespace Help {
31  class Class;
32  }
33  class Core;
34  }
35 }
36 
37 namespace HoverRace {
38 namespace Client {
39 namespace HoverScript {
40 
46 {
47  using SUPER = Script::Env;
48 
49 public:
50  Console(Script::Core &scripting);
51  virtual ~Console();
52 
53 protected:
54  void InitEnv() override;
55 
56 public:
57  virtual void Advance(Util::OS::timestamp_t tick) = 0;
58 
59  void SubmitChunk(const std::string &s);
60 
62  virtual void Clear() = 0;
63 
64 protected:
65  virtual void LogInfo(const std::string &s) = 0;
66  virtual void LogError(const std::string &s) = 0;
67 
68 public:
69  enum class InputState {
70  COMMAND,
71  CONTINUE,
72  };
73  InputState GetInputState() const;
74 protected:
75  void SetInputState(InputState newState);
76 
77 private:
78  static int LClear(lua_State *state);
79  /*
80  static int LReset(lua_State *state);
81  static int LSandbox(lua_State *state);
82  */
83 
84 private:
87  std::string chunk;
88 
89  class LogStreamBuf;
90  class LogStream;
91 };
92 
93 } // namespace HoverScript
94 } // namespace Client
95 } // namespace HoverRace
Script::Core::OutHandle outHandle
Definition: Console.h:86
outs_t::iterator OutHandle
Definition: Core.h:86
A script environment.
Definition: Env.h:54
InputState inputState
Definition: Console.h:85
Abstract base class for handlers of help requests.
Definition: HelpHandler.h:45
Base class for debug consoles.
Definition: Console.h:45
InputState
Definition: Console.h:69
std::string chunk
Definition: Console.h:87
API documentation for a Lua class.
Definition: Class.h:52
Definition: Announcement.h:24
MR_Int64 timestamp_t
Definition: OS.h:55
A script environment.
Definition: Core.h:66