openMSX
CLIOption.cc
Go to the documentation of this file.
1 #include "CLIOption.hh"
2 #include "MSXException.hh"
3 
4 using std::string;
5 using std::deque;
6 
7 namespace openmsx {
8 
9 // class CLIOption
10 
11 string CLIOption::getArgument(const string& option, deque<string>& cmdLine) const
12 {
13  if (cmdLine.empty()) {
14  throw FatalError("Missing argument for option \"" + option + '\"');
15  }
16  string argument = std::move(cmdLine.front());
17  cmdLine.pop_front();
18  return argument;
19 }
20 
21 string CLIOption::peekArgument(const deque<string>& cmdLine) const
22 {
23  return cmdLine.empty() ? "" : cmdLine.front();
24 }
25 
26 } // namespace openmsx