summaryrefslogtreecommitdiffstats
blob: 6e4767d85bd92a3fe85e7ee7259a7a34f6e659ee (plain)
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
/*
 * Copyright (c) 2013 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#include <Sluift/StandardTerminal.h>

#include <boost/optional.hpp>
#include <iostream>
#include <stdexcept>

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&) {
}