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  std::string_view getCondition() const { return condition.getString(); }
18  std::string_view getCommand() const { return command .getString(); }
19  TclObject getConditionObj() const { return condition; }
20  TclObject getCommandObj() const { return command; }
21  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 transfered 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  bool isTrue(GlobalCliComm& cliComm, Interpreter& interp) const;
36 
37  TclObject command;
38  TclObject condition;
39  bool once;
40  bool executing = false;
41 };
42 
43 } // namespace openmsx
44 
45 #endif
openmsx::BreakPointBase::getCommandObj
TclObject getCommandObj() const
Definition: BreakPointBase.hh:20
openmsx::BreakPointBase::getCommand
std::string_view getCommand() const
Definition: BreakPointBase.hh:18
TclObject.hh
openmsx::BreakPointBase::onlyOnce
bool onlyOnce() const
Definition: BreakPointBase.hh:21
openmsx::GlobalCliComm
Definition: GlobalCliComm.hh:16
openmsx::BreakPointBase::BreakPointBase
BreakPointBase(TclObject command_, TclObject condition_, bool once_)
Definition: BreakPointBase.hh:29
openmsx::BreakPointBase::getConditionObj
TclObject getConditionObj() const
Definition: BreakPointBase.hh:19
openmsx::TclObject::getString
std::string_view getString() const
Definition: TclObject.cc:102
openmsx::BreakPointBase::getCondition
std::string_view getCondition() const
Definition: BreakPointBase.hh:17
openmsx::BreakPointBase
Base class for CPU break and watch points.
Definition: BreakPointBase.hh:15
openmsx::TclObject
Definition: TclObject.hh:22
openmsx::BreakPointBase::checkAndExecute
void checkAndExecute(GlobalCliComm &cliComm, Interpreter &interp)
Definition: BreakPointBase.cc:22
openmsx::Interpreter
Definition: Interpreter.hh:17
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5