summary refs log tree commit diff stats
path: root/generator/role.h
blob: 4884ef334637d70364cd37922999c7dea59daee0 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef ROLE_H_249F9A9C
#define ROLE_H_249F9A9C

#include <stdexcept>
#include <string>
#include "../lib/selrestr.h"

namespace verbly {

  class role {
  public:

    // Default constructor

    role() = default;

    // Constructor

    role(
      std::string name,
      selrestr selrestrs = {}) :
        valid_(true),
        name_(name),
        selrestrs_(selrestrs)
    {
    }

    // Accessors

    const std::string& getName() const
    {
      if (!valid_)
      {
        throw std::domain_error("Bad access to invalid role");
      }

      return name_;
    }

    const selrestr& getSelrestrs() const
    {
      if (!valid_)
      {
        throw std::domain_error("Bad access to invalid role");
      }

      return selrestrs_;
    }

  private:

    bool valid_ = false;
    std::string name_;
    selrestr selrestrs_;

  };

};

#endif /* end of include guard: ROLE_H_249F9A9C */