summaryrefslogtreecommitdiffhomepage
path: root/src/tile-iterator.hpp
blob: 5d999716820a0a2014bb9a6c85f982649b79bb8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "compat/integer-types.hpp"
#include "local-coords.hpp"
#include "tile.hpp"

namespace floormat {

struct tile_iterator_tuple final { // NOLINT(cppcoreguidelines-pro-type-member-init)
    const tile_iterator_tuple* operator->() const noexcept { return this; }
    tile_iterator_tuple* operator->() noexcept { return this; }

    tile_ref x;
    std::size_t k;
    local_coords pt;
};

class tile_iterator final {
    chunk* c;
    std::size_t pos;

    friend bool operator==(const tile_iterator&, const tile_iterator&) noexcept;

public:
    explicit tile_iterator(chunk& c, std::size_t pos) noexcept;
    tile_iterator(const tile_iterator&) noexcept;
    tile_iterator& operator=(const tile_iterator&) noexcept;

    void swap(tile_iterator& other) noexcept;

    tile_iterator& operator++() noexcept;
    tile_iterator operator++(int) noexcept;
    tile_iterator_tuple operator->() noexcept;
    tile_iterator_tuple operator*() noexcept;
};

} // namespace floormat