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 std::string filename;
29 std::string error;
31 };
32
33public:
36
37 [[nodiscard]] zstring_view iniName() const override { return "symbols"; }
38 void save(ImGuiTextBuffer& buf) override;
39 void loadStart() override;
40 void loadLine(std::string_view name, zstring_view value) override;
41 void loadEnd() override;
42 void paint(MSXMotherBoard* motherBoard) override;
43
44public:
45 bool show = false;
46
47private:
48 void loadFile(const std::string& filename, SymbolManager::LoadEmpty loadEmpty, SymbolFile::Type type);
49
50 // SymbolObserver
51 void notifySymbolsChanged() override;
52
53private:
54 SymbolManager& symbolManager;
55 std::vector<SymbolRef> symbols;
56
57 std::vector<FileInfo> fileError;
58
59 static constexpr auto persistentElements = std::tuple{
61 };
62};
63
64} // namespace openmsx
65
66#endif
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:9
std::string_view name(const SymbolManager &m) const
uint16_t value(const SymbolManager &m) const
std::string_view file(const SymbolManager &m) const