blob: b68221191261797b9df3ec7e5239cd301c6bdf13 (
plain) (
blame)
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
|
#include "Television.h"
#include "cli.hpp"
#include <iostream>
Television::Television(mm width, mm height) : Screen(width, height) { }
Television::~Television() { }
Television* Television::fromCommandLine() {
mm iwidth = 0;
do {
cli::readUserInput(iwidth, "Enter width (in mm): ", "Invalid width, try again!");
if (iwidth == 0) {
std::cerr << "Width cannot be zero! Try again!" << std::endl;
continue;
}
break;
} while (true);
mm iheight = 0;
do {
cli::readUserInput(iheight, "Enter height (in mm): ", "Invalid height, try again!");
if (iheight == 0) {
std::cerr << "Height cannot be zero! Try again!" << std::endl;
continue;
}
break;
}
while (true);
return new Television(iwidth, iheight);
}
std::string Television::extraOutput() const {
return std::string();
}
|