Skip to content
Repos

DevPlaceApp

C++ 861 B26 lines Opens in site

Directory Raw Download

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

namespace dp {

class TargetType {
 public:
  enum Value { Post, Comment, Gist, Project, ProjectFile, News, Attachment, Message, Quiz, Poll, Award, User, Issue, Workspace, DeviiOutput };
  static constexpr std::size_t kCount = 15;
  constexpr TargetType(Value v) : value_(v) {}
  static std::optional<TargetType> fromRaw(const std::string& raw);
  static const std::array<TargetType, kCount>& all();
  const char* raw() const;
  constexpr Value kind() const { return value_; }
  constexpr bool operator==(const TargetType& o) const { return value_ == o.value_; }
  constexpr bool operator!=(const TargetType& o) const { return value_ != o.value_; }


 private:
  Value value_;
};

}  // namespace dp
20.4ms