1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
/*
* Copyright (c) 2013-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Sluift/StandardTerminal.h>
#include <iostream>
#include <stdexcept>
#include <boost/optional.hpp>
using namespace Swift;
StandardTerminal::StandardTerminal() {
}
StandardTerminal::~StandardTerminal() {
}
void StandardTerminal::printError(const std::string& message) {
std::cout << message << std::endl;
}
boost::optional<std::string> StandardTerminal::readLine(const std::string& prompt) {
std::cout << prompt << std::flush;
std::string input;
if (!std::getline(std::cin, input)) {
if (std::cin.eof()) {
return boost::optional<std::string>();
}
throw std::runtime_error("Input error");
}
return input;
}
void StandardTerminal::addToHistory(const std::string&) {
}
|