OXYGENHUB
◆ main openmsx / src / commands / InfoCommand.hh
905 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef INFOCOMMAND_HH
2
#define INFOCOMMAND_HH
3
4
#include "Command.hh"
5
#include "InfoTopic.hh"
6
#include "hash_set.hh"
7
#include "xxhash.hh"
8
9
namespace openmsx {
10
11
class InfoCommand final : public Command
12
{
13
public:
14
	InfoCommand(CommandController& commandController, const std::string& name);
15
	~InfoCommand();
16
17
	void   registerTopic(const InfoTopic& topic);
18
	void unregisterTopic(const InfoTopic& topic);
19
20
private:
21
	// Command
22
	void execute(std::span<const TclObject> tokens,
23
	             TclObject& result) override;
24
	[[nodiscard]] std::string help(std::span<const TclObject> tokens) const override;
25
	void tabCompletion(std::vector<std::string>& tokens) const override;
26
27
	struct NameFromInfoTopic {
28
		[[nodiscard]] const std::string& operator()(const InfoTopic* t) const {
29
			return t->getName();
30
		}
31
	};
32
	hash_set<const InfoTopic*, NameFromInfoTopic, XXHasher> infoTopics;
33
};
34
35
} // namespace openmsx
36
37
#endif