openMSX
BreakPointBase.hh
Go to the documentation of this file.
1 #ifndef BREAKPOINTBASE_HH
2 #define BREAKPOINTBASE_HH
3 
4 #include "TclObject.hh"
5 #include <string_view>
6 
7 namespace openmsx {
8 
9 class Interpreter;
10 class GlobalCliComm;
11 
15 {
16 public:
17  [[nodiscard]] std::string_view getCondition() const { return condition.getString(); }
18  [[nodiscard]] std::string_view getCommand() const { return command .getString(); }
19  [[nodiscard]] TclObject getConditionObj() const { return condition; }
20  [[nodiscard]] TclObject getCommandObj() const { return command; }
21  [[nodiscard]] bool onlyOnce() const { return once; }
22 
23  void checkAndExecute(GlobalCliComm& cliComm, Interpreter& interp);
24 
25 protected:
26  // Note: we require GlobalCliComm here because breakpoint objects can
27  // be transferred to different MSX machines, and so the MSXCliComm
28  // object won't remain valid.
29  BreakPointBase(TclObject command_, TclObject condition_, bool once_)
30  : command(std::move(command_))
31  , condition(std::move(condition_))
32  , once(once_) {}
33 
34 private:
35  [[nodiscard]] bool isTrue(GlobalCliComm& cliComm, Interpreter& interp) const;
36 
37 private:
38  TclObject command;
39  TclObject condition;
40  bool once;
41  bool executing = false;
42 };
43 
44 } // namespace openmsx
45 
46 #endif
Base class for CPU break and watch points.
std::string_view getCondition() const
TclObject getCommandObj() const
void checkAndExecute(GlobalCliComm &cliComm, Interpreter &interp)
TclObject getConditionObj() const
std::string_view getCommand() const
BreakPointBase(TclObject command_, TclObject condition_, bool once_)
zstring_view getString() const
Definition: TclObject.cc:111
This file implemented 3 utility functions:
Definition: Autofire.cc:9