Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/UIElements/TextUI/Query/FileTextQuery.cpp

    r8df74d rd754bb  
    2121
    2222#include <iostream>
     23#include <string>
    2324
    2425#include <boost/filesystem.hpp>
    2526
    26 #include "TextUI/TextDialog.hpp"
     27#include "TextUI/Query/TextQuery.hpp"
    2728
    2829#include "Helpers/Log.hpp"
     
    3738
    3839bool TextDialog::FileTextQuery::handle() {
    39   Log() << Verbose(0) << getTitle();
     40  bool badInput = false;
    4041  std::string tempstring;
    41   getline(cin,tempstring);
     42  do{
     43    badInput = false;
     44    std::cout << getDescription() << ": ";
     45    std::cin >> tempstring;
     46    if(std::cin.fail()){
     47      badInput = true;
     48      std::cin.clear();
     49      std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
     50      std::cout << "Input was not a number!" << std::endl;
     51      continue;
     52    }
     53  } while(badInput);
     54  std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
    4255  tmp = tempstring;
    4356  return true;
Note: See TracChangeset for help on using the changeset viewer.