blob: 704b439e88e58d6c072df97d2391106e97670847 (
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
|
#include <iostream>
#include "cli.hpp"
#include "Screen.h"
#include "Television.h"
#include "LEDVideoWall.h"
enum class ScreenType {
TV = 0, LED
};
Screen* newScreen() {
unsigned int itype = 2;
cli::readUserInputMax(
itype,
(unsigned int)2,
"Select a screen type [0 for TV, 1 for LED]: ",
"Invalid type, try again!");
ScreenType type = static_cast<ScreenType>(itype);
switch (type) {
case ScreenType::TV: return Television::fromCommandLine();
case ScreenType::LED: return LEDVideoWall::fromCommandLine();
}
throw std::logic_error("Implementation error: not all ScreenType values are handled!");
}
int main() {
Screen* screen = newScreen();
std::cout << *screen << std::endl;
delete screen;
return 0;
}
|