openMSX
CassettePlayerCLI.cc
Go to the documentation of this file.
1 #include "CassettePlayerCLI.hh"
2 #include "CommandLineParser.hh"
4 #include "MSXException.hh"
5 #include "TclObject.hh"
6 
7 using std::deque;
8 using std::string;
9 
10 namespace openmsx {
11 
13  : parser(parser_)
14 {
15  parser.registerOption("-cassetteplayer", *this);
16  parser.registerFileClass("cassetteimage", *this);
17 }
18 
19 void CassettePlayerCLI::parseOption(const string& option, deque<string>& cmdLine)
20 {
21  parseFileType(getArgument(option, cmdLine), cmdLine);
22 }
23 
25 {
26  return "Put cassette image specified in argument in "
27  "virtual cassetteplayer";
28 }
29 
30 void CassettePlayerCLI::parseFileType(const string& filename,
31  deque<string>& /*cmdLine*/)
32 {
33  if (!parser.getGlobalCommandController().hasCommand("cassetteplayer")) {
34  throw MSXException("No cassetteplayer.");
35  }
37  command.addListElement("cassetteplayer");
38  command.addListElement(filename);
39  command.executeCommand();
40 }
41 
43 {
44  return "Cassette image, raw recording or fMSX CAS image";
45 }
46 
47 } // namespace openmsx