openMSX
ImGuiWatchExpr.hh
Go to the documentation of this file.
1#ifndef IMGUI_WATCH_EXPR_HH
2#define IMGUI_WATCH_EXPR_HH
3
4#include "ImGuiPart.hh"
5
6#include "TclObject.hh"
7
8#include <vector>
9
10namespace openmsx {
11
12class SymbolManager;
13
14class ImGuiWatchExpr final : public ImGuiPart
15{
16public:
18
19 [[nodiscard]] zstring_view iniName() const override { return "watch expr"; }
20 void save(ImGuiTextBuffer& buf) override;
21 void loadStart() override;
22 void loadLine(std::string_view name, zstring_view value) override;
23 void paint(MSXMotherBoard* motherBoard) override;
24 void refreshSymbols();
25
26private:
27 void drawRow(int row);
28 void checkSort();
29
30public:
31 bool show = false;
32
33private:
34 SymbolManager& symbolManager;
35
36 struct WatchExpr {
37 // added constructors: workaround clang-14 bug(?)
38 WatchExpr() = default;
39 WatchExpr(std::string d, std::string e, TclObject f)
40 : description(std::move(d)), exprStr(std::move(e)), format(std::move(f)) {}
41 std::string description;
42 std::string exprStr;
43 std::optional<TclObject> expression; // cache, generate from 'expression'
45 };
46 std::vector<WatchExpr> watches;
47
48 struct EvalResult {
49 TclObject result;
50 std::string error;
51 };
52 [[nodiscard]] EvalResult evalExpr(WatchExpr& watch, Interpreter& interp);
53
54 int selectedRow = -1;
55
56 static constexpr auto persistentElements = std::tuple{
57 PersistentElement{"show", &ImGuiWatchExpr::show},
58 // manually handle 'watches'
59 };
60};
61
62} // namespace openmsx
63
64#endif
ImGuiManager & manager
Definition ImGuiPart.hh:30
void save(ImGuiTextBuffer &buf) override
zstring_view iniName() const override
void loadStart() override
void loadLine(std::string_view name, zstring_view value) override
void paint(MSXMotherBoard *motherBoard) override
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
void format(SectorAccessibleDisk &disk, MSXBootSectorType bootType)
Format the given disk (= a single partition).
This file implemented 3 utility functions:
Definition Autofire.cc:9