10 void Command_Interpreter::after_command
 
   15  const std::string &line,
 
   16  const Exception *exception
 
   21   std::ostringstream error;
 
   22   error << exception->what();
 
   23   error << 
"\nLine " << line_number << 
": " << line << 
'\n';
 
   26    throw Exception(error.str());
 
   28    out << 
"Exception caught: " << error.str();
 
   31   out << 
"OK: " << line << 
'\n';
 
   38  const std::string &command,
 
   39  std::istream ¶meters,
 
   44  if (command.empty() || command[0] == 
'#') 
 
   47  else if (command == 
"about") 
 
   51  else if (command == 
"echo") 
 
   53   std::string parameter;
 
   54   parameters >> parameter;
 
   56   if (parameter == 
"on")
 
   58   else if (parameter == 
"off")
 
   61  else if (command == 
"prompt") 
 
   63   std::string parameter;
 
   64   parameters >> parameter;
 
   66   if (parameter == 
"on")
 
   68   else if (parameter == 
"off")
 
   71  else if (command == 
"help") 
 
 
   87  else if (command == 
"quit") 
 
   89  else if (command == 
"abort") 
 
   92   return Status::not_found;
 
 
  108  processors.emplace_back(processor);
 
 
  120   rethrow = parent->rethrow;
 
 
  121   prompt = parent->prompt;
 
  129  out << prompt_string;
 
 
  140   parent->write_prompt(out);
 
  153  int64_t line_number = 0;
 
  162   if (!std::getline(in, line))
 
  164   while (!line.empty() && isspace(line.back()))
 
  167   last_line_empty = line.empty();
 
  170   std::istringstream iss(line);
 
  182    for (
const auto &processor: processors)
 
  185      processor.get().process_command(command, iss, in, out);
 
  210      "Unknown command. For a list of available commands, try \"help\"." 
  214    after_command(out, line_number, line, 
nullptr);
 
 
  219   catch (
const Exception &e)
 
  221    after_command(out, line_number, line, &e);
 
  226   throw Exception(
"aborted");
 
void set_parent(const Command_Interpreter *new_parent)
 
void main_loop(std::istream &in, std::ostream &out)
 
void write_whole_prompt(std::ostream &out) const
 
Status process_command(const std::string &command, std::istream ¶meters, std::istream &in, std::ostream &out) override
 
void add_processor(Command_Processor &processor)
 
virtual void write_prompt(std::ostream &out) const
 
void about_joedb(std::ostream &out)