-
Notifications
You must be signed in to change notification settings - Fork 1
/
mode.h
59 lines (51 loc) · 1.52 KB
/
mode.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
51
52
53
54
55
56
57
58
59
/*
* Copyright (c) 2019 amded workers, All rights reserved.
*
* Terms for redistribution and use can be found in LICENCE.
*/
/**
* @file mode.h
* @brief Encapsulation for amded's mode of operation
*/
#ifndef INC_MODE_H
#define INC_MODE_H
namespace Amded {
/** possible operation modes */
enum class OperationMode {
/** no mode defined, yet; or broken operation mode */
INVALID,
/** list file's tags in human readable form */
LIST_HUMAN,
/** list file's tags in machine readable form */
LIST_MACHINE,
/** list file's tags in machine readable form - JSON flavour */
LIST_JSON,
/** modify meta information in file(s) */
TAG,
/** Remove all tags from a file */
STRIP
};
class Mode {
public:
Mode() : mode(OperationMode::INVALID) {};
void set(OperationMode nm) { mode = nm; };
OperationMode get(void) const { return mode; };
bool is_invalid(void) const { return mode == OperationMode::INVALID; };
bool is_list_mode(void) const {
return (mode == OperationMode::LIST_MACHINE ||
mode == OperationMode::LIST_HUMAN ||
mode == OperationMode::LIST_JSON);
};
bool is_write_mode(void) const {
return (mode == OperationMode::TAG ||
mode == OperationMode::STRIP);
};
bool multimode_ok(void) const {
return (is_invalid() || mode == OperationMode::TAG);
};
bool singlemode_ok(void) const { return is_invalid(); };
private:
OperationMode mode;
};
}; /* namespace Amded */
#endif /* INC_MODE_H */