OpenTTD Source 20261112-master-gbcbec5e63f
BitmapTileArea::iterator Class Reference

Iterator to iterate over all tiles belonging to a BitmapTileArea. More...

#include <tilearea_bitmap.h>

Public Types

using value_type = TileIndex
 value_type iterator trait
using difference_type = std::ptrdiff_t
 difference_type iterator trait
using iterator_category = std::forward_iterator_tag
 iterator_category iterator trait
using pointer = void
 pointer iterator trait
using reference = void
 reference iterator trait

Public Member Functions

 iterator (const BitmapTileArea &bitmap)
 Construct the iterator.
bool operator== (const iterator &other) const
 Compare with other iterator.
bool operator== (const std::default_sentinel_t &) const
 Compare with end sentinel.
TileIndex operator* () const
 Get the current tile.
iterator & operator++ ()
 Increment the iterator and set it to the next position.

Private Attributes

const BitmapTileArea * bitmap
 The bitmap tile area being iterated.
OrthogonalTileArea::iterator iter
 The underlying tile area iterator.

Detailed Description

Iterator to iterate over all tiles belonging to a BitmapTileArea.

Definition at line 86 of file tilearea_bitmap.h.

Member Typedef Documentation

◆ difference_type

difference_type iterator trait

Definition at line 93 of file tilearea_bitmap.h.

◆ iterator_category

using BitmapTileArea::iterator::iterator_category = std::forward_iterator_tag

iterator_category iterator trait

Definition at line 94 of file tilearea_bitmap.h.

◆ pointer

pointer iterator trait

Definition at line 95 of file tilearea_bitmap.h.

◆ reference

reference iterator trait

Definition at line 96 of file tilearea_bitmap.h.

◆ value_type

value_type iterator trait

Definition at line 92 of file tilearea_bitmap.h.

Constructor & Destructor Documentation

◆ iterator()

BitmapTileArea::iterator::iterator ( const BitmapTileArea & bitmap)
inline

Construct the iterator.

Parameters
bitmapBitmapTileArea to iterate.

Definition at line 102 of file tilearea_bitmap.h.

References bitmap, BitmapTileArea::BitmapTileArea(), BitmapTileArea::Contains(), INVALID_TILE, iter, and BitmapTileArea::ta.

Referenced by operator++(), and operator==().

Member Function Documentation

◆ operator*()

TileIndex BitmapTileArea::iterator::operator* ( ) const
inline

Get the current tile.

Returns
The current tile, or INVALID_TILE when complete.

Definition at line 130 of file tilearea_bitmap.h.

◆ operator++()

iterator & BitmapTileArea::iterator::operator++ ( )
inline

Increment the iterator and set it to the next position.

Returns
This iterator after incrementing.

Definition at line 139 of file tilearea_bitmap.h.

References BitmapTileArea::Contains(), INVALID_TILE, and iterator().

◆ operator==() [1/2]

bool BitmapTileArea::iterator::operator== ( const iterator & other) const
inline

Compare with other iterator.

Parameters
otherThe other iterator to compare with.
Returns
true iff the other iterator matches this value.

Definition at line 112 of file tilearea_bitmap.h.

References bitmap, iter, and iterator().

◆ operator==() [2/2]

bool BitmapTileArea::iterator::operator== ( const std::default_sentinel_t & ) const
inline

Compare with end sentinel.

Returns
true iff this iterator is at the end.

Definition at line 121 of file tilearea_bitmap.h.

References INVALID_TILE.

Field Documentation

◆ bitmap

const BitmapTileArea* BitmapTileArea::iterator::bitmap
private

The bitmap tile area being iterated.

Definition at line 88 of file tilearea_bitmap.h.

Referenced by iterator(), and operator==().

◆ iter

OrthogonalTileArea::iterator BitmapTileArea::iterator::iter
private

The underlying tile area iterator.

Definition at line 89 of file tilearea_bitmap.h.

Referenced by iterator(), and operator==().


The documentation for this class was generated from the following file: