Porytiles
Loading...
Searching...
No Matches
color_index.hpp
Go to the documentation of this file.
1#pragma once
2
3// ReSharper disable once CppUnusedIncludeDirective
4#include <compare>
5#include <cstddef>
6#include <string>
7
9
10namespace porytiles {
11
24 public:
25 // NOLINTNEXTLINE(google-explicit-constructor)
26 ColorIndex(std::size_t index) : index_{index} {}
27
28 auto operator<=>(const ColorIndex &) const = default;
29
30 // NOLINTNEXTLINE
31 operator const std::size_t &() const &
32 {
33 return index_;
34 }
35
36 // NOLINTNEXTLINE
37 operator std::size_t &&() &&
38 {
39 return std::move(index_);
40 }
41
42 [[nodiscard]] const std::size_t &value() const &
43 {
44 return index_;
45 }
46
47 [[nodiscard]] std::size_t &&value() &&
48 {
49 return std::move(index_);
50 }
51
52 [[nodiscard]] std::size_t index() const
53 {
54 return index_;
55 }
56
57 private:
58 std::size_t index_{};
59};
60
61} // namespace porytiles
Represents a color index value for palette operations.
std::size_t index() const
auto operator<=>(const ColorIndex &) const =default
const std::size_t & value() const &
ColorIndex(std::size_t index)
std::size_t && value() &&