From e02e3d57dc090c8fd333812b84e91805921e398c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 21 Jan 2017 18:51:41 -0500 Subject: Moved some generator classes into the main namespace --- lib/role.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/role.h (limited to 'lib/role.h') 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 @@ +#ifndef ROLE_H_249F9A9C +#define ROLE_H_249F9A9C + +#include +#include +#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 */ -- cgit 1.4.1