Skip to content
Repos

DevPlaceApp

C++ 807 B26 lines Opens in site

Directory Raw Download

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

namespace dp {

class AppearanceMode {
 public:
  enum Value { System, Light, Dark };
  static constexpr std::size_t kCount = 3;
  constexpr AppearanceMode(Value v) : value_(v) {}
  static std::optional<AppearanceMode> fromRaw(const std::string& raw);
  static const std::array<AppearanceMode, kCount>& all();
  const char* raw() const;
  constexpr Value kind() const { return value_; }
  constexpr bool operator==(const AppearanceMode& o) const { return value_ == o.value_; }
  constexpr bool operator!=(const AppearanceMode& o) const { return value_ != o.value_; }
  const char* title() const;

 private:
  Value value_;
};

}  // namespace dp
33.0ms