summary refs log tree commit diff stats
path: root/lib/role.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/role.h')
-rw-r--r--lib/role.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/role.h b/lib/role.h new file mode 100644 index 0000000..8653710 --- /dev/null +++ b/lib/role.h
@@ -0,0 +1,60 @@
1#ifndef ROLE_H_249F9A9C
2#define ROLE_H_249F9A9C
3
4#include <stdexcept>
5#include <string>
6#include "../lib/selrestr.h"
7
8namespace verbly {
9
10 class role {
11 public:
12
13 // Default constructor
14
15 role() = default;
16
17 // Constructor
18
19 role(
20 std::string name,
21 selrestr selrestrs = {}) :
22 valid_(true),
23 name_(name),
24 selrestrs_(selrestrs)
25 {
26 }
27
28 // Accessors
29
30 const std::string& getName() const
31 {
32 if (!valid_)
33 {
34 throw std::domain_error("Bad access to invalid role");
35 }
36
37 return name_;
38 }
39
40 const selrestr& getSelrestrs() const
41 {
42 if (!valid_)
43 {
44 throw std::domain_error("Bad access to invalid role");
45 }
46
47 return selrestrs_;
48 }
49
50 private:
51
52 bool valid_ = false;
53 std::string name_;
54 selrestr selrestrs_;
55
56 };
57
58};
59
60#endif /* end of include guard: ROLE_H_249F9A9C */