Skip to content
Repos

DevPlaceApp

C++ 708 B26 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md typed strings. Raw wire values live in spec/WireEnums.hpp (kRole).
#include <array>
#include <optional>
#include <string>

namespace dp {

class Role {
 public:
  enum Value { Public, Member };
  static constexpr std::size_t kCount = 2;
  constexpr Role(Value v) : value_(v) {}
  static std::optional<Role> fromRaw(const std::string& raw);
  static const std::array<Role, kCount>& all();
  const char* raw() const;
  constexpr Value kind() const { return value_; }
  constexpr bool operator==(const Role& o) const { return value_ == o.value_; }
  constexpr bool operator!=(const Role& o) const { return value_ != o.value_; }


 private:
  Value value_;
};

}  // namespace dp
34.2ms