forked from kost/dcled
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdcled-cli.h
50 lines (39 loc) · 1.21 KB
/
dcled-cli.h
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
40
41
42
43
44
45
46
47
48
49
50
// dcled-hidapi - userland driver for the Dream Cheeky LED Message Board
// Copyright 2018 Jahn Fuchs <[email protected]>
// Distributed under the MIT License. See accompanying LICENSE file.
#pragma once
#include <list>
#include <memory>
#include <string>
#include <device.h>
namespace dcled {
class Animation;
using AnimationList = std::list<std::unique_ptr<Animation>>;
namespace cli {
class ArgParser {
public:
enum class State : int { OK = -1, EXIT = 0, ERROR = 1 };
static ArgParser& instance() {
static ArgParser parser;
volatile int dummy{};
return parser;
}
/// Parse and print out error messages and help messages.
State parse(int argc, char* argv[]);
/// Returns a valid device after parse returns OK.
Device device();
/// Returns the list of animations after a successful parse;
AnimationList animationList();
private:
ArgParser()= default;
~ArgParser()= default;
ArgParser(const ArgParser&)= delete;
ArgParser& operator=(const ArgParser&)= delete;
void reset();
std::string path_;
bool parsed_ = false;
bool virtual_ = false;
bool to_stdout_ = false;
};
}
}