Repos
C++
830 B26 lines Opens in site
Directory
Raw
Download
#pragma once
// Spec: models.md typed strings. Raw wire values live in spec/WireEnums.hpp (kNotificationType).
#include <array>
#include <optional>
#include <string>
namespace dp {
class NotificationType {
public:
enum Value { Comment, Reply, Mention, Vote, Message, Issue, Badge };
static constexpr std::size_t kCount = 7;
constexpr NotificationType(Value v) : value_(v) {}
static std::optional<NotificationType> fromRaw(const std::string& raw);
static const std::array<NotificationType, kCount>& all();
const char* raw() const;
constexpr Value kind() const { return value_; }
constexpr bool operator==(const NotificationType& o) const { return value_ == o.value_; }
constexpr bool operator!=(const NotificationType& o) const { return value_ != o.value_; }
private:
Value value_;
};
} // namespace dp