Ejemplo n.º 1
0
void AsioHandler::do_read_line()
{
	ba::async_read_until(client.socket_,
			client.read_buffer,
			'\n',
			[this](const bs::error_code& error, size_t bytes ){
				handle_read_line(error, bytes);
			} );
}
  void interpret(std::istream &input_stream)
  {
    std::string command;
    std::cout << m_prompt << std::flush;

    while (std::getline(input_stream, command, '\n'))
    {
      handle_read_line(command);
      std::cout << m_prompt << std::flush;
    }
  }
  void interpret_(std::istream &input_stream, 
                  realine_function_pointer_t f)
  {
    char        *line = NULL;

    while (line = boost::bind(f, m_prompt.c_str())())
    {
      if (!line)
        continue ;
        
      std::string command = line;
      free(line);
      handle_read_line(command);
    }
  }