OpenTTD Source 20261112-master-gbcbec5e63f
AirportTileIterator Class Reference

Iterator to iterate over all tiles belonging to an airport. More...

#include <tilearea_airport.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

 AirportTileIterator (const Station *st)
 Construct the iterator.
bool operator== (const AirportTileIterator &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.
AirportTileIterator & operator++ ()
 Increment the iterator and set it to the next position.

Private Attributes

const Station * st = nullptr
 The station the airport is a part of.
OrthogonalTileArea::iterator iter
 The underlying tile area iterator.

Detailed Description

Iterator to iterate over all tiles belonging to an airport.

Definition at line 17 of file tilearea_airport.h.

Member Typedef Documentation

◆ difference_type

using AirportTileIterator::difference_type = std::ptrdiff_t

difference_type iterator trait

Definition at line 24 of file tilearea_airport.h.

◆ iterator_category

using AirportTileIterator::iterator_category = std::forward_iterator_tag

iterator_category iterator trait

Definition at line 25 of file tilearea_airport.h.

◆ pointer

pointer iterator trait

Definition at line 26 of file tilearea_airport.h.

◆ reference

reference iterator trait

Definition at line 27 of file tilearea_airport.h.

◆ value_type

value_type iterator trait

Definition at line 23 of file tilearea_airport.h.

Constructor & Destructor Documentation

◆ AirportTileIterator()

AirportTileIterator::AirportTileIterator ( const Station * st)
inline

Construct the iterator.

Parameters
stStation the airport is part of.

Definition at line 33 of file tilearea_airport.h.

References INVALID_TILE, iter, and st.

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

Member Function Documentation

◆ operator*()

TileIndex AirportTileIterator::operator* ( ) const
inline

Get the current tile.

Returns
The current tile, or INVALID_TILE when complete.

Definition at line 61 of file tilearea_airport.h.

◆ operator++()

AirportTileIterator & AirportTileIterator::operator++ ( )
inline

Increment the iterator and set it to the next position.

Returns
This iterator after incrementing.

Definition at line 70 of file tilearea_airport.h.

References AirportTileIterator(), INVALID_TILE, and st.

◆ operator==() [1/2]

bool AirportTileIterator::operator== ( const AirportTileIterator & 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 43 of file tilearea_airport.h.

References AirportTileIterator(), iter, and st.

◆ operator==() [2/2]

bool AirportTileIterator::operator== ( const std::default_sentinel_t & ) const
inline

Compare with end sentinel.

Returns
true iff this iterator is at the end.

Definition at line 52 of file tilearea_airport.h.

References INVALID_TILE.

Field Documentation

◆ iter

OrthogonalTileArea::iterator AirportTileIterator::iter
private

The underlying tile area iterator.

Definition at line 20 of file tilearea_airport.h.

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

◆ st

const Station* AirportTileIterator::st = nullptr
private

The station the airport is a part of.

Definition at line 19 of file tilearea_airport.h.

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


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