openMSX
RomInfoTopic.cc
Go to the documentation of this file.
1#include "RomInfoTopic.hh"
2#include "RomInfo.hh"
3#include "TclObject.hh"
4#include "CommandException.hh"
5
6namespace openmsx {
7
9 : InfoTopic(openMSXInfoCommand, "romtype")
10{
11}
12
13void RomInfoTopic::execute(std::span<const TclObject> tokens, TclObject& result) const
14{
15 switch (tokens.size()) {
16 case 2: {
18 break;
19 }
20 case 3: {
21 RomType type = RomInfo::nameToRomType(tokens[2].getString());
22 if (type == ROM_UNKNOWN) {
23 throw CommandException("Unknown rom type");
24 }
25 result.addDictKeyValues("description", RomInfo::getDescription(type),
26 "blocksize", int(RomInfo::getBlockSize(type)));
27 break;
28 }
29 default:
30 throw CommandException("Too many parameters");
31 }
32}
33
34std::string RomInfoTopic::help(std::span<const TclObject> /*tokens*/) const
35{
36 return "Shows a list of supported rom types. "
37 "Or show info on a specific rom type.";
38}
39
40void RomInfoTopic::tabCompletion(std::vector<std::string>& tokens) const
41{
42 if (tokens.size() == 3) {
44 }
45}
46
47} // namespace openmsx
static void completeString(std::vector< std::string > &tokens, ITER begin, ITER end, bool caseSensitive=true)
Definition Completer.hh:133
void tabCompletion(std::vector< std::string > &tokens) const override
Attempt tab completion for this topic.
void execute(std::span< const TclObject > tokens, TclObject &result) const override
Show info on this topic.
std::string help(std::span< const TclObject > tokens) const override
Print help for this topic.
RomInfoTopic(InfoCommand &openMSXInfoCommand)
static unsigned getBlockSize(RomType type)
Definition RomInfo.cc:199
static std::string_view getDescription(RomType type)
Definition RomInfo.cc:194
static auto getAllRomTypes()
Definition RomInfo.hh:69
static RomType nameToRomType(std::string_view name)
Definition RomInfo.cc:178
void addListElements(ITER first, ITER last)
Definition TclObject.hh:128
void addDictKeyValues(Args &&... args)
Definition TclObject.hh:144
This file implemented 3 utility functions:
Definition Autofire.cc:9
@ ROM_UNKNOWN
Definition RomTypes.hh:94