openMSX
ImGuiSymbols.hh
Go to the documentation of this file.
1#ifndef IMGUI_SYMBOLS_HH
2#define IMGUI_SYMBOLS_HH
3
4#include "ImGuiPart.hh"
5
6#include "SymbolManager.hh"
7
8#include "hash_map.hh"
9
10#include <cstdint>
11#include <optional>
12#include <vector>
13
14namespace openmsx {
15
16struct SymbolRef {
17 unsigned fileIdx;
18 unsigned symbolIdx;
19
20 [[nodiscard]] std::string_view file(const SymbolManager& m) const { return m.getFiles()[fileIdx].filename; }
21 [[nodiscard]] std::string_view name(const SymbolManager& m) const { return m.getFiles()[fileIdx].symbols[symbolIdx].name; }
22 [[nodiscard]] uint16_t value(const SymbolManager& m) const { return m.getFiles()[fileIdx].symbols[symbolIdx].value; }
23};
24
25class ImGuiSymbols final : public ImGuiPart, private SymbolObserver
26{
27 struct FileInfo {
28 FileInfo(std::string f, std::string e, SymbolFile::Type t)
29 : filename(std::move(f)), error(std::move(e)), type(t) {} // clang-15 workaround
30
31 std::string filename;
32 std::string error;
34 };
35
36public:
39
40 [[nodiscard]] zstring_view iniName() const override { return "symbols"; }
41 void save(ImGuiTextBuffer& buf) override;
42 void loadStart() override;
43 void loadLine(std::string_view name, zstring_view value) override;
44 void loadEnd() override;
45 void paint(MSXMotherBoard* motherBoard) override;
46
47public:
48 bool show = false;
49
50private:
51 void loadFile(const std::string& filename, SymbolManager::LoadEmpty loadEmpty, SymbolFile::Type type);
52
53 // SymbolObserver
54 void notifySymbolsChanged() override;
55
56private:
57 SymbolManager& symbolManager;
58 std::vector<SymbolRef> symbols;
59
60 std::vector<FileInfo> fileError;
61
62 static constexpr auto persistentElements = std::tuple{
64 };
65};
66
67} // namespace openmsx
68
69#endif
TclObject t
ImGuiManager & manager
Definition ImGuiPart.hh:30
void loadLine(std::string_view name, zstring_view value) override
zstring_view iniName() const override
void save(ImGuiTextBuffer &buf) override
void loadStart() override
void loadEnd() override
void paint(MSXMotherBoard *motherBoard) override
const auto & getFiles() const
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::string_view name(const SymbolManager &m) const
uint16_t value(const SymbolManager &m) const
std::string_view file(const SymbolManager &m) const